commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
90b7936ccf1d60d8f4b9fda0cf035ef42fac6678
app/src/ui/lib/avatar.tsx
app/src/ui/lib/avatar.tsx
import * as React from 'react' const DefaultAvatarURL = 'https://github.com/hubot.png' /** The minimum properties we need in order to display a user's avatar. */ export interface IAvatarUser { /** The user's email. */ readonly email: string /** The user's avatar URL. */ readonly avatarURL: string } interface IAvatarProps { /** The user whose avatar should be displayed. */ readonly user?: IAvatarUser /** The title of the avatar. Defaults to `email` if provided. */ readonly title?: string } /** A component for displaying a user avatar. */ export class Avatar extends React.Component<IAvatarProps, void> { private getTitle(): string { if (this.props.title) { return this.props.title } if (this.props.user) { return this.props.user.email } return 'Unknown user' } public render() { const url = this.props.user ? this.props.user.avatarURL : DefaultAvatarURL const title = this.getTitle() return ( <img className='avatar' title={title} src={url} alt={title}/> ) } }
import * as React from 'react' const DefaultAvatarURL = 'https://github.com/hubot.png' /** The minimum properties we need in order to display a user's avatar. */ export interface IAvatarUser { /** The user's email. */ readonly email: string /** The user's avatar URL. */ readonly avatarURL: string /** The user's name. */ readonly name: string } interface IAvatarProps { /** The user whose avatar should be displayed. */ readonly user?: IAvatarUser /** The title of the avatar. Defaults to `email` if provided. */ readonly title?: string } /** A component for displaying a user avatar. */ export class Avatar extends React.Component<IAvatarProps, void> { private getTitle(): string { if (this.props.title) { return this.props.title } const user = this.props.user if (user) { const name = user.name if (name) { return `${name} <${user.email}>` } else { return user.email } } return 'Unknown user' } public render() { const url = this.props.user ? this.props.user.avatarURL : DefaultAvatarURL const title = this.getTitle() return ( <img className='avatar' title={title} src={url} alt={title}/> ) } }
Include the name in the title
Include the name in the title
TypeScript
mit
shiftkey/desktop,hjobrien/desktop,gengjiawen/desktop,BugTesterTest/desktops,kactus-io/kactus,BugTesterTest/desktops,desktop/desktop,gengjiawen/desktop,desktop/desktop,BugTesterTest/desktops,hjobrien/desktop,say25/desktop,hjobrien/desktop,kactus-io/kactus,j-f1/forked-desktop,artivilla/desktop,artivilla/desktop,artivilla/desktop,say25/desktop,artivilla/desktop,BugTesterTest/desktops,shiftkey/desktop,say25/desktop,desktop/desktop,hjobrien/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,gengjiawen/desktop,kactus-io/kactus,j-f1/forked-desktop,kactus-io/kactus,shiftkey/desktop,j-f1/forked-desktop,say25/desktop,gengjiawen/desktop
--- +++ @@ -9,6 +9,9 @@ /** The user's avatar URL. */ readonly avatarURL: string + + /** The user's name. */ + readonly name: string } interface IAvatarProps { @@ -26,8 +29,14 @@ return this.props.title } - if (this.props.user) { - return this.props.user.email + const user = this.props.user + if (user) { + const name = user.name + if (name) { + return `${name} <${user.email}>` + } else { + return user.email + } } return 'Unknown user'
6f7fcb1775ea77b79447dc874cf7e699dbc1089b
src/IUserApp.d.ts
src/IUserApp.d.ts
import { IUser } from './IUser'; export interface IUserApp { save(user: IUser): Promise<IUser>; find(query: any, options: { limit: number }): Promise<IUser[]>; authenticateUser(userNameOrEmail: string, password: string): Promise<IUser>; getAuthToken(userNameOrEmail: string, password: string): Promise<IUser>; verifyAuthToken(token: string): Promise<IUser>; hashPassword(user: IUser): Promise<IUser>; }
import { IUser, IUserArgs } from './IUser'; export interface IUserApp { save(user: IUserArgs): Promise<IUser>; find(query: any, options: { limit: number }): Promise<IUser[]>; authenticateUser(userNameOrEmail: string, password: string): Promise<IUser>; getAuthToken(userNameOrEmail: string, password: string): Promise<IUser>; verifyAuthToken(token: string): Promise<IUser>; hashPassword(user: IUser): Promise<IUser>; }
Change IUserApp.save param from IUser to IUser
Change IUserApp.save param from IUser to IUser
TypeScript
mit
polutz/ptz-user-domain
--- +++ @@ -1,7 +1,7 @@ -import { IUser } from './IUser'; +import { IUser, IUserArgs } from './IUser'; export interface IUserApp { - save(user: IUser): Promise<IUser>; + save(user: IUserArgs): Promise<IUser>; find(query: any, options: { limit: number }): Promise<IUser[]>; authenticateUser(userNameOrEmail: string, password: string): Promise<IUser>;
019525b3d048a31cabd346e7df70cbf17824fdc5
front/src/app/app.component.ts
front/src/app/app.component.ts
/* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { Component } from '@angular/core'; import { Spinkit } from 'ng-http-loader/spinkits'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public spinkit = Spinkit; }
/* * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { Component } from '@angular/core'; import { Spinkit } from 'ng-http-loader/spinkits'; import { PendingInterceptorService } from 'ng-http-loader/pending-interceptor.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { public spinkit = Spinkit; constructor(pendingInterceptorService: PendingInterceptorService) { pendingInterceptorService.pendingRequestsStatus.subscribe(pending => { if (!pending) { console.log('No http requests pending anymore'); } }); } }
Test consuming ng-http-loader/pendingRequestsStatus observable outside its own module
Test consuming ng-http-loader/pendingRequestsStatus observable outside its own module
TypeScript
mit
mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5,mpalourdio/SpringBootAngularHTML5
--- +++ @@ -9,6 +9,7 @@ import { Component } from '@angular/core'; import { Spinkit } from 'ng-http-loader/spinkits'; +import { PendingInterceptorService } from 'ng-http-loader/pending-interceptor.service'; @Component({ selector: 'app-root', @@ -17,4 +18,12 @@ }) export class AppComponent { public spinkit = Spinkit; + + constructor(pendingInterceptorService: PendingInterceptorService) { + pendingInterceptorService.pendingRequestsStatus.subscribe(pending => { + if (!pending) { + console.log('No http requests pending anymore'); + } + }); + } }
f2c0b268912c081cb2452f632b05093d4a2cc92c
app/renderer/createLogger.ts
app/renderer/createLogger.ts
// tslint:disable-next-line no-implicit-dependencies import { ipcRenderer } from "electron"; import * as toastify from "react-toastify"; import Logger, { ILoggerObj, IMessage } from "../common/Logger"; export default (loggerObj: ILoggerObj): Logger => { const logger = Logger.fromObj(loggerObj); logger.addGlobalListener((category: string, msg: IMessage) => { Logger.log2Console(category, msg); toastify.toast( msg.title + (msg.description ? ". Look at the console for more info ctrl+shift+i" : ""), { type: category as toastify.ToastType } ); ipcRenderer.send("clean-history"); }); // Catch up logger.history.forEach(logged => { logger.report(logged.category, logged.msg.title, logged.msg.description); }); ipcRenderer.on( "log", (event: Electron.Event, category: string, msg: IMessage) => { logger.report(category, msg.title, msg.description); } ); return logger; };
// tslint:disable-next-line no-implicit-dependencies import { ipcRenderer } from "electron"; import * as toastify from "react-toastify"; import Logger, { ILoggerObj, IMessage } from "../common/Logger"; export default (loggerObj: ILoggerObj): Logger => { const logger = Logger.fromObj(loggerObj); logger.addGlobalListener((category: string, msg: IMessage) => { Logger.log2Console(category, msg); toastify.toast( msg.title + (msg.description ? ". Look at the console for more info ctrl+shift+i" : ""), { type: (category === "warn" ? "warning" : category) as toastify.ToastType } ); ipcRenderer.send("clean-history"); }); // Catch up logger.history.forEach(logged => { logger.report(logged.category, logged.msg.title, logged.msg.description); }); ipcRenderer.on( "log", (event: Electron.Event, category: string, msg: IMessage) => { logger.report(category, msg.title, msg.description); } ); return logger; };
Fix warnings not working with toastify
Fix warnings not working with toastify
TypeScript
mit
ocboogie/action-hub,ocboogie/action-hub,ocboogie/action-hub
--- +++ @@ -15,7 +15,7 @@ ? ". Look at the console for more info ctrl+shift+i" : ""), { - type: category as toastify.ToastType + type: (category === "warn" ? "warning" : category) as toastify.ToastType } ); ipcRenderer.send("clean-history");
bd002d93c9ab291018d333eaae61d066096fcce6
src/cmds/dev/watch.cmd.ts
src/cmds/dev/watch.cmd.ts
import { config, run } from '../../common'; import * as syncWatch from './sync-watch.cmd'; export const group = 'dev'; export const name = 'watch'; export const alias = 'w'; export const description = 'Starts `build:watch` and `sync:watch` in tabs.'; export function cmd() { syncWatch.cmd(); run.execInNewTab(`${config.SCRIPT_PREFIX} build:watch`); } ;
import { config, run } from '../../common'; import * as syncWatch from './sync-watch.cmd'; export const group = 'dev'; export const name = 'watch'; export const alias = 'w'; export const description = 'Starts `build:watch` and `sync:watch` in tabs.'; export function cmd() { run.execInNewTab(`${config.SCRIPT_PREFIX} sync:watch`); run.execInNewTab(`${config.SCRIPT_PREFIX} build:watch`); }
Update watch command to run syncer in new tab
Update watch command to run syncer in new tab
TypeScript
mit
frederickfogerty/js-cli,frederickfogerty/js-cli,frederickfogerty/js-cli
--- +++ @@ -9,8 +9,6 @@ export function cmd() { - syncWatch.cmd(); + run.execInNewTab(`${config.SCRIPT_PREFIX} sync:watch`); run.execInNewTab(`${config.SCRIPT_PREFIX} build:watch`); } - -;
8d32ec09e33cb833ada36b6004657a024ef32eef
src/input.ts
src/input.ts
import {LEAN_MODE} from './constants' import * as vscode from 'vscode' import {CompletionItemProvider,TextDocument,Position,CancellationToken,CompletionItem,CompletionItemKind,CompletionList,Range} from 'vscode' export class LeanInputCompletionProvider implements CompletionItemProvider { translations: any; public constructor(translations: any) { this.translations = translations; } public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): CompletionList { var items = []; for (var abbrev in this.translations) { var repl = this.translations[abbrev]; var item = new CompletionItem(`\\${abbrev}`, CompletionItemKind.Text); item.insertText = repl; item.range = new Range(position.translate(0,-1), position); items.push(item); } return new CompletionList(items); } }
import {LEAN_MODE} from './constants' import * as vscode from 'vscode' import {CompletionItemProvider,TextDocument,Position,CancellationToken,CompletionItem,CompletionItemKind,CompletionList,Range} from 'vscode' export class LeanInputCompletionProvider implements CompletionItemProvider { translations: any; public constructor(translations: any) { this.translations = translations; } public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): CompletionList { const text = document.getText(); let offset = document.offsetAt(position); do { offset--; } while (/[^\\\s]/.test(text.charAt(offset))); if (text.charAt(offset) !== '\\') return null; var items = []; for (var abbrev in this.translations) { var repl = this.translations[abbrev]; var item = new CompletionItem(`\\${abbrev}`, CompletionItemKind.Text); item.insertText = repl; item.range = new Range(position.translate(0,-1), position); items.push(item); } return new CompletionList(items); } }
Complete notation only when prefixed by '\'
Complete notation only when prefixed by '\'
TypeScript
apache-2.0
leanprover/vscode-lean,leanprover/vscode-lean,leanprover/vscode-lean
--- +++ @@ -10,6 +10,13 @@ } public provideCompletionItems(document: TextDocument, position: Position, token: CancellationToken): CompletionList { + const text = document.getText(); + let offset = document.offsetAt(position); + do { + offset--; + } while (/[^\\\s]/.test(text.charAt(offset))); + if (text.charAt(offset) !== '\\') + return null; var items = []; for (var abbrev in this.translations) { var repl = this.translations[abbrev];
a57a4d755665d3a8046da50bd66e9237201a4143
packages/runtime/src/decorators/response.ts
packages/runtime/src/decorators/response.ts
export function SuccessResponse(name: string | number, description?: string): Function; export function SuccessResponse<T>(name: string | number, description?: string): Function; export function SuccessResponse<T>(name: string | number, description?: string): Function { return () => { return; }; } export function Response(name: string | number, description?: string): Function; export function Response<U>(name: string | number, description?: string): Function; export function Response<T>(name: string | number, description?: string, example?: T): Function; export function Response<T, U>(name: string | number, description?: string, example?: T): Function; export function Response<T, U>(name: string | number, description?: string, example?: T): Function { return () => { return; }; } /** * Inject a library-agnostic responder function that can be used to construct type-checked (usually error-) responses. * * The type of the responder function should be annotated `TsoaResponse<Status, Data, Headers>` in order to support OpenAPI documentation. */ export function Res(): Function { return () => { return; }; }
export function SuccessResponse<HeaderType = {}>(name: string | number, description?: string): Function { return () => { return; }; } export function Response<ExampleType, HeaderType = {}>(name: string | number, description?: string, example?: ExampleType): Function { return () => { return; }; } /** * Inject a library-agnostic responder function that can be used to construct type-checked (usually error-) responses. * * The type of the responder function should be annotated `TsoaResponse<Status, Data, Headers>` in order to support OpenAPI documentation. */ export function Res(): Function { return () => { return; }; }
Edit decorator generic type more readable
chore: Edit decorator generic type more readable Remove optional overrloading for SuccessResponse & Response type. Edit SuccessResponse & Response type's generic type more readable.
TypeScript
mit
andreasrueedlinger/tsoa,andreasrueedlinger/tsoa,lukeautry/tsoa,lukeautry/tsoa
--- +++ @@ -1,22 +1,10 @@ -export function SuccessResponse(name: string | number, description?: string): Function; - -export function SuccessResponse<T>(name: string | number, description?: string): Function; - -export function SuccessResponse<T>(name: string | number, description?: string): Function { +export function SuccessResponse<HeaderType = {}>(name: string | number, description?: string): Function { return () => { return; }; } -export function Response(name: string | number, description?: string): Function; - -export function Response<U>(name: string | number, description?: string): Function; - -export function Response<T>(name: string | number, description?: string, example?: T): Function; - -export function Response<T, U>(name: string | number, description?: string, example?: T): Function; - -export function Response<T, U>(name: string | number, description?: string, example?: T): Function { +export function Response<ExampleType, HeaderType = {}>(name: string | number, description?: string, example?: ExampleType): Function { return () => { return; };
604e1a1da21d44625f094b39a6a3315e4ffaf4f4
mkpath/mkpath-tests.ts
mkpath/mkpath-tests.ts
/// <reference path="mkpath.d.ts" /> import mkpath = require('mkpath'); mkpath('red/green/violet', function (err) { if (err) throw err; console.log('Directory structure red/green/violet created'); }); mkpath.sync('/tmp/blue/orange', 700);
/// <reference path="mkpath.d.ts" /> import mkpath = require('mkpath'); mkpath('red/green/violet', function (err) { if (err) throw err; console.log('Directory structure red/green/violet created'); }); mkpath.sync('/tmp/blue/orange', 700);
Add newline at end of file
Add newline at end of file
TypeScript
mit
benliddicott/DefinitelyTyped,Litee/DefinitelyTyped,gorcz/DefinitelyTyped,mcrawshaw/DefinitelyTyped,nfriend/DefinitelyTyped,arusakov/DefinitelyTyped,robertbaker/DefinitelyTyped,zuzusik/DefinitelyTyped,xica/DefinitelyTyped,goaty92/DefinitelyTyped,brainded/DefinitelyTyped,mszczepaniak/DefinitelyTyped,MarlonFan/DefinitelyTyped,hypno2000/typings,dmoonfire/DefinitelyTyped,abner/DefinitelyTyped,wbuchwalter/DefinitelyTyped,Zzzen/DefinitelyTyped,nakakura/DefinitelyTyped,borisyankov/DefinitelyTyped,bennett000/DefinitelyTyped,subjectix/DefinitelyTyped,isman-usoh/DefinitelyTyped,pwelter34/DefinitelyTyped,psnider/DefinitelyTyped,MugeSo/DefinitelyTyped,TildaLabs/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,rcchen/DefinitelyTyped,davidpricedev/DefinitelyTyped,teves-castro/DefinitelyTyped,jimthedev/DefinitelyTyped,leoromanovsky/DefinitelyTyped,chrilith/DefinitelyTyped,Bobjoy/DefinitelyTyped,trystanclarke/DefinitelyTyped,Trapulo/DefinitelyTyped,alextkachman/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,olemp/DefinitelyTyped,magny/DefinitelyTyped,IAPark/DefinitelyTyped,nabeix/DefinitelyTyped,alexdresko/DefinitelyTyped,jimthedev/DefinitelyTyped,blink1073/DefinitelyTyped,teddyward/DefinitelyTyped,xStrom/DefinitelyTyped,mhegazy/DefinitelyTyped,nitintutlani/DefinitelyTyped,rcchen/DefinitelyTyped,axelcostaspena/DefinitelyTyped,OfficeDev/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,sledorze/DefinitelyTyped,gyohk/DefinitelyTyped,magny/DefinitelyTyped,evansolomon/DefinitelyTyped,JaminFarr/DefinitelyTyped,timramone/DefinitelyTyped,behzad888/DefinitelyTyped,bkristensen/DefinitelyTyped,one-pieces/DefinitelyTyped,syuilo/DefinitelyTyped,stacktracejs/DefinitelyTyped,pocesar/DefinitelyTyped,mjjames/DefinitelyTyped,mcliment/DefinitelyTyped,glenndierckx/DefinitelyTyped,stylelab-io/DefinitelyTyped,xStrom/DefinitelyTyped,HPFOD/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,rockclimber90/DefinitelyTyped,scsouthw/DefinitelyTyped,hellopao/DefinitelyTyped,EnableSoftware/DefinitelyTyped,ashwinr/DefinitelyTyped,donnut/DefinitelyTyped,quantumman/DefinitelyTyped,YousefED/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,aciccarello/DefinitelyTyped,sclausen/DefinitelyTyped,Dominator008/DefinitelyTyped,Syati/DefinitelyTyped,richardTowers/DefinitelyTyped,benishouga/DefinitelyTyped,ryan10132/DefinitelyTyped,shahata/DefinitelyTyped,RX14/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,arcticwaters/DefinitelyTyped,opichals/DefinitelyTyped,davidsidlinger/DefinitelyTyped,GodsBreath/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,arusakov/DefinitelyTyped,pocesar/DefinitelyTyped,jeffbcross/DefinitelyTyped,dsebastien/DefinitelyTyped,nakakura/DefinitelyTyped,chrismbarr/DefinitelyTyped,darkl/DefinitelyTyped,bilou84/DefinitelyTyped,nmalaguti/DefinitelyTyped,gdi2290/DefinitelyTyped,robl499/DefinitelyTyped,lseguin42/DefinitelyTyped,whoeverest/DefinitelyTyped,bdoss/DefinitelyTyped,benishouga/DefinitelyTyped,shlomiassaf/DefinitelyTyped,RX14/DefinitelyTyped,optical/DefinitelyTyped,jbrantly/DefinitelyTyped,cvrajeesh/DefinitelyTyped,chrootsu/DefinitelyTyped,nseckinoral/DefinitelyTyped,daptiv/DefinitelyTyped,chbrown/DefinitelyTyped,Jwsonic/DefinitelyTyped,alextkachman/DefinitelyTyped,dflor003/DefinitelyTyped,wilfrem/DefinitelyTyped,tinganho/DefinitelyTyped,alainsahli/DefinitelyTyped,scriby/DefinitelyTyped,onecentlin/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,LordJZ/DefinitelyTyped,duongphuhiep/DefinitelyTyped,cherrydev/DefinitelyTyped,amanmahajan7/DefinitelyTyped,mjjames/DefinitelyTyped,scriby/DefinitelyTyped,hafenr/DefinitelyTyped,mattblang/DefinitelyTyped,jiaz/DefinitelyTyped,rschmukler/DefinitelyTyped,esperco/DefinitelyTyped,tarruda/DefinitelyTyped,rolandzwaga/DefinitelyTyped,duncanmak/DefinitelyTyped,georgemarshall/DefinitelyTyped,hiraash/DefinitelyTyped,musically-ut/DefinitelyTyped,ajtowf/DefinitelyTyped,frogcjn/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,georgemarshall/DefinitelyTyped,tjoskar/DefinitelyTyped,QuatroCode/DefinitelyTyped,frogcjn/DefinitelyTyped,chrootsu/DefinitelyTyped,MidnightDesign/DefinitelyTyped,yuit/DefinitelyTyped,Kuniwak/DefinitelyTyped,onecentlin/DefinitelyTyped,masonkmeyer/DefinitelyTyped,laco0416/DefinitelyTyped,hor-crux/DefinitelyTyped,zhiyiting/DefinitelyTyped,johan-gorter/DefinitelyTyped,jacqt/DefinitelyTyped,OpenMaths/DefinitelyTyped,digitalpixies/DefinitelyTyped,nycdotnet/DefinitelyTyped,dariajung/DefinitelyTyped,laball/DefinitelyTyped,danfma/DefinitelyTyped,dumbmatter/DefinitelyTyped,sclausen/DefinitelyTyped,Zorgatone/DefinitelyTyped,icereed/DefinitelyTyped,Garciat/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,acepoblete/DefinitelyTyped,kmeurer/DefinitelyTyped,Pro/DefinitelyTyped,use-strict/DefinitelyTyped,unknownloner/DefinitelyTyped,omidkrad/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,rolandzwaga/DefinitelyTyped,lekaha/DefinitelyTyped,dpsthree/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,tdmckinn/DefinitelyTyped,bdoss/DefinitelyTyped,damianog/DefinitelyTyped,dragouf/DefinitelyTyped,mendix/DefinitelyTyped,HPFOD/DefinitelyTyped,hellopao/DefinitelyTyped,esperco/DefinitelyTyped,donnut/DefinitelyTyped,Litee/DefinitelyTyped,hellopao/DefinitelyTyped,jimthedev/DefinitelyTyped,corps/DefinitelyTyped,Pipe-shen/DefinitelyTyped,aldo-roman/DefinitelyTyped,TheBay0r/DefinitelyTyped,furny/DefinitelyTyped,bennett000/DefinitelyTyped,schmuli/DefinitelyTyped,alvarorahul/DefinitelyTyped,manekovskiy/DefinitelyTyped,PascalSenn/DefinitelyTyped,subash-a/DefinitelyTyped,zalamtech/DefinitelyTyped,kalloc/DefinitelyTyped,sandersky/DefinitelyTyped,mrk21/DefinitelyTyped,arma-gast/DefinitelyTyped,micurs/DefinitelyTyped,vagarenko/DefinitelyTyped,wcomartin/DefinitelyTyped,erosb/DefinitelyTyped,martinduparc/DefinitelyTyped,pocesar/DefinitelyTyped,tomtarrot/DefinitelyTyped,stacktracejs/DefinitelyTyped,mattblang/DefinitelyTyped,use-strict/DefinitelyTyped,olivierlemasle/DefinitelyTyped,yuit/DefinitelyTyped,mattanja/DefinitelyTyped,elisee/DefinitelyTyped,greglo/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,alexdresko/DefinitelyTyped,adammartin1981/DefinitelyTyped,amanmahajan7/DefinitelyTyped,OpenMaths/DefinitelyTyped,lbguilherme/DefinitelyTyped,innerverse/DefinitelyTyped,musakarakas/DefinitelyTyped,aindlq/DefinitelyTyped,rushi216/DefinitelyTyped,takfjt/DefinitelyTyped,rschmukler/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,nmalaguti/DefinitelyTyped,Seltzer/DefinitelyTyped,damianog/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,tigerxy/DefinitelyTyped,Almouro/DefinitelyTyped,QuatroCode/DefinitelyTyped,lightswitch05/DefinitelyTyped,dwango-js/DefinitelyTyped,paulmorphy/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,nelsonmorais/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,applesaucers/lodash-invokeMap,ciriarte/DefinitelyTyped,dydek/DefinitelyTyped,superduper/DefinitelyTyped,Lorisu/DefinitelyTyped,kabogo/DefinitelyTyped,mshmelev/DefinitelyTyped,vincentw56/DefinitelyTyped,smrq/DefinitelyTyped,Penryn/DefinitelyTyped,ajtowf/DefinitelyTyped,sledorze/DefinitelyTyped,paxibay/DefinitelyTyped,arusakov/DefinitelyTyped,stephenjelfs/DefinitelyTyped,gcastre/DefinitelyTyped,newclear/DefinitelyTyped,bluong/DefinitelyTyped,olemp/DefinitelyTyped,pwelter34/DefinitelyTyped,mwain/DefinitelyTyped,jesseschalken/DefinitelyTyped,Mek7/DefinitelyTyped,minodisk/DefinitelyTyped,paulmorphy/DefinitelyTyped,maglar0/DefinitelyTyped,takenet/DefinitelyTyped,abmohan/DefinitelyTyped,philippstucki/DefinitelyTyped,borisyankov/DefinitelyTyped,jeremyhayes/DefinitelyTyped,subash-a/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,almstrand/DefinitelyTyped,Zzzen/DefinitelyTyped,Fraegle/DefinitelyTyped,dmoonfire/DefinitelyTyped,bruennijs/DefinitelyTyped,fredgalvao/DefinitelyTyped,AgentME/DefinitelyTyped,WritingPanda/DefinitelyTyped,nycdotnet/DefinitelyTyped,dreampulse/DefinitelyTyped,theyelllowdart/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,zuohaocheng/DefinitelyTyped,aciccarello/DefinitelyTyped,minodisk/DefinitelyTyped,dydek/DefinitelyTyped,jraymakers/DefinitelyTyped,florentpoujol/DefinitelyTyped,pkhayundi/DefinitelyTyped,shovon/DefinitelyTyped,mhegazy/DefinitelyTyped,mcrawshaw/DefinitelyTyped,syuilo/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,deeleman/DefinitelyTyped,amir-arad/DefinitelyTyped,Chris380/DefinitelyTyped,vpineda1996/DefinitelyTyped,nitintutlani/DefinitelyTyped,YousefED/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,biomassives/DefinitelyTyped,musicist288/DefinitelyTyped,RedSeal-co/DefinitelyTyped,nodeframe/DefinitelyTyped,giggio/DefinitelyTyped,uestcNaldo/DefinitelyTyped,vagarenko/DefinitelyTyped,philippstucki/DefinitelyTyped,eugenpodaru/DefinitelyTyped,raijinsetsu/DefinitelyTyped,arma-gast/DefinitelyTyped,gyohk/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,igorraush/DefinitelyTyped,Ptival/DefinitelyTyped,tboyce/DefinitelyTyped,gildorwang/DefinitelyTyped,alvarorahul/DefinitelyTyped,EnableSoftware/DefinitelyTyped,UzEE/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,tscho/DefinitelyTyped,gcastre/DefinitelyTyped,DenEwout/DefinitelyTyped,mareek/DefinitelyTyped,behzad888/DefinitelyTyped,hesselink/DefinitelyTyped,hatz48/DefinitelyTyped,munxar/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,jasonswearingen/DefinitelyTyped,nainslie/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,zuzusik/DefinitelyTyped,schmuli/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,raijinsetsu/DefinitelyTyped,tan9/DefinitelyTyped,adamcarr/DefinitelyTyped,chrismbarr/DefinitelyTyped,abner/DefinitelyTyped,stanislavHamara/DefinitelyTyped,vasek17/DefinitelyTyped,danfma/DefinitelyTyped,nojaf/DefinitelyTyped,drillbits/DefinitelyTyped,arcticwaters/DefinitelyTyped,Seikho/DefinitelyTyped,takenet/DefinitelyTyped,egeland/DefinitelyTyped,ducin/DefinitelyTyped,Saneyan/DefinitelyTyped,applesaucers/lodash-invokeMap,Minishlink/DefinitelyTyped,Dashlane/DefinitelyTyped,progre/DefinitelyTyped,billccn/DefinitelyTyped,vsavkin/DefinitelyTyped,smrq/DefinitelyTyped,Carreau/DefinitelyTyped,bjfletcher/DefinitelyTyped,mvarblow/DefinitelyTyped,jpevarnek/DefinitelyTyped,Riron/DefinitelyTyped,reppners/DefinitelyTyped,michalczukm/DefinitelyTyped,brettle/DefinitelyTyped,Nemo157/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,flyfishMT/DefinitelyTyped,davidpricedev/DefinitelyTyped,Deathspike/DefinitelyTyped,psnider/DefinitelyTyped,igorsechyn/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,chocolatechipui/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,jtlan/DefinitelyTyped,ecramer89/DefinitelyTyped,nobuoka/DefinitelyTyped,dsebastien/DefinitelyTyped,emanuelhp/DefinitelyTyped,mareek/DefinitelyTyped,abbasmhd/DefinitelyTyped,jaysoo/DefinitelyTyped,ashwinr/DefinitelyTyped,mattanja/DefinitelyTyped,muenchdo/DefinitelyTyped,KonaTeam/DefinitelyTyped,aroder/DefinitelyTyped,greglo/DefinitelyTyped,benishouga/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,emanuelhp/DefinitelyTyped,mrozhin/DefinitelyTyped,pocke/DefinitelyTyped,DeadAlready/DefinitelyTyped,psnider/DefinitelyTyped,optical/DefinitelyTyped,johan-gorter/DefinitelyTyped,evandrewry/DefinitelyTyped,angelobelchior8/DefinitelyTyped,brentonhouse/DefinitelyTyped,schmuli/DefinitelyTyped,gandjustas/DefinitelyTyped,reppners/DefinitelyTyped,kanreisa/DefinitelyTyped,drinchev/DefinitelyTyped,M-Zuber/DefinitelyTyped,wilfrem/DefinitelyTyped,glenndierckx/DefinitelyTyped,drinchev/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,jraymakers/DefinitelyTyped,sixinli/DefinitelyTyped,moonpyk/DefinitelyTyped,aqua89/DefinitelyTyped,greglockwood/DefinitelyTyped,the41/DefinitelyTyped,bardt/DefinitelyTyped,syntax42/DefinitelyTyped,eekboom/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,elisee/DefinitelyTyped,felipe3dfx/DefinitelyTyped,fredgalvao/DefinitelyTyped,MugeSo/DefinitelyTyped,Gmulti/DefinitelyTyped,AgentME/DefinitelyTyped,tomtheisen/DefinitelyTyped,georgemarshall/DefinitelyTyped,bpowers/DefinitelyTyped,xswordsx/DefinitelyTyped,NCARalph/DefinitelyTyped,Zorgatone/DefinitelyTyped,algorithme/DefinitelyTyped,progre/DefinitelyTyped,florentpoujol/DefinitelyTyped,pafflique/DefinitelyTyped,Penryn/DefinitelyTyped,newclear/DefinitelyTyped,UzEE/DefinitelyTyped,maxlang/DefinitelyTyped,mweststrate/DefinitelyTyped,ml-workshare/DefinitelyTyped,lbesson/DefinitelyTyped,samwgoldman/DefinitelyTyped,kuon/DefinitelyTyped,Ptival/DefinitelyTyped,forumone/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,Shiak1/DefinitelyTyped,gregoryagu/DefinitelyTyped,Dominator008/DefinitelyTyped,herrmanno/DefinitelyTyped,lucyhe/DefinitelyTyped,Ridermansb/DefinitelyTyped,stephenjelfs/DefinitelyTyped,Pro/DefinitelyTyped,gedaiu/DefinitelyTyped,haskellcamargo/DefinitelyTyped,fearthecowboy/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,wkrueger/DefinitelyTyped,tan9/DefinitelyTyped,markogresak/DefinitelyTyped,AgentME/DefinitelyTyped,DustinWehr/DefinitelyTyped,awerlang/DefinitelyTyped,gandjustas/DefinitelyTyped,flyfishMT/DefinitelyTyped,ErykB2000/DefinitelyTyped,HereSinceres/DefinitelyTyped,jsaelhof/DefinitelyTyped,trystanclarke/DefinitelyTyped,zuzusik/DefinitelyTyped,nainslie/DefinitelyTyped,AgentME/DefinitelyTyped,fnipo/DefinitelyTyped,spearhead-ea/DefinitelyTyped,hatz48/DefinitelyTyped,mshmelev/DefinitelyTyped,aciccarello/DefinitelyTyped,teves-castro/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,timjk/DefinitelyTyped,scatcher/DefinitelyTyped,robert-voica/DefinitelyTyped,jasonswearingen/DefinitelyTyped,martinduparc/DefinitelyTyped,abbasmhd/DefinitelyTyped,zensh/DefinitelyTyped,Zenorbi/DefinitelyTyped,rfranco/DefinitelyTyped,bencoveney/DefinitelyTyped,GregOnNet/DefinitelyTyped,shlomiassaf/DefinitelyTyped,martinduparc/DefinitelyTyped,rerezz/DefinitelyTyped,grahammendick/DefinitelyTyped,Dashlane/DefinitelyTyped,ayanoin/DefinitelyTyped,isman-usoh/DefinitelyTyped,egeland/DefinitelyTyped,nobuoka/DefinitelyTyped,PopSugar/DefinitelyTyped,jsaelhof/DefinitelyTyped,Karabur/DefinitelyTyped,Karabur/DefinitelyTyped,basp/DefinitelyTyped,Syati/DefinitelyTyped,chadoliver/DefinitelyTyped,hx0day/DefinitelyTyped,DeluxZ/DefinitelyTyped,georgemarshall/DefinitelyTyped,CSharpFan/DefinitelyTyped
33fc14676d09ed7a30dbc3a2968fe5674245136b
src/components/editor/editor.component.ts
src/components/editor/editor.component.ts
import {Component, OnInit, OnDestroy, ElementRef, ViewChild, EventEmitter, Output, Input} from '@angular/core'; import Editor = AceAjax.Editor; (<any>ace).config.set("basePath", "/dist"); @Component({ selector: 'editor', template: `` }) export class EditorComponent implements OnInit, OnDestroy { private editor: Editor; private _value: string; @Input() set value(val: string) { if(val === this._value) return; this._value = val; if(this.editor) { this.editor.setValue(val, 1); } } @Output() valueChange: EventEmitter<String> = new EventEmitter(); constructor(private elm: ElementRef) {} getValue(): string { return this.editor.getValue(); } ngOnInit(): void { this.editor = ace.edit(this.elm.nativeElement); this.editor.getSession().setMode('ace/mode/javascript'); this.editor.setOptions({ minLines: 5, maxLines: 15, fontSize: 14, showPrintMargin: false }); this.editor.$blockScrolling = Infinity; if(this._value) { this.editor.setValue(this._value, 1); } this.editor.on('change', () => { this._value = this.editor.getValue(); this.valueChange.emit(this._value) }); } ngOnDestroy(): void { this.editor.destroy(); } }
import {Component, OnInit, OnDestroy, ElementRef, ViewChild, EventEmitter, Output, Input} from '@angular/core'; import Editor = AceAjax.Editor; (<any>ace).config.set("basePath", "./dist"); @Component({ selector: 'editor', template: `` }) export class EditorComponent implements OnInit, OnDestroy { private editor: Editor; private _value: string; @Input() set value(val: string) { if(val === this._value) return; this._value = val; if(this.editor) { this.editor.setValue(val, 1); } } @Output() valueChange: EventEmitter<String> = new EventEmitter(); constructor(private elm: ElementRef) {} getValue(): string { return this.editor.getValue(); } ngOnInit(): void { this.editor = ace.edit(this.elm.nativeElement); this.editor.getSession().setMode('ace/mode/javascript'); this.editor.setOptions({ minLines: 5, maxLines: 15, fontSize: 14, showPrintMargin: false }); this.editor.$blockScrolling = Infinity; if(this._value) { this.editor.setValue(this._value, 1); } this.editor.on('change', () => { this._value = this.editor.getValue(); this.valueChange.emit(this._value) }); } ngOnDestroy(): void { this.editor.destroy(); } }
Fix 404 worker-javascript.js for GitHub pages
Fix 404 worker-javascript.js for GitHub pages
TypeScript
mit
kryops/jsbb,kryops/jsbb,kryops/jsbb
--- +++ @@ -1,7 +1,7 @@ import {Component, OnInit, OnDestroy, ElementRef, ViewChild, EventEmitter, Output, Input} from '@angular/core'; import Editor = AceAjax.Editor; -(<any>ace).config.set("basePath", "/dist"); +(<any>ace).config.set("basePath", "./dist"); @Component({ selector: 'editor',
28685a8761336e85c54633205eba0e3addcd2468
demo/34-floating-tables.ts
demo/34-floating-tables.ts
// Example of how you would create a table with float positions // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; import { Document, OverlapType, Packer, Paragraph, RelativeHorizontalPosition, RelativeVerticalPosition, Table, TableAnchorType, TableCell, TableLayoutType, TableRow, WidthType, } from "../build"; const doc = new Document(); const table = new Table({ rows: [ new TableRow({ children: [ new TableCell({ children: [new Paragraph("Hello")], columnSpan: 2, }), ], }), new TableRow({ children: [ new TableCell({ children: [], }), new TableCell({ children: [], }), ], }), ], float: { horizontalAnchor: TableAnchorType.MARGIN, verticalAnchor: TableAnchorType.MARGIN, relativeHorizontalPosition: RelativeHorizontalPosition.RIGHT, relativeVerticalPosition: RelativeVerticalPosition.BOTTOM, overlap: OverlapType.NEVER, }, width: { size: 4535, type: WidthType.DXA, }, layout: TableLayoutType.FIXED, }); doc.addSection({ children: [table], }); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); });
// Example of how you would create a table with float positions // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; import { Document, OverlapType, Packer, Paragraph, RelativeHorizontalPosition, RelativeVerticalPosition, Table, TableAnchorType, TableCell, TableLayoutType, TableRow, WidthType, } from "../build"; const doc = new Document(); const table = new Table({ rows: [ new TableRow({ children: [ new TableCell({ children: [new Paragraph("Hello")], columnSpan: 2, }), ], }), new TableRow({ children: [ new TableCell({ children: [], }), new TableCell({ children: [], }), ], }), ], float: { horizontalAnchor: TableAnchorType.MARGIN, verticalAnchor: TableAnchorType.MARGIN, relativeHorizontalPosition: RelativeHorizontalPosition.RIGHT, relativeVerticalPosition: RelativeVerticalPosition.BOTTOM, overlap: OverlapType.NEVER, leftFromText: 1000, rightFromText: 2000, topFromText: 1500, bottomFromText: 30, }, width: { size: 4535, type: WidthType.DXA, }, layout: TableLayoutType.FIXED, }); doc.addSection({ children: [table], }); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); });
Add spacing to table float
Add spacing to table float
TypeScript
mit
dolanmiu/docx,dolanmiu/docx,dolanmiu/docx
--- +++ @@ -45,6 +45,10 @@ relativeHorizontalPosition: RelativeHorizontalPosition.RIGHT, relativeVerticalPosition: RelativeVerticalPosition.BOTTOM, overlap: OverlapType.NEVER, + leftFromText: 1000, + rightFromText: 2000, + topFromText: 1500, + bottomFromText: 30, }, width: { size: 4535,
643aba1de85163b6dea972a9dc5324d8dc2065ef
src/renderer/views/Settings/Settings.tsx
src/renderer/views/Settings/Settings.tsx
import React from 'react'; import { Outlet, useMatch } from 'react-router'; import { Navigate } from 'react-router-dom'; import * as Nav from '../../elements/Nav/Nav'; import appStyles from '../../App.module.css'; import styles from './Settings.module.css'; const Settings: React.FC = () => { const match = useMatch('/settings'); if (match) { return <Navigate to='/settings/library' />; } return ( <div className={`${appStyles.view} ${styles.viewSettings}`}> <div className={styles.settings__nav}> <Nav.Wrap vertical> <Nav.Link to='/settings/library'>Library</Nav.Link> <Nav.Link to='/settings/audio'>Audio</Nav.Link> <Nav.Link to='/settings/interface'>Interface</Nav.Link> <Nav.Link to='/settings/about'>About</Nav.Link> </Nav.Wrap> </div> <div className={styles.settings__content}> <Outlet /> </div> </div> ); }; export default Settings;
import React from 'react'; import { Outlet, useMatch } from 'react-router'; import { Navigate } from 'react-router-dom'; import * as Nav from '../../elements/Nav/Nav'; import appStyles from '../../App.module.css'; import styles from './Settings.module.css'; const Settings: React.FC = () => { const match = useMatch('/settings'); return ( <div className={`${appStyles.view} ${styles.viewSettings}`}> <div className={styles.settings__nav}> <Nav.Wrap vertical> <Nav.Link to='/settings/library'>Library</Nav.Link> <Nav.Link to='/settings/audio'>Audio</Nav.Link> <Nav.Link to='/settings/interface'>Interface</Nav.Link> <Nav.Link to='/settings/about'>About</Nav.Link> </Nav.Wrap> </div> <div className={styles.settings__content}> <Outlet /> </div> {match && <Navigate to='/settings/library' />} </div> ); }; export default Settings;
Fix white flash when navigating to /settings
Fix white flash when navigating to /settings
TypeScript
mit
KeitIG/museeks,KeitIG/museeks,KeitIG/museeks
--- +++ @@ -9,10 +9,6 @@ const Settings: React.FC = () => { const match = useMatch('/settings'); - - if (match) { - return <Navigate to='/settings/library' />; - } return ( <div className={`${appStyles.view} ${styles.viewSettings}`}> @@ -28,6 +24,8 @@ <div className={styles.settings__content}> <Outlet /> </div> + + {match && <Navigate to='/settings/library' />} </div> ); };
edd335779abe9385b8e3167e2331f6ac1512418c
packages/gitgraph-core/src/graph-columns.ts
packages/gitgraph-core/src/graph-columns.ts
import Branch from "./branch"; import Commit from "./commit"; export class GraphColumns<TNode> { private columns: Array<Branch["name"]> = []; /** * Compute the graph columns from commits. * * @param commits List of graph commits */ public constructor(commits: Array<Commit<TNode>>) { this.columns = []; commits.forEach((commit) => { const branch = commit.branchToDisplay; if (!this.columns.includes(branch)) this.columns.push(branch); }); } /** * Return the column index corresponding to given branch name. * * @param branchName Name of the branch */ public get(branchName: Branch["name"]): number { return this.columns.findIndex((col) => col === branchName); } }
import Branch from "./branch"; import Commit from "./commit"; export class GraphColumns<TNode> { private branches: Set<Branch["name"]> = new Set(); public constructor(commits: Array<Commit<TNode>>) { commits.forEach((commit) => this.branches.add(commit.branchToDisplay)); } /** * Return the column index corresponding to given branch name. * * @param branchName Name of the branch */ public get(branchName: Branch["name"]): number { return Array.from(this.branches).findIndex( (branch) => branch === branchName, ); } }
Refactor GraphColumns to use a Set()
Refactor GraphColumns to use a Set()
TypeScript
mit
nicoespeon/gitgraph.js,nicoespeon/gitgraph.js,nicoespeon/gitgraph.js,nicoespeon/gitgraph.js
--- +++ @@ -2,19 +2,10 @@ import Commit from "./commit"; export class GraphColumns<TNode> { - private columns: Array<Branch["name"]> = []; + private branches: Set<Branch["name"]> = new Set(); - /** - * Compute the graph columns from commits. - * - * @param commits List of graph commits - */ public constructor(commits: Array<Commit<TNode>>) { - this.columns = []; - commits.forEach((commit) => { - const branch = commit.branchToDisplay; - if (!this.columns.includes(branch)) this.columns.push(branch); - }); + commits.forEach((commit) => this.branches.add(commit.branchToDisplay)); } /** @@ -23,6 +14,8 @@ * @param branchName Name of the branch */ public get(branchName: Branch["name"]): number { - return this.columns.findIndex((col) => col === branchName); + return Array.from(this.branches).findIndex( + (branch) => branch === branchName, + ); } }
461a04d23655a026d303566e831c9cebe1f36cd3
src/cssUtils.ts
src/cssUtils.ts
import { Stylesheet, Rule, Media } from 'css'; import { flatten } from './arrayUtils'; export function findRootRules(cssAST: Stylesheet): Rule[] { return cssAST.stylesheet.rules.filter(node => (<Rule>node).type === 'rule'); } export function findMediaRules(cssAST: Stylesheet): Rule[] { let mediaNodes = <Rule[]>(cssAST.stylesheet.rules.filter(node => { return (<Rule>node).type === 'media'; })); if (mediaNodes.length > 0) { return flatten(mediaNodes.map(node => (<Media>node).rules)); } else { return []; } } export function findClassName(selector: string): string { let classNameStartIndex = selector.lastIndexOf('.'); if (classNameStartIndex >= 0) { let classText = selector.substr(classNameStartIndex + 1); // Search for one of ' ', '[', ':' or '>' let classNameEndIndex = classText.search(/[\s\[:>]/); if (classNameEndIndex >= 0) { return classText.substr(0, classNameEndIndex); } else { return classText; } } else { return ""; } } export function sanitizeClassName(className: string): string { return className.replace(/\\[!"#$%&'()*+,\-./:;<=>?@[\\\]^`{|}~]/, (substr, ...args) => { if (args.length === 2) { return substr.slice(1); } else { return substr; } }); }
import { Stylesheet, Rule, Media } from 'css'; import { flatten } from './arrayUtils'; export function findRootRules(cssAST: Stylesheet): Rule[] { return cssAST.stylesheet.rules.filter(node => (<Rule>node).type === 'rule'); } export function findMediaRules(cssAST: Stylesheet): Rule[] { let mediaNodes = <Rule[]>(cssAST.stylesheet.rules.filter(node => { return (<Rule>node).type === 'media'; })); if (mediaNodes.length > 0) { return flatten(mediaNodes.map(node => (<Media>node).rules)); } else { return []; } } export function findClassName(selector: string): string { let classNameStartIndex = selector.lastIndexOf('.'); if (classNameStartIndex >= 0) { let classText = selector.substr(classNameStartIndex + 1); // Search for one of ' ', '[', ':' or '>', that isn't escaped with a backslash let classNameEndIndex = classText.search(/[^\\][\s\[:>]/); if (classNameEndIndex >= 0) { return classText.substr(0, classNameEndIndex + 1); } else { return classText; } } else { return ""; } } export function sanitizeClassName(className: string): string { return className.replace(/\\[!"#$%&'()*+,\-./:;<=>?@[\\\]^`{|}~]/, (substr, ...args) => { if (args.length === 2) { return substr.slice(1); } else { return substr; } }); }
Allow class name stop characters to be escaped.
Allow class name stop characters to be escaped.
TypeScript
mit
andersea/HTMLClassSuggestionsVSCode
--- +++ @@ -20,10 +20,10 @@ let classNameStartIndex = selector.lastIndexOf('.'); if (classNameStartIndex >= 0) { let classText = selector.substr(classNameStartIndex + 1); - // Search for one of ' ', '[', ':' or '>' - let classNameEndIndex = classText.search(/[\s\[:>]/); + // Search for one of ' ', '[', ':' or '>', that isn't escaped with a backslash + let classNameEndIndex = classText.search(/[^\\][\s\[:>]/); if (classNameEndIndex >= 0) { - return classText.substr(0, classNameEndIndex); + return classText.substr(0, classNameEndIndex + 1); } else { return classText; }
ec47a071951ced53ebdaa214eda19067866d5946
src/app/shared/services/clusters-service.ts
src/app/shared/services/clusters-service.ts
import * as models from '../models'; import requests from './requests'; export class ClustersService { public list(): Promise<models.Cluster[]> { return requests.get('/clusters').then((res) => res.body as models.ClusterList).then(((list) => list.items)); } }
import * as models from '../models'; import requests from './requests'; export class ClustersService { public list(): Promise<models.Cluster[]> { return requests.get('/clusters').then((res) => res.body as models.ClusterList).then(((list) => list.items || [])); } }
Fix npe error in app wizard
Fix npe error in app wizard
TypeScript
apache-2.0
argoproj/argo-cd,argoproj/argo-cd,argoproj/argo-cd,argoproj/argo-cd,argoproj/argo-cd
--- +++ @@ -3,6 +3,6 @@ export class ClustersService { public list(): Promise<models.Cluster[]> { - return requests.get('/clusters').then((res) => res.body as models.ClusterList).then(((list) => list.items)); + return requests.get('/clusters').then((res) => res.body as models.ClusterList).then(((list) => list.items || [])); } }
2076c9400c7d2b327b87a4f47e9593832acf2236
src/components/gifPicker/singleGif.tsx
src/components/gifPicker/singleGif.tsx
import React, {FC} from 'react'; import {Handler} from '../../helpers/typeHelpers'; export interface GifItemProps { previewUrl: string; onClick: Handler; } export const BTDGifItem: FC<GifItemProps> = (props) => { return ( <div className="btd-giphy-block-wrapper" onClick={props.onClick} style={{height: 100, width: 100, display: 'inline-block'}}> <img src={props.previewUrl} className="btd-giphy-block" style={{ objectFit: 'cover', height: '100%', width: '100%', }} /> </div> ); };
import React, {FC} from 'react'; import {Handler} from '../../helpers/typeHelpers'; export interface GifItemProps { previewUrl: string; onClick: Handler; } export const BTDGifItem: FC<GifItemProps> = (props) => { return ( <div className="btd-giphy-block-wrapper" onClick={props.onClick} style={{height: 100, width: `calc(100% / 3)`, display: 'inline-block'}}> <img src={props.previewUrl} className="btd-giphy-block" style={{ objectFit: 'cover', height: '100%', width: '100%', }} /> </div> ); };
Fix gif picker with scrollbar
Fix gif picker with scrollbar
TypeScript
mit
eramdam/BetterTweetDeck,eramdam/BetterTweetDeck,eramdam/BetterTweetDeck,eramdam/BetterTweetDeck
--- +++ @@ -11,7 +11,7 @@ <div className="btd-giphy-block-wrapper" onClick={props.onClick} - style={{height: 100, width: 100, display: 'inline-block'}}> + style={{height: 100, width: `calc(100% / 3)`, display: 'inline-block'}}> <img src={props.previewUrl} className="btd-giphy-block"
a2ebea044c8a2b4041e79102d32a8f2cce633b9c
src/RansomTableWidget.ts
src/RansomTableWidget.ts
import {Table} from "./Table"; /** * TODO: Replace all console.error calls with exceptions * TODO: Provide rudimentary column and row manipulation methods * TODO: Provide rudimentary cell styling possibility * TODO: Provide cell edit feature * TODO: Implement paging * */ declare const $: any; (function ($) { $.widget("ransomware.table", { table: undefined, /** * Default options section * */ options: {}, _create: function () { this.table = new Table({ header: this.options.header, footer: this.options.footer, body: this.options.body }); this._setup(); }, render: function (initialize: boolean) { let table: Table = this.table; if (table) { table.render(this.element, initialize); } return this; }, load: null, /* * Zero indexed ! * */ getCell: null, getColumn: null, getRow: null, /** * Private methods * **/ addRow: null, addColumn: null, remove: null, clear: null, hide: null, _setup: function () { this.load = this.table.load; this.getCell = this.table.getCell; this.getColumn = this.table.getColumn; this.getRow = this.table.getRow; this.remove = this.table.remove; this.clear = this.table.clear; this.hide = this.table.hide; } }) ; }($));
import {Table} from "./Table"; /** * TODO: Replace all console.error calls with exceptions * TODO: Provide rudimentary column and row manipulation methods * TODO: Provide rudimentary cell styling possibility * TODO: Provide cell edit feature * TODO: Implement paging * */ import "jquery"; (function ($) { $.widget("ransomware.table", { table: undefined, /** * Default options section * */ options: {}, _create: function () { this.table = new Table(this.options); this._setup(); }, render: function (initialize: boolean) { let table: Table = this.table; if (table) { table.render(this.element, initialize); } return this; }, load: null, /* * Zero indexed ! * */ getCell: null, getColumn: null, getRow: null, /** * Private methods * **/ addRow: null, addColumn: null, remove: null, clear: null, hide: null, _setup: function () { this.load = this.table.load; this.getCell = this.table.getCell; this.getColumn = this.table.getColumn; this.getRow = this.table.getRow; this.remove = this.table.remove; this.clear = this.table.clear; this.hide = this.table.hide; } }) ; }($));
Add passing all options to Table class
Add passing all options to Table class
TypeScript
mit
mwheregroup/RansomTable,mwheregroup/RansomTable,mwheregroup/RansomTable
--- +++ @@ -6,7 +6,7 @@ * TODO: Provide cell edit feature * TODO: Implement paging * */ -declare const $: any; +import "jquery"; (function ($) { $.widget("ransomware.table", { @@ -19,17 +19,12 @@ options: {}, _create: function () { - this.table = new Table({ - header: this.options.header, - footer: this.options.footer, - body: this.options.body - }); - + this.table = new Table(this.options); this._setup(); }, render: function (initialize: boolean) { - let table: Table = this.table; + let table: Table = this.table; if (table) { table.render(this.element, initialize); }
e4b0e9a06931562b37debd65a7d0bab23db87a46
app/vue/src/server/framework-preset-vue.ts
app/vue/src/server/framework-preset-vue.ts
/* eslint-disable no-param-reassign */ import VueLoaderPlugin from 'vue-loader/lib/plugin'; import type { Configuration } from 'webpack'; export function webpack(config: Configuration) { config.plugins.push(new VueLoaderPlugin()); config.module.rules.push({ test: /\.vue$/, loader: require.resolve('vue-loader'), options: {}, }); config.module.rules.push({ test: /\.tsx?$/, use: [ { loader: require.resolve('ts-loader'), options: { transpileOnly: true, appendTsSuffixTo: [/\.vue$/], }, }, ], }); config.resolve.extensions.push('.vue'); config.resolve.alias = { ...config.resolve.alias, vue$: require.resolve('vue/dist/vue.esm.js') }; return config; }
/* eslint-disable no-param-reassign */ import VueLoaderPlugin from 'vue-loader/lib/plugin'; import type { Configuration } from 'webpack'; import type { Options, TypescriptConfig } from '@storybook/core-common'; export async function webpack(config: Configuration, { presets }: Options) { const typescriptOptions = await presets.apply<TypescriptConfig>('typescript', {} as any); config.plugins.push(new VueLoaderPlugin()); config.module.rules.push({ test: /\.vue$/, loader: require.resolve('vue-loader'), options: {}, }); config.module.rules.push({ test: /\.tsx?$/, use: [ { loader: require.resolve('ts-loader'), options: { transpileOnly: !typescriptOptions.check, appendTsSuffixTo: [/\.vue$/], }, }, ], }); config.resolve.extensions.push('.vue'); config.resolve.alias = { ...config.resolve.alias, vue$: require.resolve('vue/dist/vue.esm.js') }; return config; }
Check types when `typescript.check` is true
fix(vue): Check types when `typescript.check` is true https://github.com/storybookjs/storybook/issues/14987 TypeScript checks in `@storybook/vue` has not been enabled. This commit enables users to turn on type checking process powered by ts-loader. From performance perspective, fork-ts-checker-webpack-plugin is better especially for large projects. However, it needs one of 1) modifying type-checker options in each builders or 2) adding fork-ts-checker-webpack-plugin as a dependency of `@storybook/vue`. I think both comes with huge downsides and it should be done in user side by setting `typescript.check: false` and configuring the plugin manually.
TypeScript
mit
storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -2,7 +2,11 @@ import VueLoaderPlugin from 'vue-loader/lib/plugin'; import type { Configuration } from 'webpack'; -export function webpack(config: Configuration) { +import type { Options, TypescriptConfig } from '@storybook/core-common'; + +export async function webpack(config: Configuration, { presets }: Options) { + const typescriptOptions = await presets.apply<TypescriptConfig>('typescript', {} as any); + config.plugins.push(new VueLoaderPlugin()); config.module.rules.push({ test: /\.vue$/, @@ -15,7 +19,7 @@ { loader: require.resolve('ts-loader'), options: { - transpileOnly: true, + transpileOnly: !typescriptOptions.check, appendTsSuffixTo: [/\.vue$/], }, },
da8e02d9055f66471ce7ea30e819d6bae9f9d4aa
block-layout/examples/loadingAnimation.ts
block-layout/examples/loadingAnimation.ts
var circle; var continueAnimating : boolean; var animationProgress : number; function startLoadingAnimation() { var svg = <HTMLElement> document.querySelector('svg'); var svgNS = svg.namespaceURI; circle = document.createElementNS(svgNS,'circle'); circle.setAttribute('cx','320'); circle.setAttribute('cy','240'); circle.setAttribute('r','16'); circle.setAttribute('fill','#95B3D7'); svg.appendChild(circle); continueAnimating = true; animationProgress = 0; setTimeout(function() { loadingAnimationTick(); }, 40); } function loadingAnimationTick() { animationProgress += 1; console.log("Loading animation"); circle.setAttribute('cx', 320+64*Math.cos(animationProgress / 25 * Math.PI)); circle.setAttribute('cy', 240+64*Math.sin(animationProgress / 25 * Math.PI)); if(continueAnimating) { setTimeout(function() {loadingAnimationTick();}, 40); } } function stopLoadingAnimation() { continueAnimating = false; }
var circle; var circle2; var continueAnimating : boolean; var animationProgress : number; function makeCircle(document, svgNS) { var circle = document.createElementNS(svgNS,'circle'); circle.setAttribute('cx','320'); circle.setAttribute('cy','240'); circle.setAttribute('r','16'); circle.setAttribute('fill','#95B3D7'); return circle; } function startLoadingAnimation() { var svg = <HTMLElement> document.querySelector('svg'); circle = makeCircle(document, svg.namespaceURI); svg.appendChild(circle); circle2 = makeCircle(document, svg.namespaceURI); svg.appendChild(circle2); continueAnimating = true; animationProgress = 0; setTimeout(function() { loadingAnimationTick(); }, 40); } function loadingAnimationTick() { animationProgress += 1; console.log("Loading animation"); circle.setAttribute('cx', 320+64*Math.cos(animationProgress / 25 * Math.PI)); circle.setAttribute('cy', 240+64*Math.sin(animationProgress / 25 * Math.PI)); circle2.setAttribute('cx', 320-64*Math.cos(animationProgress / 25 * Math.PI)); circle2.setAttribute('cy', 240-64*Math.sin(animationProgress / 25 * Math.PI)); if(continueAnimating) { setTimeout(function() {loadingAnimationTick();}, 40); } } function stopLoadingAnimation() { continueAnimating = false; }
Add a second circle to the loading animation
Add a second circle to the loading animation
TypeScript
apache-2.0
CodethinkLabs/software-dependency-visualizer,CodethinkLabs/software-dependency-visualizer,CodethinkLabs/software-dependency-visualizer,CodethinkLabs/software-dependency-visualizer
--- +++ @@ -1,17 +1,25 @@ var circle; +var circle2; var continueAnimating : boolean; var animationProgress : number; + +function makeCircle(document, svgNS) +{ + var circle = document.createElementNS(svgNS,'circle'); + circle.setAttribute('cx','320'); + circle.setAttribute('cy','240'); + circle.setAttribute('r','16'); + circle.setAttribute('fill','#95B3D7'); + return circle; +} function startLoadingAnimation() { var svg = <HTMLElement> document.querySelector('svg'); - var svgNS = svg.namespaceURI; - circle = document.createElementNS(svgNS,'circle'); - circle.setAttribute('cx','320'); - circle.setAttribute('cy','240'); - circle.setAttribute('r','16'); - circle.setAttribute('fill','#95B3D7'); + circle = makeCircle(document, svg.namespaceURI); svg.appendChild(circle); + circle2 = makeCircle(document, svg.namespaceURI); + svg.appendChild(circle2); continueAnimating = true; animationProgress = 0; setTimeout(function() { loadingAnimationTick(); }, 40); @@ -23,6 +31,8 @@ console.log("Loading animation"); circle.setAttribute('cx', 320+64*Math.cos(animationProgress / 25 * Math.PI)); circle.setAttribute('cy', 240+64*Math.sin(animationProgress / 25 * Math.PI)); + circle2.setAttribute('cx', 320-64*Math.cos(animationProgress / 25 * Math.PI)); + circle2.setAttribute('cy', 240-64*Math.sin(animationProgress / 25 * Math.PI)); if(continueAnimating) { setTimeout(function() {loadingAnimationTick();}, 40); }
6fc328d9b709eb298c6d529ac31ced4acda09d96
src/lib/components/container/template.tsx
src/lib/components/container/template.tsx
import * as React from 'react' import {Provider} from 'react-redux' import {Store} from 'redux' const {AppContainer} = require('react-hot-loader') /** Container component properties */ interface Props { /** Redux store instance */ store: Store<any> // tslint:disable-line:no-any /** Component to render */ component: any // tslint:disable-line:no-any } /** * Render container component adding possible dev tools and redux store * @param props Component properties * @return Container component */ export default function Container({store, component: Component}: Props) { return ( <AppContainer> <Provider store={store}> <Component /> </Provider> </AppContainer> ) }
import * as React from 'react' import {Provider} from 'react-redux' import {Store} from 'redux' const {AppContainer} = require('react-hot-loader') /** Container component properties */ interface Props<P> { /** Redux store instance */ store: Store<any> // ts-lint:disable-line:no-any /** Component to render */ component: React.ComponentClass<P> | (() => React.ReactElement<P>) } /** * Render container component adding possible dev tools and redux store * @param props Component properties * @return Container component */ export default function Container<P>({store, component: Component}: Props<P>) { return ( <AppContainer> <Provider store={store}> <Component /> </Provider> </AppContainer> ) }
Reduce use of any further
Reduce use of any further
TypeScript
mit
jupl/astraea,jupl/astraea
--- +++ @@ -4,12 +4,12 @@ const {AppContainer} = require('react-hot-loader') /** Container component properties */ -interface Props { +interface Props<P> { /** Redux store instance */ - store: Store<any> // tslint:disable-line:no-any + store: Store<any> // ts-lint:disable-line:no-any /** Component to render */ - component: any // tslint:disable-line:no-any + component: React.ComponentClass<P> | (() => React.ReactElement<P>) } /** @@ -17,7 +17,7 @@ * @param props Component properties * @return Container component */ -export default function Container({store, component: Component}: Props) { +export default function Container<P>({store, component: Component}: Props<P>) { return ( <AppContainer> <Provider store={store}>
69eb96048480e2e0044e9dfa67e8d065af0166cb
src/symbols.ts
src/symbols.ts
// This is currently a string because a Symbol seems to have become broken in // VS Code. We can revert this if it gets fixed. // https://github.com/Microsoft/vscode/issues/57513 export const internalApiSymbol = "private-API"; // Symbol();
export const internalApiSymbol = Symbol();
Switch back to using a symbol
Switch back to using a symbol I believe thie issue is because of https://github.com/Microsoft/vscode/issues/58388 and the previous workaround should fix this.
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -1,4 +1 @@ -// This is currently a string because a Symbol seems to have become broken in -// VS Code. We can revert this if it gets fixed. -// https://github.com/Microsoft/vscode/issues/57513 -export const internalApiSymbol = "private-API"; // Symbol(); +export const internalApiSymbol = Symbol();
33b3a5679b46597dc78653fc428e543ec9359ffa
src/Styleguide/Artwork/Banner.tsx
src/Styleguide/Artwork/Banner.tsx
import React from "react" import styled from "styled-components" import { Col, Row } from "../Elements/Grid" const Flex = styled.div` display: flex; flex-direction: row; ` const RoundedImage = styled.img` width: ${props => props.size}; height: ${props => props.size}; border-radius: ${props => props.size}; ` export class Banner extends React.Component { render() { return ( <Row> <Col sm={8}> <Flex> <RoundedImage size="110px" src="https://picsum.photos/110/110/?random" /> <div> <div>In show</div> <div>Francesca DiMattio: Boucherouite</div> <div>Salon 94</div> </div> </Flex> </Col> </Row> ) } }
import React from "react" import styled from "styled-components" import { Col, Row } from "../Elements/Grid" const Flex = styled.div` display: flex; flex-direction: row; ` interface RoundedImageProps { size: string } const RoundedImage = styled.img.attrs<RoundedImageProps>({})` width: ${(props: RoundedImageProps) => props.size}; height: ${props => props.size}; border-radius: ${props => props.size}; ` export class Banner extends React.Component { render() { return ( <Row> <Col sm={8}> <Flex> <RoundedImage size="110px" src="https://picsum.photos/110/110/?random" /> <div> <div>In show</div> <div>Francesca DiMattio: Boucherouite</div> <div>Salon 94</div> </div> </Flex> </Col> </Row> ) } }
Update types for RoundedImage component
Update types for RoundedImage component
TypeScript
mit
artsy/reaction,xtina-starr/reaction,artsy/reaction,xtina-starr/reaction,artsy/reaction-force,xtina-starr/reaction,xtina-starr/reaction,artsy/reaction-force,artsy/reaction
--- +++ @@ -7,8 +7,12 @@ flex-direction: row; ` -const RoundedImage = styled.img` - width: ${props => props.size}; +interface RoundedImageProps { + size: string +} + +const RoundedImage = styled.img.attrs<RoundedImageProps>({})` + width: ${(props: RoundedImageProps) => props.size}; height: ${props => props.size}; border-radius: ${props => props.size}; `
2376b245dcc6fd44d23f655a46c72c7a9fc51aff
src/scripts/import_languages.ts
src/scripts/import_languages.ts
import Language from '../models/language'; import Version from '../models/version'; import * as mongoose from 'mongoose'; import { log } from '../helpers/logger'; import { readFileSync } from 'fs'; const connect = () => { mongoose.connect('mongodb://localhost:27017/db', { useNewUrlParser: true, useUnifiedTopology: true }).then(() => { return log('info', 0, 'connected to db'); }).catch((err) => { log('err', 0, `error connecting to database: ${err}`); return process.exit(1); }); }; connect(); mongoose.connection.on('disconnected', connect); const importLanguages = () => { const _default = JSON.parse(readFileSync(`${__dirname}/../../../i18n/default/default.json`, 'utf-8')); const def = new Language({ name: 'Default', objectName: 'default', rawObject: _default, defaultVersion: Version.find({ abbv: 'RSV' }).exec() }); def.save((err, language) => { if (err) { log('err', 0, `unable to save ${def['name']}`); log('err', 0, err); } else { log('info', 0, `saved ${language.name}`); } }); }; importLanguages();
import Language from '../models/language'; import Version from '../models/version'; import * as mongoose from 'mongoose'; import { log } from '../helpers/logger'; import { readFileSync } from 'fs'; const connect = () => { mongoose.connect('mongodb://localhost:27017/db', { useNewUrlParser: true, useUnifiedTopology: true }).then(() => { return log('info', 0, 'connected to db'); }).catch((err) => { log('err', 0, `error connecting to database: ${err}`); return process.exit(1); }); }; connect(); mongoose.connection.on('disconnected', connect); const defaultVersion = 'RSV'; const importLanguages = () => { const _default = JSON.parse(readFileSync(`${__dirname}/../../../i18n/default/default.json`, 'utf-8')); const def = new Language({ name: 'Default', objectName: 'default', rawObject: _default, defaultVersion }); def.save((err, language) => { if (err) { log('err', 0, `unable to save ${def['name']}`); log('err', 0, err); } else { log('info', 0, `saved ${language.name}`); } }); }; importLanguages();
Use version abbrevation for a language's default version.
Use version abbrevation for a language's default version.
TypeScript
mpl-2.0
BibleBot/BibleBot,BibleBot/BibleBot,BibleBot/BibleBot
--- +++ @@ -19,6 +19,8 @@ connect(); mongoose.connection.on('disconnected', connect); +const defaultVersion = 'RSV'; + const importLanguages = () => { const _default = JSON.parse(readFileSync(`${__dirname}/../../../i18n/default/default.json`, 'utf-8')); @@ -26,7 +28,7 @@ name: 'Default', objectName: 'default', rawObject: _default, - defaultVersion: Version.find({ abbv: 'RSV' }).exec() + defaultVersion }); def.save((err, language) => {
666dfee82f3e4f7c3ce922a1dc10740399ffcfc6
src/main.browser.ts
src/main.browser.ts
import { bootstrap } from '@angular/platform-browser-dynamic'; import { provideStore } from '@ngrx/store'; import { DIRECTIVES, PIPES, PROVIDERS } from './platform/browser'; import { ENV_PROVIDERS } from './platform/environment'; import { App, APP_PROVIDERS } from './app'; import { CURRENT_ASSIGNMENT_REDUCER } from './app/shared/reducers'; export function main(initialHmrState?: any): Promise<any> { return bootstrap(App, [ ...PROVIDERS, ...ENV_PROVIDERS, ...DIRECTIVES, ...PIPES, ...APP_PROVIDERS, provideStore([ CURRENT_ASSIGNMENT_REDUCER ]) ]) .catch(err => console.error(err)); } /* * Vendors * For vendors for example jQuery, Lodash, angular2-jwt just import them anywhere in your app * You can also import them in vendors to ensure that they are bundled in one file * Also see custom-typings.d.ts as you also need to do `typings install x` where `x` is your module */ /* * Hot Module Reload * experimental version by @gdi2290 */ if ('development' === ENV && HMR === true) { // activate hot module reload let ngHmr = require('angular2-hmr'); ngHmr.hotModuleReplacement(main, module); } else { // bootstrap when document is ready document.addEventListener('DOMContentLoaded', () => main()); }
import { bootstrap } from '@angular/platform-browser-dynamic'; import { provideStore } from '@ngrx/store'; import { DIRECTIVES, PIPES, PROVIDERS } from './platform/browser'; import { ENV_PROVIDERS } from './platform/environment'; import { App, APP_PROVIDERS } from './app'; import { CURRENT_ASSIGNMENT_REDUCER } from './app/shared/reducers'; export function main(initialHmrState?: any): Promise<any> { return bootstrap(App, [ ...PROVIDERS, ...ENV_PROVIDERS, ...DIRECTIVES, ...PIPES, ...APP_PROVIDERS, provideStore(CURRENT_ASSIGNMENT_REDUCER) ]) .catch(err => console.error(err)); } /* * Vendors * For vendors for example jQuery, Lodash, angular2-jwt just import them anywhere in your app * You can also import them in vendors to ensure that they are bundled in one file * Also see custom-typings.d.ts as you also need to do `typings install x` where `x` is your module */ /* * Hot Module Reload * experimental version by @gdi2290 */ if ('development' === ENV && HMR === true) { // activate hot module reload let ngHmr = require('angular2-hmr'); ngHmr.hotModuleReplacement(main, module); } else { // bootstrap when document is ready document.addEventListener('DOMContentLoaded', () => main()); }
Fix provider of current assignment reducer to store
feature(assignment-list): Fix provider of current assignment reducer to store
TypeScript
mit
bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder
--- +++ @@ -14,9 +14,7 @@ ...DIRECTIVES, ...PIPES, ...APP_PROVIDERS, - provideStore([ - CURRENT_ASSIGNMENT_REDUCER - ]) + provideStore(CURRENT_ASSIGNMENT_REDUCER) ]) .catch(err => console.error(err));
a993c543b850d980e874ff0d60f978781df50dc4
src/index.ts
src/index.ts
/* * @license * Copyright Hôpitaux Universitaires de Genève. All Rights Reserved. * * Use of this source code is governed by an Apache-2.0 license that can be * found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE */ export * from './common/index'; export * from './component/index';
/* * @license * Copyright Hôpitaux Universitaires de Genève. All Rights Reserved. * * Use of this source code is governed by an Apache-2.0 license that can be * found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE */ export * from './common/index'; export * from './component/index'; if (!document.doctype) { console.warn('[DejaJS] Current document does not have a doctype. This may cause some components not to behave as expected.'); }
Add warning if doctype is not set
feat(Global): Add warning if doctype is not set
TypeScript
apache-2.0
DSI-HUG/dejajs-components,DSI-HUG/dejajs-components,DSI-HUG/dejajs-components,DSI-HUG/dejajs-components
--- +++ @@ -8,3 +8,7 @@ export * from './common/index'; export * from './component/index'; + +if (!document.doctype) { + console.warn('[DejaJS] Current document does not have a doctype. This may cause some components not to behave as expected.'); +}
8169c56fe1c67c3c004f2cce35761cb799347c11
client/app/user-menu-item.component.ts
client/app/user-menu-item.component.ts
import {Component} from 'angular2/core' import {UserService} from './user.service' @Component({ selector: 'user-menu-item', inputs: ['user'], template: ` <div class="vertically fitted item" *ngIf="user"> Hello, {{user.username}}! </div> <a class="vertically fitted icon item" (click)="logout()" *ngIf="user" title="Sign out"> <i class="sign out icon"></i> </a> `, providers: [UserService] }) export class UserMenuItemComponent { public user:{username: string}; constructor(private _users:UserService) { } logout() { this._users.logout(); } }
import {Component} from 'angular2/core' import {UserService} from './user.service' @Component({ selector: 'user-menu-item', inputs: ['user'], template: ` <div class="vertically fitted item" *ngIf="user"> Hello, {{user.username}}! </div> <a class="vertically fitted icon item" (click)="logout()" *ngIf="user" title="Sign out"> <i class="sign out icon"></i> </a> `, providers: [UserService] }) export class UserMenuItemComponent { public user:{username: string}; constructor(private _users:UserService) { } logout() { this._users.logout().subscribe(() => location.href = '/'); } }
Make logout work correctly (the lazy way).
Make logout work correctly (the lazy way).
TypeScript
mit
leMaik/EduCraft-Editor,leMaik/EduCraft-Editor,leMaik/EduCraft-Editor,leMaik/EduCraft-Editor
--- +++ @@ -22,6 +22,6 @@ } logout() { - this._users.logout(); + this._users.logout().subscribe(() => location.href = '/'); } }
2cab77735574bbd10e790eec16fbb7be3ae8b9e0
ts/app.ts
ts/app.ts
"use strict"; import * as http from "http"; import * as express from "express"; const app = express(); app.use(express.static("public")); app.get("/", (req, res) => { res.send("Hello Boss!"); }); const server = app.listen(8888, () =>{ const port = server.address().port; console.log(`Boss is listening at port: ${port}`); });
"use strict"; import * as express from "express"; const app = express(); app.use(express.static("public")); const server = app.listen(process.env.PORT || 1337, () =>{ console.log(`Boss is listening at port: ${server.address().port}`); });
Read port number from environment variable
Read port number from environment variable Azure passes in the port number through the PORT environment variable. This is the port number the Azure load balancer forwards traffic to. I.e. Browser -------> LB (port 80) ---------> Node.js (PORT EV) If the EV is not specified we default to 1337. See https://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/
TypeScript
mit
navi2601/bosstalk,navi2601/bosstalk,navi2601/bosstalk
--- +++ @@ -1,19 +1,9 @@ "use strict"; - -import * as http from "http"; import * as express from "express"; const app = express(); - app.use(express.static("public")); -app.get("/", (req, res) => { - res.send("Hello Boss!"); +const server = app.listen(process.env.PORT || 1337, () =>{ + console.log(`Boss is listening at port: ${server.address().port}`); }); - -const server = app.listen(8888, () =>{ - const port = server.address().port; - - console.log(`Boss is listening at port: ${port}`); - -});
29785b7398abe2763857ff151d36267f4b3a2952
src/app/shared/reducers/teacher.reducer.ts
src/app/shared/reducers/teacher.reducer.ts
import { ActionReducer } from '@ngrx/store'; import { Teacher } from '../models'; export const TEACHER = 'TEACHER'; export const SET_TEACHER = 'SET_TEACHER'; let initialState = new Teacher.Builder().build(); export const teacherReducer: ActionReducer<Teacher> = (state = initialState, {type, payload}) => { switch (type) { case SET_TEACHER: return payload; default: return state; } };
import { ActionReducer } from '@ngrx/store'; import { Teacher } from '../models'; export const TEACHER = 'TEACHER'; export const SET_TEACHER = 'SET_TEACHER'; let initialState = new Teacher.Builder() .withId('1') .withClasses(['AM', 'PM']) .build(); export const teacherReducer: ActionReducer<Teacher> = (state = initialState, {type, payload}) => { switch (type) { case SET_TEACHER: return payload; default: return state; } };
Add more attributes to initial teacher state
Add more attributes to initial teacher state
TypeScript
mit
bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder
--- +++ @@ -6,7 +6,10 @@ export const SET_TEACHER = 'SET_TEACHER'; -let initialState = new Teacher.Builder().build(); +let initialState = new Teacher.Builder() + .withId('1') + .withClasses(['AM', 'PM']) + .build(); export const teacherReducer: ActionReducer<Teacher> = (state = initialState, {type, payload}) => { switch (type) {
ac675e5c047668d128272f8b39c6029b42579862
nojoin/index.ts
nojoin/index.ts
// Automatically removes join/leave messages in sandbox import {WebClient, RTMClient} from '@slack/client'; interface SlackInterface { rtmClient: RTMClient, webClient: WebClient, } export default async ({rtmClient: rtm, webClient: slack}: SlackInterface) => { rtm.on('message', async (message) => { if (message.channel === process.env.CHANNEL_SANDBOX) { if (message.subtype === 'channel_join' || message.subtype === 'channel_leave') { await slack.chat.delete({ token: process.env.HAKATASHI_TOKEN, channel: message.channel, ts: message.ts, }); } } }); };
import {SlackInterface} from '../lib/slack'; export default async ({rtmClient: rtm, webClient: slack}: SlackInterface) => { rtm.on('message', async (message: any) => { if (message.subtype === 'channel_join' || message.subtype === 'channel_leave') { await slack.chat.delete({ token: process.env.HAKATASHI_TOKEN, channel: message.channel, ts: message.ts, }); } }); };
Remove limitation to limit nojoin bot target to sandbox
nojoin: Remove limitation to limit nojoin bot target to sandbox
TypeScript
mit
tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot,tsg-ut/slackbot
--- +++ @@ -1,22 +1,13 @@ -// Automatically removes join/leave messages in sandbox - -import {WebClient, RTMClient} from '@slack/client'; - -interface SlackInterface { - rtmClient: RTMClient, - webClient: WebClient, -} +import {SlackInterface} from '../lib/slack'; export default async ({rtmClient: rtm, webClient: slack}: SlackInterface) => { - rtm.on('message', async (message) => { - if (message.channel === process.env.CHANNEL_SANDBOX) { - if (message.subtype === 'channel_join' || message.subtype === 'channel_leave') { - await slack.chat.delete({ - token: process.env.HAKATASHI_TOKEN, - channel: message.channel, - ts: message.ts, - }); - } + rtm.on('message', async (message: any) => { + if (message.subtype === 'channel_join' || message.subtype === 'channel_leave') { + await slack.chat.delete({ + token: process.env.HAKATASHI_TOKEN, + channel: message.channel, + ts: message.ts, + }); } }); };
81af969c276c950814a0ee4398b8a657a49acf52
src/extended-schema/merge-extended-schemas.ts
src/extended-schema/merge-extended-schemas.ts
import { ExtendedSchema, FieldMetadata, SchemaMetadata } from './extended-schema'; import { flatMap } from '../utils/utils'; import { mergeSchemas } from '../graphql/merge-schemas'; /** * Merges multiple GraphQL schemas by merging the fields of root types (query, mutation, subscription). * Also takes care of extended field metadata */ export function mergeExtendedSchemas(...schemas: ExtendedSchema[]) { const fieldMetadata = mergeFieldMetadata(...schemas.map(schema => schema.fieldMetadata)); return new ExtendedSchema(mergeSchemas(schemas.map(schema => schema.schema)), new SchemaMetadata({fieldMetadata})); } export function mergeFieldMetadata(...metadatas: Map<string, FieldMetadata>[]) { return new Map(flatMap(metadatas, map => Array.from(map))); }
import { ExtendedSchema, FieldMetadata, SchemaMetadata } from './extended-schema'; import { flatMap } from '../utils/utils'; import { mergeSchemas } from '../graphql/merge-schemas'; /** * Merges multiple GraphQL schemas by merging the fields of root types (query, mutation, subscription). * Also takes care of extended field metadata */ export function mergeExtendedSchemas(...schemas: ExtendedSchema[]) { const fieldMetadata = mergeFieldMetadata(...schemas.map(schema => schema.fieldMetadata)); return new ExtendedSchema(mergeSchemas(schemas.map(schema => schema.schema)), new SchemaMetadata({fieldMetadata})); } export function mergeFieldMetadata(...metadatas: Map<string, FieldMetadata>[]) { return new Map<string, FieldMetadata>(flatMap(metadatas, map => Array.from(map))); }
Add type information to flatMap/Array.from
Add type information to flatMap/Array.from
TypeScript
mit
AEB-labs/graphql-weaver,AEB-labs/graphql-weaver
--- +++ @@ -12,5 +12,5 @@ } export function mergeFieldMetadata(...metadatas: Map<string, FieldMetadata>[]) { - return new Map(flatMap(metadatas, map => Array.from(map))); + return new Map<string, FieldMetadata>(flatMap(metadatas, map => Array.from(map))); }
5407fd3caee297355dee588dace9d92163301de2
packages/ream/src/webpack/blocks/bundle-for-node.ts
packages/ream/src/webpack/blocks/bundle-for-node.ts
import WebpackChain from 'webpack-chain' export function bundleForNode(chain: WebpackChain, isClient: boolean) { if (isClient) { return } chain.output.libraryTarget('commonjs2') chain.target('node') chain.externals([ require('webpack-node-externals')({ whitelist: [ /\.(?!(?:jsx?|json)$).{1,5}$/i, // Bundle Ream server 'ream-server', ], }), ]) chain.node.set('__dirname', true).set('__filename', true) }
import WebpackChain from 'webpack-chain' export function bundleForNode(chain: WebpackChain, isClient: boolean) { if (isClient) { return } chain.output.libraryTarget('commonjs2') chain.target('node') chain.externals([ require('webpack-node-externals')({ whitelist: [ /\.(?!(?:jsx?|json)$).{1,5}$/i, // Bundle Ream server 'ream-server', (name: string) => { // Don't externalize ream plugins // They should be bundled by webpack if ( name.startsWith('ream-plugin-') || name.startsWith('@ream/plugin-') || name.includes('/ream-plugin-') ) { return true } return false }, ], }), ]) chain.node.set('__dirname', true).set('__filename', true) }
Make webpack compile ream plugins
Make webpack compile ream plugins
TypeScript
mit
ream/ream
--- +++ @@ -4,7 +4,7 @@ if (isClient) { return } - + chain.output.libraryTarget('commonjs2') chain.target('node') chain.externals([ @@ -13,6 +13,18 @@ /\.(?!(?:jsx?|json)$).{1,5}$/i, // Bundle Ream server 'ream-server', + (name: string) => { + // Don't externalize ream plugins + // They should be bundled by webpack + if ( + name.startsWith('ream-plugin-') || + name.startsWith('@ream/plugin-') || + name.includes('/ream-plugin-') + ) { + return true + } + return false + }, ], }), ])
0527bc3489bd1a4f1e33de059690f1b3551a25dd
types/htmlbars-inline-precompile/index.d.ts
types/htmlbars-inline-precompile/index.d.ts
// Type definitions for htmlbars-inline-precompile 1.0 // Project: ember-cli-htmlbars-inline-precompile // Definitions by: Chris Krycho <https://github.com/chriskrycho> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This is a bit of a funky one: it's from a [Babel plugin], but is exported for // Ember applications as the module `"htmlbars-incline-precompile"`. It acts // like a tagged string from the perspective of consumers, but is actually an // AST transformation which generates a function as its output. // // [Babel plugin]: https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile#babel-plugin-htmlbars-inline-precompile- export default function hbs(tagged: TemplateStringsArray): () => {};
// Type definitions for htmlbars-inline-precompile 1.0 // Project: ember-cli-htmlbars-inline-precompile // Definitions by: Chris Krycho <https://github.com/chriskrycho> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This is a bit of a funky one: it's from a [Babel plugin], but is exported for // Ember applications as the module `"htmlbars-inline-precompile"`. It acts // like a tagged string from the perspective of consumers, but is actually an // AST transformation which generates a function as its output. // // [Babel plugin]: https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile#babel-plugin-htmlbars-inline-precompile- export default function hbs(tagged: TemplateStringsArray): () => {};
Fix typo in htmlbars-inline-precompile comments.
Fix typo in htmlbars-inline-precompile comments.
TypeScript
mit
benishouga/DefinitelyTyped,rolandzwaga/DefinitelyTyped,alexdresko/DefinitelyTyped,nycdotnet/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,abbasmhd/DefinitelyTyped,arusakov/DefinitelyTyped,aciccarello/DefinitelyTyped,ashwinr/DefinitelyTyped,benliddicott/DefinitelyTyped,chrootsu/DefinitelyTyped,zuzusik/DefinitelyTyped,arusakov/DefinitelyTyped,mcliment/DefinitelyTyped,ashwinr/DefinitelyTyped,aciccarello/DefinitelyTyped,borisyankov/DefinitelyTyped,benishouga/DefinitelyTyped,georgemarshall/DefinitelyTyped,nycdotnet/DefinitelyTyped,magny/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,jimthedev/DefinitelyTyped,dsebastien/DefinitelyTyped,alexdresko/DefinitelyTyped,markogresak/DefinitelyTyped,AgentME/DefinitelyTyped,zuzusik/DefinitelyTyped,borisyankov/DefinitelyTyped,benishouga/DefinitelyTyped,georgemarshall/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,jimthedev/DefinitelyTyped,zuzusik/DefinitelyTyped,one-pieces/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,abbasmhd/DefinitelyTyped,georgemarshall/DefinitelyTyped,jimthedev/DefinitelyTyped,AgentME/DefinitelyTyped,chrootsu/DefinitelyTyped,arusakov/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,rolandzwaga/DefinitelyTyped
--- +++ @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // This is a bit of a funky one: it's from a [Babel plugin], but is exported for -// Ember applications as the module `"htmlbars-incline-precompile"`. It acts +// Ember applications as the module `"htmlbars-inline-precompile"`. It acts // like a tagged string from the perspective of consumers, but is actually an // AST transformation which generates a function as its output. //
0338175916034f9d64658df0220076be556cefcf
AirTrafficControl.Web/App/AirplaneState.ts
AirTrafficControl.Web/App/AirplaneState.ts
 module AirTrafficControl { export class AirplaneState { constructor(ID: string, StateDescription: string) { } } }
 module AirTrafficControl { export class AirplaneState { constructor(public ID: string, public StateDescription: string) { } } }
Make sure the airplane data is available in the UI
Make sure the airplane data is available in the UI
TypeScript
mit
karolz-ms/diagnostics-eventflow
--- +++ @@ -1,6 +1,6 @@  module AirTrafficControl { export class AirplaneState { - constructor(ID: string, StateDescription: string) { } + constructor(public ID: string, public StateDescription: string) { } } }
dac7c80cb2ed6ef82462d1ec3dc3cfaebaa2760c
src/server/network/handlers/ChunkHandler.ts
src/server/network/handlers/ChunkHandler.ts
import { SocketHandler } from './SocketHandler' import { Vokkit } from '../../Vokkit' import { ChunkPosition } from '../../world/Chunk' export interface ChunkData { worldName: string, position: ChunkPosition } export class ChunkHandler extends SocketHandler { onConnection (socket: SocketIO.Socket) { socket.on('chunk', (data: ChunkData) => this.onChunkLoad(socket, data)) // todo: send chunk without getting request (dangerous) } onChunkLoad (socket: SocketIO.Socket, data: ChunkData) { const world = Vokkit.getServer().getWorld(data.worldName) if (!world) { socket.emit('chunk', { success: false, reason: 'world_name_not_exist' }) } const chunk = world.getChunk(data.position) socket.emit('chunk', { success: true, chunk: chunk.toJSON(), worldName: data.worldName }) } }
import { SocketHandler } from './SocketHandler' import { Vokkit } from '../../Vokkit' import { ChunkPosition } from '../../world/Chunk' export interface ChunkData { worldName: string, position: ChunkPosition } export class ChunkHandler extends SocketHandler { onConnection (socket: SocketIO.Socket) { socket.on('chunk', (data: ChunkData) => this.onChunkLoad(socket, data)) } onChunkLoad (socket: SocketIO.Socket, data: ChunkData) { const player = Vokkit.getServer().getPlayerById(socket.id) if (!player) { // Todo: check and ban ip return } const world = Vokkit.getServer().getWorld(data.worldName) if (!world) { socket.emit('chunk', { success: false, reason: 'world_name_not_exist' }) return } if (player.getLocation().getWorld() !== world) { socket.emit('chunk', { success: false, reason: 'invalid_chunk_request' }) return } const chunk = world.getChunk(data.position) socket.emit('chunk', { success: true, chunk: chunk.toJSON(), worldName: data.worldName }) } }
Check world and player before server sends chunk
Check world and player before server sends chunk
TypeScript
apache-2.0
Vokkit/Vokkit,Vokkit/Vokkit,Vokkit/Vokkit
--- +++ @@ -9,13 +9,23 @@ export class ChunkHandler extends SocketHandler { onConnection (socket: SocketIO.Socket) { - socket.on('chunk', (data: ChunkData) => this.onChunkLoad(socket, data)) // todo: send chunk without getting request (dangerous) + socket.on('chunk', (data: ChunkData) => this.onChunkLoad(socket, data)) } onChunkLoad (socket: SocketIO.Socket, data: ChunkData) { + const player = Vokkit.getServer().getPlayerById(socket.id) + if (!player) { + // Todo: check and ban ip + return + } const world = Vokkit.getServer().getWorld(data.worldName) if (!world) { socket.emit('chunk', { success: false, reason: 'world_name_not_exist' }) + return + } + if (player.getLocation().getWorld() !== world) { + socket.emit('chunk', { success: false, reason: 'invalid_chunk_request' }) + return } const chunk = world.getChunk(data.position) socket.emit('chunk', { success: true, chunk: chunk.toJSON(), worldName: data.worldName })
8122701a4b8cd7e362a62a1bc1e2deda4925f34e
src/utils/KeyValueCache.ts
src/utils/KeyValueCache.ts
interface KeyValueCacheItem<T, U> { key: T; value: U; } export class KeyValueCache<T, U> { private readonly cacheItems: KeyValueCacheItem<T, U>[] = []; getOrCreate(key: T, createFunc: () => U) { let item = this.get(key); if (item == null) { item = createFunc(); this.add(key, item); } return item; } get(key: T) { for (let cacheItem of this.cacheItems) { if (cacheItem.key === key) { return cacheItem.value; } } return null; } add(key: T, value: U) { this.cacheItems.push({ key, value }); } }
interface KeyValueCacheItem<T, U> { key: T; value: U; } export class KeyValueCache<T, U> { private readonly cacheItems: KeyValueCacheItem<T, U>[] = []; getOrCreate(key: T, createFunc: () => U) { let item = this.get(key); if (item == null) { item = createFunc(); this.add(key, item); } return item; } get(key: T) { // todo: make this O(1) somehow for (let cacheItem of this.cacheItems) { if (cacheItem.key === key) { return cacheItem.value; } } return null; } add(key: T, value: U) { this.cacheItems.push({ key, value }); } }
Add todo about making it faster.
Add todo about making it faster.
TypeScript
mit
dsherret/type-info-ts,dsherret/ts-type-info,dsherret/type-info-ts,dsherret/ts-type-info
--- +++ @@ -18,6 +18,7 @@ } get(key: T) { + // todo: make this O(1) somehow for (let cacheItem of this.cacheItems) { if (cacheItem.key === key) { return cacheItem.value;
a81bb6303d1d6908d19a6bd04b68d9091753502b
src/thememanagerutility.ts
src/thememanagerutility.ts
/* * Copyright 2014-2016 Simon Edwards <[email protected]> * * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file. */ import ThemeManager = require('./thememanager'); import ThemeTypes = require('./theme'); import Logger = require('./logger'); const print = console.log.bind(console); function main(): void { const tm = ThemeManager.makeThemeManager(['themes']); tm.getAllThemes().filter( (themeInfo) => themeInfo.id === 'spacelab-ui').forEach( (themeInfo) => { tm.renderThemes([themeInfo.id,'default']).then( (contents) => { print("----"); print("ID: ", themeInfo.id); print("Name: ", themeInfo.name); print("Path: ", themeInfo.path); ThemeTypes.cssFileEnumItems.forEach( (item) => { print("CSS " + ThemeTypes.cssFileNameBase(item) + "----"); print(contents.cssFiles[ThemeTypes.cssFileNameBase(item)]); }); }); }); } main();
/* * Copyright 2014-2016 Simon Edwards <[email protected]> * * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file. */ import ThemeManager = require('./thememanager'); import ThemeTypes = require('./theme'); import Logger = require('./logger'); const print = console.log.bind(console); function main(): void { const tm = ThemeManager.makeThemeManager(['themes']); tm.getAllThemes().filter( (themeInfo) => themeInfo.id === 'spacelab-ui').forEach( (themeInfo) => { tm.renderThemes([themeInfo.id,'default']).then( (contents) => { print("----"); print("ID: ", themeInfo.id); print("Name: ", themeInfo.name); print("Path: ", themeInfo.path); ThemeTypes.cssFileEnumItems.forEach( (item) => { print("CSS " + ThemeTypes.cssFileNameBase(item) + "----"); if (contents.success) { print(contents.themeContents.cssFiles[ThemeTypes.cssFileNameBase(item)]); } else { print(contents.errorMessage); } }); }); }); } main();
Fix up the theme utility which recently broke.
Fix up the theme utility which recently broke.
TypeScript
mit
sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm,sedwards2009/extraterm
--- +++ @@ -23,7 +23,11 @@ ThemeTypes.cssFileEnumItems.forEach( (item) => { print("CSS " + ThemeTypes.cssFileNameBase(item) + "----"); - print(contents.cssFiles[ThemeTypes.cssFileNameBase(item)]); + if (contents.success) { + print(contents.themeContents.cssFiles[ThemeTypes.cssFileNameBase(item)]); + } else { + print(contents.errorMessage); + } }); }); });
3fe979d66dbc78c3b3c37f8bf1223a7945a493b2
app/src/ui/tutorial/confirm-exit-tutorial.tsx
app/src/ui/tutorial/confirm-exit-tutorial.tsx
import * as React from 'react' import { Button } from '../lib/button' import { ButtonGroup } from '../lib/button-group' import { DialogFooter, DialogContent, Dialog } from '../dialog' interface IConfirmExitTutorialProps { readonly onDismissed: () => void readonly onContinue: () => void } export class ConfirmExitTutorial extends React.Component< IConfirmExitTutorialProps, {} > { public render() { return ( <Dialog title="Exit tutorial" onDismissed={this.props.onDismissed} onSubmit={this.props.onContinue} type="warning" > <DialogContent> <p> Are you sure you want to leave the tutorial? This will bring you back to the home screen. </p> </DialogContent> <DialogFooter> <ButtonGroup> <Button type="submit">Continue</Button> <Button onClick={this.props.onDismissed}>Cancel</Button> </ButtonGroup> </DialogFooter> </Dialog> ) } }
import * as React from 'react' import { Button } from '../lib/button' import { ButtonGroup } from '../lib/button-group' import { DialogFooter, DialogContent, Dialog } from '../dialog' interface IConfirmExitTutorialProps { readonly onDismissed: () => void readonly onContinue: () => void } export class ConfirmExitTutorial extends React.Component< IConfirmExitTutorialProps, {} > { public render() { return ( <Dialog title="Exit tutorial" onDismissed={this.props.onDismissed} onSubmit={this.props.onContinue} type="normal" > <DialogContent> <p> Are you sure you want to leave the tutorial? This will bring you back to the home screen. </p> </DialogContent> <DialogFooter> <ButtonGroup> <Button type="submit">Continue</Button> <Button onClick={this.props.onDismissed}>Cancel</Button> </ButtonGroup> </DialogFooter> </Dialog> ) } }
Change dialog type from warning to normal
Change dialog type from warning to normal
TypeScript
mit
kactus-io/kactus,desktop/desktop,artivilla/desktop,shiftkey/desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,kactus-io/kactus,j-f1/forked-desktop,j-f1/forked-desktop,say25/desktop,shiftkey/desktop,artivilla/desktop,desktop/desktop,say25/desktop,shiftkey/desktop,j-f1/forked-desktop,kactus-io/kactus,j-f1/forked-desktop,desktop/desktop,artivilla/desktop,desktop/desktop,say25/desktop,say25/desktop
--- +++ @@ -20,7 +20,7 @@ title="Exit tutorial" onDismissed={this.props.onDismissed} onSubmit={this.props.onContinue} - type="warning" + type="normal" > <DialogContent> <p>
eaa2f56e8d3dfe71bdd7373d6dd189256df45ad8
src/app/contact.service.ts
src/app/contact.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class contactSerivce { }
import { Injectable } from '@angular/core'; @Injectable() export class contactSerivce { getContacts(): void {} //stub }
Add 'getContacts' method stub to 'ContactService'
refactor: Add 'getContacts' method stub to 'ContactService' [ticket: #3]
TypeScript
mit
armin-es/contact-list-angular-2,armin-es/contact-list-angular-2,armin-es/contact-list-angular-2
--- +++ @@ -2,5 +2,5 @@ @Injectable() export class contactSerivce { - + getContacts(): void {} //stub }
1717ba1d948e24b7442d65888e6ea4fb44ffac30
src/sentry-connection/sentry-connection.ts
src/sentry-connection/sentry-connection.ts
import { subscribeToUncaughtExceptions, } from '../utils/error-handling'; import * as Raven from 'raven-js'; declare const SENTRY_KEY: string; if (SENTRY_KEY && SENTRY_KEY.length > 0) { Raven .config(SENTRY_KEY) .install(); subscribeToUncaughtExceptions(err => { const e = new Error(err.name); e.message = err.message; e.stack = err.stack; Raven.captureException(e); }); }
import { subscribeToUncaughtExceptions, } from '../utils/error-handling'; import * as Raven from 'raven-js'; declare const SENTRY_KEY: string; if (SENTRY_KEY && SENTRY_KEY.length > 0) { Raven .config(SENTRY_KEY, { release: chrome.runtime.getManifest().version }) .install(); subscribeToUncaughtExceptions(err => { const e = new Error(err.name); e.message = err.message; e.stack = err.stack; Raven.captureException(e); }); }
Tag error report with Augury version (as “release”)
Tag error report with Augury version (as “release”)
TypeScript
mit
rangle/augury,rangle/augury,rangle/augury,rangle/batarangle,rangle/augury,rangle/batarangle,rangle/batarangle,rangle/batarangle
--- +++ @@ -7,7 +7,7 @@ declare const SENTRY_KEY: string; if (SENTRY_KEY && SENTRY_KEY.length > 0) { Raven - .config(SENTRY_KEY) + .config(SENTRY_KEY, { release: chrome.runtime.getManifest().version }) .install(); subscribeToUncaughtExceptions(err => {
03cebecac36726889d8d72ad5562d0f84b83ea4a
public/app/core/components/PageLoader/PageLoader.tsx
public/app/core/components/PageLoader/PageLoader.tsx
import React, { FC } from 'react'; interface Props { pageName?: string; } const PageLoader: FC<Props> = ({ pageName }) => { const loadingText = `Loading ${pageName}...`; return ( <div className="page-loader-wrapper"> <i className="page-loader-wrapper__spinner fa fa-spinner fa-spin" /> <div className="page-loader-wrapper__text">{loadingText}</div> </div> ); }; export default PageLoader;
import React, { FC } from 'react'; interface Props { pageName?: string; } const PageLoader: FC<Props> = ({ pageName = '' }) => { const loadingText = `Loading ${pageName}...`; return ( <div className="page-loader-wrapper"> <i className="page-loader-wrapper__spinner fa fa-spinner fa-spin" /> <div className="page-loader-wrapper__text">{loadingText}</div> </div> ); }; export default PageLoader;
Add pageName default to avoid "Loading undefined..."
fix: Add pageName default to avoid "Loading undefined..."
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -4,7 +4,7 @@ pageName?: string; } -const PageLoader: FC<Props> = ({ pageName }) => { +const PageLoader: FC<Props> = ({ pageName = '' }) => { const loadingText = `Loading ${pageName}...`; return ( <div className="page-loader-wrapper">
aecf33b8111b0dd437d8dfbaaca550bd5ed14c4f
src/index.ts
src/index.ts
export { DEFAULT_BRANCH_NAME } from './constants'; export { StateProps, DispatchProps, Props, ExportedComponentDispatchProps, ExportedComponentStateProps, UIStateBranch, DefaultStateShape, defaultBranchSelector, defaultMapStateToProps, defaultMapDispatchToProps, createConnectWrapper, } from './utils'; export { SET_UI_STATE, REPLACE_UI_STATE, DESTROY_UI_STATE, setUIState, replaceUIState, destroyUIState, } from './actions'; export { createReducer } from './pojoReducer'; export { addReduxUIState } from './addReduxUIState'; export { connectReduxUIState } from './connectReduxUIState';
export { DEFAULT_BRANCH_NAME } from './constants'; export { StateProps, DispatchProps, Props, ExportedComponentDispatchProps, ExportedComponentStateProps, UIStateBranch, DefaultStateShape, defaultBranchSelector, defaultMapStateToProps, defaultMapDispatchToProps, createConnectWrapper, } from './utils'; export { SET_UI_STATE, REPLACE_UI_STATE, setUIState, replaceUIState, } from './actions'; export { createReducer } from './pojoReducer'; export { addReduxUIState } from './addReduxUIState'; export { connectReduxUIState } from './connectReduxUIState';
Remove references to old destroy UI state functionality
Remove references to old destroy UI state functionality
TypeScript
mit
jamiecopeland/redux-ui-state,jamiecopeland/redux-ui-state
--- +++ @@ -13,10 +13,8 @@ export { SET_UI_STATE, REPLACE_UI_STATE, - DESTROY_UI_STATE, setUIState, replaceUIState, - destroyUIState, } from './actions'; export { createReducer } from './pojoReducer';
6a0921a52d530089b4cd1746884570348235c2c1
src/index.ts
src/index.ts
import { OpaqueToken, Inject } from '@angular/core'; export const CONFIG_INITIALIZER = new OpaqueToken('Config initializer'); export function ConfigInitializer<T>(config: T) { type ConfigInitializerType = (config: T) => void; const reflect: any = (window as any)['Reflect']; const getOwnMetadata: Function = reflect.getOwnMetadata; const defineMetadata: Function = reflect.defineMetadata; return function ConfigInitializerDecorator(targetConstructor: any) { const metaInformation = getOwnMetadata('annotations', targetConstructor); const designParamtypesInformation = getOwnMetadata('design:paramtypes', targetConstructor); const parametersInformation = getOwnMetadata('parameters', targetConstructor); function newConstructor( configInitializer: ConfigInitializerType, ...args: any[], ) { configInitializer(config); // tslint:disable-next-line:no-invalid-this return targetConstructor.apply(this, args); } defineMetadata('annotations', metaInformation, newConstructor); defineMetadata('parameters', parametersInformation, newConstructor); defineMetadata( 'design:paramtypes', [ new Inject(CONFIG_INITIALIZER), ...designParamtypesInformation, ], newConstructor, ); newConstructor.prototype = targetConstructor.prototype; return newConstructor as typeof targetConstructor; }; }
import { OpaqueToken, Inject } from '@angular/core'; export const CONFIG_INITIALIZER = new OpaqueToken('Config initializer'); export function ConfigInitializer<T>(config: T) { type ConfigInitializerType = (config: T) => void; const reflect: any = (window as any)['Reflect']; const getOwnMetadata: Function = reflect.getOwnMetadata; const defineMetadata: Function = reflect.defineMetadata; return function ConfigInitializerDecorator(targetConstructor: any) { const metaInformation = getOwnMetadata('annotations', targetConstructor); const propMetaInformation = getOwnMetadata('propMetadata', targetConstructor); const designParamtypesInformation = getOwnMetadata('design:paramtypes', targetConstructor); const parametersInformation = getOwnMetadata('parameters', targetConstructor); function newConstructor( configInitializer: ConfigInitializerType, ...args: any[], ) { configInitializer(config); // tslint:disable-next-line:no-invalid-this return targetConstructor.apply(this, args); } defineMetadata('annotations', metaInformation, newConstructor); defineMetadata('propMetadata', propMetaInformation, newConstructor); defineMetadata('parameters', parametersInformation, newConstructor); defineMetadata( 'design:paramtypes', [ new Inject(CONFIG_INITIALIZER), ...designParamtypesInformation, ], newConstructor, ); newConstructor.prototype = targetConstructor.prototype; return newConstructor as typeof targetConstructor; }; }
Clone the propMetadata key as well
Clone the propMetadata key as well
TypeScript
mit
efidiles/ng2-config-initializer-decorator,efidiles/ng2-config-initializer-decorator,efidiles/ng2-config-initializer-decorator
--- +++ @@ -11,6 +11,7 @@ return function ConfigInitializerDecorator(targetConstructor: any) { const metaInformation = getOwnMetadata('annotations', targetConstructor); + const propMetaInformation = getOwnMetadata('propMetadata', targetConstructor); const designParamtypesInformation = getOwnMetadata('design:paramtypes', targetConstructor); const parametersInformation = getOwnMetadata('parameters', targetConstructor); @@ -25,6 +26,7 @@ } defineMetadata('annotations', metaInformation, newConstructor); + defineMetadata('propMetadata', propMetaInformation, newConstructor); defineMetadata('parameters', parametersInformation, newConstructor); defineMetadata( 'design:paramtypes',
e1a4f17bbd98b46052551e011ab824c0d33ee994
public/javascripts/Timer.ts
public/javascripts/Timer.ts
/// <reference path="../../typings/jquery/jquery.d.ts" /> class Timer { time: number; running: boolean; element: JQuery; /** * Takes the element to update every second */ constructor(element: JQuery) { this.element = element; this.running = false; } start(): void { this.time = 0; this.running = true; setTimeout(() => this.update(), 1000); } /** * Returns the time passed in seconds */ stop(): number { this.running = false; return this.time; } private update(): void { if (this.running) { this.time++; this.element.text(this.time); setTimeout(() => this.update(), 1000); } } }
/// <reference path="../../typings/jquery/jquery.d.ts" /> class Timer { time: number; running: boolean; element: JQuery; /** * Takes the element to update every second */ constructor(element: JQuery) { this.element = element; this.running = false; } start(): void { this.time = 0; this.element.text(0); this.running = true; setTimeout(() => this.update(), 1000); } /** * Returns the time passed in seconds */ stop(): number { this.running = false; return this.time; } private update(): void { if (this.running) { this.time++; this.element.text(this.time); setTimeout(() => this.update(), 1000); } } }
Update timer DOM element at start
Update timer DOM element at start
TypeScript
mit
takumif/pokesweeper,takumif/pokesweeper
--- +++ @@ -15,6 +15,7 @@ start(): void { this.time = 0; + this.element.text(0); this.running = true; setTimeout(() => this.update(), 1000); }
6e8d1115a32f6ebc52a48d70d985b34319aa1b85
frontend/src/pages/admin/members/index.tsx
frontend/src/pages/admin/members/index.tsx
import * as React from 'react'; import { RouteComponentProps } from '@reach/router'; import { Title } from '../../../components/title/index'; export const Members = (props: RouteComponentProps) => ( <Title>Members list</Title> );
import * as React from 'react'; import { RouteComponentProps } from '@reach/router'; import { Title } from '../../../components/title/index'; export const Members = (props: RouteComponentProps) => ( <> <Title>Members list</Title> <table> <thead> <tr> <th>Nome</th> <th>Stato</th> <th>Scadenza</th> <th /> </tr> </thead> <tbody> <tr> <td>Patrick Arminio</td> <td>Attivo</td> <td>20 aprile 2019</td> </tr> </tbody> </table> </> );
Add stub table for members
Add stub table for members
TypeScript
mit
patrick91/pycon,patrick91/pycon
--- +++ @@ -4,5 +4,26 @@ import { Title } from '../../../components/title/index'; export const Members = (props: RouteComponentProps) => ( - <Title>Members list</Title> + <> + <Title>Members list</Title> + + <table> + <thead> + <tr> + <th>Nome</th> + <th>Stato</th> + <th>Scadenza</th> + <th /> + </tr> + </thead> + + <tbody> + <tr> + <td>Patrick Arminio</td> + <td>Attivo</td> + <td>20 aprile 2019</td> + </tr> + </tbody> + </table> + </> );
cb1346b0b602d76797f11f0be7904c88a144a1d1
lib/client-api/src/hooks.ts
lib/client-api/src/hooks.ts
import { ADDON_STATE_CHANGED, ADDON_STATE_SET } from '@storybook/core-events'; import { HooksContext, applyHooks, useMemo, useCallback, useRef, useState, useReducer, useEffect, useChannel, useStoryContext, useParameter, } from '@storybook/addons'; export { HooksContext, applyHooks, useMemo, useCallback, useRef, useState, useReducer, useEffect, useChannel, useStoryContext, useParameter, }; export function useAddonState<S>(addonId: string, defaultState?: S): [S, (s: S) => void] { const [state, setState] = useState<S>(defaultState); const emit = useChannel( { [`${ADDON_STATE_CHANGED}-manager-${addonId}`]: (s: S) => { setState(s); }, [`${ADDON_STATE_SET}-manager-${addonId}`]: (s: S) => { setState(s); }, }, [addonId] ); useEffect(() => { // init if (defaultState !== undefined) { emit(`${ADDON_STATE_SET}-client-${addonId}`, defaultState); } }, []); return [ state, s => { setState(s); emit(`${ADDON_STATE_CHANGED}-client-${addonId}`, s); }, ]; }
import { ADDON_STATE_CHANGED, ADDON_STATE_SET } from '@storybook/core-events'; import { HooksContext, applyHooks, useMemo, useCallback, useRef, useState, useReducer, useEffect, useChannel, useStoryContext, useParameter, } from '@storybook/addons'; export { HooksContext, applyHooks, useMemo, useCallback, useRef, useState, useReducer, useEffect, useChannel, useStoryContext, useParameter, }; // We keep this store, because when stories are edited by the user, and HMR, state is lost. // This allows us to restore instantly. const addonStateCache: Record<string, any> = {}; export function useAddonState<S>(addonId: string, defaultState?: S): [S, (s: S) => void] { const restoredState = addonStateCache[addonId] as S; const [state, setState] = useState<S>( typeof restoredState === 'undefined' ? defaultState : restoredState ); addonStateCache[addonId] = state; const allListeners = useMemo( () => ({ [`${ADDON_STATE_CHANGED}-manager-${addonId}`]: (s: S) => setState(s), [`${ADDON_STATE_SET}-manager-${addonId}`]: (s: S) => setState(s), }), [addonId] ); const emit = useChannel(allListeners, [addonId]); useEffect(() => { // init if (defaultState !== undefined) { emit(`${ADDON_STATE_SET}-client-${addonId}`, defaultState); } }, []); return [ state, s => { setState(s); emit(`${ADDON_STATE_CHANGED}-client-${addonId}`, s); }, ]; }
ADD memoization for eventHandlers object & ADD a addonState cache for HMR compat
ADD memoization for eventHandlers object & ADD a addonState cache for HMR compat
TypeScript
mit
storybooks/storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook
--- +++ @@ -28,19 +28,28 @@ useParameter, }; +// We keep this store, because when stories are edited by the user, and HMR, state is lost. +// This allows us to restore instantly. +const addonStateCache: Record<string, any> = {}; + export function useAddonState<S>(addonId: string, defaultState?: S): [S, (s: S) => void] { - const [state, setState] = useState<S>(defaultState); - const emit = useChannel( - { - [`${ADDON_STATE_CHANGED}-manager-${addonId}`]: (s: S) => { - setState(s); - }, - [`${ADDON_STATE_SET}-manager-${addonId}`]: (s: S) => { - setState(s); - }, - }, + const restoredState = addonStateCache[addonId] as S; + + const [state, setState] = useState<S>( + typeof restoredState === 'undefined' ? defaultState : restoredState + ); + + addonStateCache[addonId] = state; + + const allListeners = useMemo( + () => ({ + [`${ADDON_STATE_CHANGED}-manager-${addonId}`]: (s: S) => setState(s), + [`${ADDON_STATE_SET}-manager-${addonId}`]: (s: S) => setState(s), + }), [addonId] ); + + const emit = useChannel(allListeners, [addonId]); useEffect(() => { // init
f0f79025565de946931488573ec3ca96ed17913a
src/reducers.ts
src/reducers.ts
import { RootState } from './types'; import { combineReducers } from 'redux'; import { reducer as toastr } from 'react-redux-toastr'; import { default as tab } from './reducers/tab'; import { default as searchingActive } from './reducers/searchingActive'; import { default as search } from './reducers/search'; import { default as queue } from './reducers/queue'; import { default as watchers } from './reducers/watchers'; import { default as searchOptions } from './reducers/searchOptions'; import { default as sortingOption } from './reducers/sortingOption'; import { default as hitBlocklist } from './reducers/hitBlocklist'; import { default as timeNextSearch } from './reducers/timeNextSearch'; import { default as waitingForMturk } from './reducers/waitingForMturk'; import { default as topticonSettings } from './reducers/topticonSettings'; import { default as requesterBlocklist } from './reducers/requesterBlocklist'; import { default as audioSettingsV1 } from './reducers/audioSettings'; import { default as audioFiles } from './reducers/audioFiles'; export const rootReducer = combineReducers<RootState>({ tab, queue, search, toastr, watchers, audioFiles, hitBlocklist, searchOptions, sortingOption, timeNextSearch, audioSettingsV1, waitingForMturk, searchingActive, topticonSettings, requesterBlocklist });
import { RootState } from './types'; import { combineReducers } from 'redux'; import { reducer as toastr } from 'react-redux-toastr'; import { default as tab } from './reducers/tab'; import { default as searchingActive } from './reducers/searchingActive'; import { default as account } from './reducers/account'; import { default as search } from './reducers/search'; import { default as queue } from './reducers/queue'; import { default as watchers } from './reducers/watchers'; import { default as searchOptions } from './reducers/searchOptions'; import { default as sortingOption } from './reducers/sortingOption'; import { default as hitBlocklist } from './reducers/hitBlocklist'; import { default as timeNextSearch } from './reducers/timeNextSearch'; import { default as waitingForMturk } from './reducers/waitingForMturk'; import { default as topticonSettings } from './reducers/topticonSettings'; import { default as requesterBlocklist } from './reducers/requesterBlocklist'; import { default as audioSettingsV1 } from './reducers/audioSettings'; import { default as audioFiles } from './reducers/audioFiles'; export const rootReducer = combineReducers<RootState>({ tab, queue, search, toastr, account, watchers, audioFiles, hitBlocklist, searchOptions, sortingOption, timeNextSearch, audioSettingsV1, waitingForMturk, searchingActive, topticonSettings, requesterBlocklist });
Add account reducer to root reducer.
Add account reducer to root reducer.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -3,6 +3,7 @@ import { reducer as toastr } from 'react-redux-toastr'; import { default as tab } from './reducers/tab'; import { default as searchingActive } from './reducers/searchingActive'; +import { default as account } from './reducers/account'; import { default as search } from './reducers/search'; import { default as queue } from './reducers/queue'; import { default as watchers } from './reducers/watchers'; @@ -21,6 +22,7 @@ queue, search, toastr, + account, watchers, audioFiles, hitBlocklist,
c53692cefd7cd871c253985b02458e758d123032
packages/stryker-webpack/test/index.spec.ts
packages/stryker-webpack/test/index.spec.ts
import { expect } from "chai"; import Main from "../src/index"; describe("index.js", () => { let main: Main; beforeEach(() => { main = new Main(); }); it("Should return \"Hello world\" when the hello function is called", () => { expect(main.hello()).to.equal("Hello World"); }); });
import { expect } from "chai"; import Main from "../src/index"; describe("index.js", () => { let main: Main; beforeEach(() => { main = new Main(); }); it("Should return \"Hello world\" when the hello function is called", () => { expect(main.hello()).to.equal("Hello World!"); }); });
Revert "Feat(fail): Add failing test"
Revert "Feat(fail): Add failing test" This reverts commit 80fc5bd242d8b182440381d44c9ed3404eee005c.
TypeScript
apache-2.0
stryker-mutator/stryker,stryker-mutator/stryker,stryker-mutator/stryker
--- +++ @@ -9,6 +9,6 @@ }); it("Should return \"Hello world\" when the hello function is called", () => { - expect(main.hello()).to.equal("Hello World"); + expect(main.hello()).to.equal("Hello World!"); }); });
6b7ec83de2c61e0a571bcb6b04f77b6035ffd338
logged-in-router-outlet.ts
logged-in-router-outlet.ts
import {Inject, Directive, Attribute, ElementRef, DynamicComponentLoader} from 'angular2/core'; import {Router, RouterOutlet, ComponentInstruction} from 'angular2/router'; import IAuthenticationService from './services/authentication/interface'; @Directive({ selector: 'router-outlet' }) export default class LoggedInRouterOutlet extends RouterOutlet { private _publicRoutes: any; private _parentRouter0: Router; private _authService: IAuthenticationService; constructor(elementRef: ElementRef, loader: DynamicComponentLoader, parentRouter: Router, @Attribute('name') nameAttr: string, @Inject('AuthenticationService') authService: IAuthenticationService) { super(elementRef, loader, parentRouter, nameAttr); this._parentRouter0 = parentRouter; this._authService = authService; this._publicRoutes = { '/login': true, '/signup': true }; } activate (instruction: ComponentInstruction): Promise<any> { const url: string = this._parentRouter0.lastNavigationAttempt; if (!this._publicRoutes[url] && !this._authService.authenticated) { this._parentRouter0.navigateByUrl('/login'); } return super.activate(instruction); } }
import {Inject, Directive, Attribute, ElementRef, DynamicComponentLoader} from 'angular2/core'; import {Router, RouterOutlet, ComponentInstruction} from 'angular2/router'; import IAuthenticationService from './services/authentication/interface'; @Directive({ selector: 'router-outlet' }) export default class LoggedInRouterOutlet extends RouterOutlet { private _publicRoutes: any; private _parentRouter0: Router; private _authService: IAuthenticationService; constructor(elementRef: ElementRef, loader: DynamicComponentLoader, parentRouter: Router, @Attribute('name') nameAttr: string, @Inject('AuthenticationService') authService: IAuthenticationService) { super(elementRef, loader, parentRouter, nameAttr); this._parentRouter0 = parentRouter; this._authService = authService; this._publicRoutes = { '/login': true, '/signup': true }; } activate (instruction: ComponentInstruction): Promise<any> { const url: string = this._parentRouter0.lastNavigationAttempt; if (!this._publicRoutes[url] && !this._authService.authenticated) { this._parentRouter0.navigate(['Login']); } return super.activate(instruction); } }
Use navigate instead of navigateByUrl
Use navigate instead of navigateByUrl
TypeScript
mit
timdp/angular2-sub-bay,timdp/angular2-sub-bay,timdp/angular2-sub-bay
--- +++ @@ -25,7 +25,7 @@ activate (instruction: ComponentInstruction): Promise<any> { const url: string = this._parentRouter0.lastNavigationAttempt; if (!this._publicRoutes[url] && !this._authService.authenticated) { - this._parentRouter0.navigateByUrl('/login'); + this._parentRouter0.navigate(['Login']); } return super.activate(instruction); }
3437e530d9ed260d2b0a3aab495fe0d91c594ed4
types/electron-store/electron-store-tests.ts
types/electron-store/electron-store-tests.ts
import ElectronStore = require('electron-store'); new ElectronStore({ defaults: {} }); new ElectronStore({ name: 'myConfiguration', cwd: 'unicorn' }); const electronStore = new ElectronStore(); electronStore.set('foo', 'bar'); electronStore.set({ foo: 'bar', foo2: 'bar2' }); electronStore.delete('foo'); electronStore.get('foo'); electronStore.get('foo', 42); electronStore.has('foo'); electronStore.clear(); electronStore.openInEditor(); electronStore.size; electronStore.store; electronStore.store = { foo: 'bar' }; electronStore.path;
import ElectronStore = require('electron-store'); new ElectronStore({ defaults: {} }); new ElectronStore({ name: 'myConfiguration', cwd: 'unicorn' }); const electronStore = new ElectronStore(); electronStore.set('foo', 'bar'); electronStore.set({ foo: 'bar', foo2: 'bar2' }); electronStore.delete('foo'); electronStore.get('foo'); electronStore.get('foo', 42); electronStore.has('foo'); electronStore.clear(); electronStore.openInEditor(); electronStore.size; electronStore.store; electronStore.store = { foo: 'bar' }; electronStore.path; interface SampleStore { enabled: boolean; interval: number; } const typedElectronStore = new ElectronStore<SampleStore>({ defaults: { enabled: true, interval: 30000, }, }); const interval: number = typedElectronStore.get('interval'); const enabled = false; typedElectronStore.set('enabled', enabled); typedElectronStore.set({ enabled: true, interval: 10000, });
Add tests for typed store
Add tests for typed store
TypeScript
mit
georgemarshall/DefinitelyTyped,arusakov/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped,chrootsu/DefinitelyTyped,one-pieces/DefinitelyTyped,rolandzwaga/DefinitelyTyped,markogresak/DefinitelyTyped,AgentME/DefinitelyTyped,arusakov/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,chrootsu/DefinitelyTyped,mcliment/DefinitelyTyped,arusakov/DefinitelyTyped,rolandzwaga/DefinitelyTyped
--- +++ @@ -1,20 +1,20 @@ import ElectronStore = require('electron-store'); new ElectronStore({ - defaults: {} + defaults: {} }); new ElectronStore({ - name: 'myConfiguration', - cwd: 'unicorn' + name: 'myConfiguration', + cwd: 'unicorn' }); const electronStore = new ElectronStore(); electronStore.set('foo', 'bar'); electronStore.set({ - foo: 'bar', - foo2: 'bar2' + foo: 'bar', + foo2: 'bar2' }); electronStore.delete('foo'); electronStore.get('foo'); @@ -28,7 +28,27 @@ electronStore.store; electronStore.store = { - foo: 'bar' + foo: 'bar' }; electronStore.path; + +interface SampleStore { + enabled: boolean; + interval: number; +} + +const typedElectronStore = new ElectronStore<SampleStore>({ + defaults: { + enabled: true, + interval: 30000, + }, +}); + +const interval: number = typedElectronStore.get('interval'); +const enabled = false; +typedElectronStore.set('enabled', enabled); +typedElectronStore.set({ + enabled: true, + interval: 10000, +});
71bce16a00f0bc4fe7c067277053f09773b0e554
addons/contexts/src/preview/frameworks/vue.ts
addons/contexts/src/preview/frameworks/vue.ts
import Vue from 'vue'; import { createAddonDecorator, Render } from '../../index'; import { ContextsPreviewAPI } from '../ContextsPreviewAPI'; import { ID } from '../../shared/constants'; /** * This is the framework specific bindings for Vue. * '@storybook/vue' expects the returning object from a decorator to be a 'VueComponent'. */ export const renderVue: Render<Vue.Component> = (contextNodes, propsMap, getStoryVNode) => { const { getRendererFrom, updateReactiveSystem } = ContextsPreviewAPI(); const reactiveProps = updateReactiveSystem(propsMap); return Vue.extend({ name: ID, data: () => reactiveProps, render: createElement => getRendererFrom((component, props, children) => createElement(component, { props }, [children]) )(contextNodes, reactiveProps, () => createElement(getStoryVNode())), }); }; export const withContexts = createAddonDecorator(renderVue);
import Vue from 'vue'; import { createAddonDecorator, Render } from '../../index'; import { ContextsPreviewAPI } from '../ContextsPreviewAPI'; import { ID } from '../../shared/constants'; /** * This is the framework specific bindings for Vue. * '@storybook/vue' expects the returning object from a decorator to be a 'VueComponent'. */ export const renderVue: Render<Vue.Component> = (contextNodes, propsMap, getStoryVNode) => { const { getRendererFrom, updateReactiveSystem } = ContextsPreviewAPI(); const reactiveProps = updateReactiveSystem(propsMap); return Vue.extend({ name: ID, data: () => reactiveProps, render: createElement => getRendererFrom((Component, props, children) => { const { key, ref, style, classNames, ...rest } = props || Object(); const contextData = Component instanceof Object ? { key, ref, style, class: classNames, props: rest } // component as a Vue object : { key, ref, style, class: classNames, attrs: rest }; // component as a HTML tag string return createElement(Component, contextData, [children]); })(contextNodes, reactiveProps, () => createElement(getStoryVNode())), }); }; export const withContexts = createAddonDecorator(renderVue);
FIX addon-contexts: allow `props` to map on VueComponent contexts
FIX addon-contexts: allow `props` to map on VueComponent contexts
TypeScript
mit
storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -14,9 +14,14 @@ name: ID, data: () => reactiveProps, render: createElement => - getRendererFrom((component, props, children) => - createElement(component, { props }, [children]) - )(contextNodes, reactiveProps, () => createElement(getStoryVNode())), + getRendererFrom((Component, props, children) => { + const { key, ref, style, classNames, ...rest } = props || Object(); + const contextData = + Component instanceof Object + ? { key, ref, style, class: classNames, props: rest } // component as a Vue object + : { key, ref, style, class: classNames, attrs: rest }; // component as a HTML tag string + return createElement(Component, contextData, [children]); + })(contextNodes, reactiveProps, () => createElement(getStoryVNode())), }); };
899b9f07b28ec5735586d4bec0b2c3e475f82132
public_api.ts
public_api.ts
export * from './src/app/ng-intercom'
export { Intercom } from './src/app/ng-intercom/intercom/intercom' export { IntercomConfig } from './src/app/ng-intercom/shared/intercom-config' export { IntercomHideDirective } from './src/app/ng-intercom/directives/hide.directive' export { IntercomModule } from './src/app/ng-intercom/intercom.module' export { IntercomShowDirective } from './src/app/ng-intercom/directives/show.directive' export { IntercomShowMessagesDirective } from './src/app/ng-intercom/directives/show-messages.directive' export { IntercomShowNewMessageDirective } from './src/app/ng-intercom/directives/show-new-message.directive' export { IntercomShutdownDirective } from './src/app/ng-intercom/directives/shutdown.directive' export { IntercomTrackEventDirective } from './src/app/ng-intercom/directives/track-event.directive'
Fix import metadata issue (see links below)
Fix import metadata issue (see links below) https://github.com/MurhafSousli/ngx-progressbar/issues/160 https://github.com/MurhafSousli/ngx-progressbar/pull/168/files
TypeScript
mit
CaliStyle/angular2-intercom
--- +++ @@ -1 +1,9 @@ -export * from './src/app/ng-intercom' +export { Intercom } from './src/app/ng-intercom/intercom/intercom' +export { IntercomConfig } from './src/app/ng-intercom/shared/intercom-config' +export { IntercomHideDirective } from './src/app/ng-intercom/directives/hide.directive' +export { IntercomModule } from './src/app/ng-intercom/intercom.module' +export { IntercomShowDirective } from './src/app/ng-intercom/directives/show.directive' +export { IntercomShowMessagesDirective } from './src/app/ng-intercom/directives/show-messages.directive' +export { IntercomShowNewMessageDirective } from './src/app/ng-intercom/directives/show-new-message.directive' +export { IntercomShutdownDirective } from './src/app/ng-intercom/directives/shutdown.directive' +export { IntercomTrackEventDirective } from './src/app/ng-intercom/directives/track-event.directive'
1d52f1356a6d72096ada2e3812ddae9fd7345346
src/app/comparisons/shared/package.service.ts
src/app/comparisons/shared/package.service.ts
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/merge'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { PypiPackage } from './package.model'; @Injectable() export class PackageService { private pypiUrl = 'http://pypi.python.org/pypi'; constructor(private http: Http) { } getPackages(packages: Array<string>): Observable<PypiPackage> { const packageObservables = packages.map((packageName: string) => { return this.http.get(`${this.pypiUrl}/${packageName}/json`); }); return Observable.merge(...packageObservables) .map((res: Response) => <PypiPackage>res.json()) .catch(this.handleError); } private handleError(error) { const msg = `Status code {error.status} on url {error.url}`; console.error(msg); return Observable.throw(msg); } }
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/observable/merge'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/catch'; import 'rxjs/add/observable/throw'; import { PypiPackage } from './package.model'; @Injectable() export class PackageService { private pypiUrl = 'https://pypi.python.org/pypi'; constructor(private http: Http) { } getPackages(packages: Array<string>): Observable<PypiPackage> { const packageObservables = packages.map((packageName: string) => { return this.http.get(`${this.pypiUrl}/${packageName}/json`); }); return Observable.merge(...packageObservables) .map((res: Response) => <PypiPackage>res.json()) .catch(this.handleError); } private handleError(error) { const msg = `Status code {error.status} on url {error.url}`; console.error(msg); return Observable.throw(msg); } }
Set https on API fetching.
Set https on API fetching.
TypeScript
mit
gabrielaraujof/pypicompare,gabrielaraujof/pypicompare,gabrielaraujof/pypicompare
--- +++ @@ -12,7 +12,7 @@ @Injectable() export class PackageService { - private pypiUrl = 'http://pypi.python.org/pypi'; + private pypiUrl = 'https://pypi.python.org/pypi'; constructor(private http: Http) { }
a91037fb50ade3f5063c3147bfbb78c81a4f8c47
public/app/core/utils/scrollbar.ts
public/app/core/utils/scrollbar.ts
// Slightly modified: https://raw.githubusercontent.com/malte-wessel/react-custom-scrollbars/master/src/utils/getScrollbarWidth.js // No "dom-css" dependancy let scrollbarWidth = null; export default function getScrollbarWidth() { if (scrollbarWidth !== null) { return scrollbarWidth; } /* istanbul ignore else */ if (typeof document !== 'undefined') { const div = document.createElement('div'); const newStyles = { width: '100px', height: '100px', position: 'absolute', top: '-9999px', overflow: 'scroll', MsOverflowStyle: 'scrollbar' }; Object.keys(newStyles).map(style => { div.style[style] = newStyles[style]; }); document.body.appendChild(div); scrollbarWidth = (div.offsetWidth - div.clientWidth); document.body.removeChild(div); } else { scrollbarWidth = 0; } return scrollbarWidth || 0; } export const hasNoOverlayScrollbars = getScrollbarWidth() > 0; export const addClassIfNoOverlayScrollbar = (classname: string, htmlElement: HTMLElement = document.body) => { if (hasNoOverlayScrollbars) { htmlElement.classList.add(classname); } };
// Slightly modified: https://raw.githubusercontent.com/malte-wessel/react-custom-scrollbars/master/src/utils/getScrollbarWidth.js // No "dom-css" dependancy let scrollbarWidth = null; export default function getScrollbarWidth() { if (scrollbarWidth !== null) { return scrollbarWidth; } if (typeof document !== 'undefined') { const div = document.createElement('div'); const newStyles = { width: '100px', height: '100px', position: 'absolute', top: '-9999px', overflow: 'scroll', MsOverflowStyle: 'scrollbar' }; Object.keys(newStyles).map(style => { div.style[style] = newStyles[style]; }); document.body.appendChild(div); scrollbarWidth = (div.offsetWidth - div.clientWidth); document.body.removeChild(div); } else { scrollbarWidth = 0; } return scrollbarWidth || 0; } const hasNoOverlayScrollbars = getScrollbarWidth() > 0; export const addClassIfNoOverlayScrollbar = (classname: string, htmlElement: HTMLElement = document.body) => { if (hasNoOverlayScrollbars) { htmlElement.classList.add(classname); } };
Remove comment and unneeded export
chore: Remove comment and unneeded export
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -6,7 +6,7 @@ if (scrollbarWidth !== null) { return scrollbarWidth; } - /* istanbul ignore else */ + if (typeof document !== 'undefined') { const div = document.createElement('div'); const newStyles = { @@ -31,7 +31,7 @@ return scrollbarWidth || 0; } -export const hasNoOverlayScrollbars = getScrollbarWidth() > 0; +const hasNoOverlayScrollbars = getScrollbarWidth() > 0; export const addClassIfNoOverlayScrollbar = (classname: string, htmlElement: HTMLElement = document.body) => { if (hasNoOverlayScrollbars) {
9c18f44028cbb7d9322ece535d2528d60f78d367
src/marketplace/offerings/plan/PriceField.tsx
src/marketplace/offerings/plan/PriceField.tsx
import * as React from 'react'; import { defaultCurrency } from '@waldur/core/services'; import { connectPlanComponents } from './utils'; export const PriceField = connectPlanComponents(props => ( <div className="form-control-static"> {defaultCurrency(props.total)} </div> ));
import * as React from 'react'; import { defaultCurrency } from '@waldur/core/services'; import { connectPlanComponents } from './utils'; export const PriceField = connectPlanComponents((props: {total: number}) => ( <div className="form-control-static"> {defaultCurrency(props.total)} </div> ));
Fix typing for price field component.
Fix typing for price field component.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -4,7 +4,7 @@ import { connectPlanComponents } from './utils'; -export const PriceField = connectPlanComponents(props => ( +export const PriceField = connectPlanComponents((props: {total: number}) => ( <div className="form-control-static"> {defaultCurrency(props.total)} </div>
d2fd059490ef88001942ad0347811b0390ce691a
src/components/SearchCard/TOpticonButton.tsx
src/components/SearchCard/TOpticonButton.tsx
import * as React from 'react'; import { Button, Stack, TextContainer } from '@shopify/polaris'; import { Tooltip } from '@blueprintjs/core'; import { RequesterInfo } from '../../types'; import { turkopticonBaseUrl } from '../../constants/urls'; export interface Props { readonly requesterId: string; readonly turkopticon?: RequesterInfo; } class TOpticonButton extends React.PureComponent<Props, never> { private static generateTooltipContent = (data: RequesterInfo) => { const { numTosFlags, numReviews, scores: { comm, fair, fast, pay } } = data; return ( <Stack vertical> <TextContainer>{numTosFlags} reported TOS violations.</TextContainer> <TextContainer> Pay: {pay}. Comm: {comm}. Fair: {fair}. Fast: {fast}. </TextContainer> <TextContainer>Calculated from {numReviews} reviews.</TextContainer> </Stack> ); }; public render() { const { requesterId, turkopticon } = this.props; return turkopticon ? ( <Tooltip content={TOpticonButton.generateTooltipContent(turkopticon)}> <Button plain external url={turkopticonBaseUrl + requesterId}> T.O. Page </Button> </Tooltip> ) : ( <Button plain disabled external url={turkopticonBaseUrl + requesterId}> No T.O. data. </Button> ); } } export default TOpticonButton;
import * as React from 'react'; import { Button, Stack, TextContainer } from '@shopify/polaris'; import { Tooltip } from '@blueprintjs/core'; import { RequesterInfo } from '../../types'; import { turkopticonBaseUrl } from '../../constants/urls'; export interface Props { readonly requesterId: string; readonly turkopticon?: RequesterInfo; } class TOpticonButton extends React.PureComponent<Props, never> { private static generateTooltipContent = (data: RequesterInfo) => { const { numTosFlags, numReviews, scores: { comm, fair, fast, pay } } = data; return ( <Stack vertical> <TextContainer>{numTosFlags} reported TOS violations.</TextContainer> <TextContainer> Pay: {pay || 'No reviews'}. Comm: {comm || 'No reviews'}. Fair:{' '} {fair || 'No reviews'}. Fast: {fast || 'No reviews'}. </TextContainer> <TextContainer>Calculated from {numReviews} reviews.</TextContainer> </Stack> ); }; public render() { const { requesterId, turkopticon } = this.props; return turkopticon ? ( <Tooltip content={TOpticonButton.generateTooltipContent(turkopticon)}> <Button plain external url={turkopticonBaseUrl + requesterId}> T.O. Page </Button> </Tooltip> ) : ( <Button plain disabled external url={turkopticonBaseUrl + requesterId}> No T.O. data. </Button> ); } } export default TOpticonButton;
Add fallback value for Topticon Tooltip.
Add fallback value for Topticon Tooltip.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -17,7 +17,8 @@ <Stack vertical> <TextContainer>{numTosFlags} reported TOS violations.</TextContainer> <TextContainer> - Pay: {pay}. Comm: {comm}. Fair: {fair}. Fast: {fast}. + Pay: {pay || 'No reviews'}. Comm: {comm || 'No reviews'}. Fair:{' '} + {fair || 'No reviews'}. Fast: {fast || 'No reviews'}. </TextContainer> <TextContainer>Calculated from {numReviews} reviews.</TextContainer> </Stack>
e89da275d77be5af9f42b3763562b5fcc2b2ff90
src/api/image-api.ts
src/api/image-api.ts
import * as request from 'superagent'; import * as Promise from 'bluebird'; import { Response } from 'superagent'; import { apiBaseUrl, end, Options} from './shared' function buildPath(machineName: string): string { return `${apiBaseUrl}/machines/${machineName}/images`; } export default { fetchMachineImageList: function (machineName: string, options?: Options): Promise<Response> { return end(request.get(`${buildPath(machineName)}`).query(options)); }, createMachineImage: function (machineName: string, options?: Options): Promise<Response> { return end(request.post(`${buildPath(machineName)}`).send(options)); }, removeMachineImage: function (machineName: string, imageName: string, options?: Options): Promise<Response> { return end(request.delete(`${buildPath(machineName)}/${imageName}`).send(options)); } }
import * as request from 'superagent'; import * as Promise from 'bluebird'; import { Response } from 'superagent'; import { apiBaseUrl, end, Options} from './shared' function buildMachinePath(machineName: string): string { return `${apiBaseUrl}/machines/${machineName}/images`; } function buildLocalPath(): string { return `${apiBaseUrl}/local/images`; } export default { fetchMachineImageList: function (machineName: string, options?: Options): Promise<Response> { return end(request.get(`${buildMachinePath(machineName)}`).query(options)); }, createMachineImage: function (machineName: string, options?: Options): Promise<Response> { return end(request.post(`${buildMachinePath(machineName)}`).send(options)); }, removeMachineImage: function (machineName: string, imageName: string, options?: Options): Promise<Response> { return end(request.delete(`${buildMachinePath(machineName)}/${imageName}`).send(options)); }, //local docker fetchList: function (options?: Options) { return end(request.get(`${buildLocalPath()}`).query(options)); }, create: function (options?: Options) { return end(request.post(`${buildLocalPath()}`).send(options)); }, remove: function (imageName: string, options?: Options) { return end(request.delete(`${buildLocalPath()}/${imageName}`).send(options)); } }
Update image API for support local docker
Update image API for support local docker
TypeScript
apache-2.0
lawrence0819/neptune-front,lawrence0819/neptune-front
--- +++ @@ -3,18 +3,33 @@ import { Response } from 'superagent'; import { apiBaseUrl, end, Options} from './shared' -function buildPath(machineName: string): string { +function buildMachinePath(machineName: string): string { return `${apiBaseUrl}/machines/${machineName}/images`; +} + +function buildLocalPath(): string { + return `${apiBaseUrl}/local/images`; } export default { fetchMachineImageList: function (machineName: string, options?: Options): Promise<Response> { - return end(request.get(`${buildPath(machineName)}`).query(options)); + return end(request.get(`${buildMachinePath(machineName)}`).query(options)); }, createMachineImage: function (machineName: string, options?: Options): Promise<Response> { - return end(request.post(`${buildPath(machineName)}`).send(options)); + return end(request.post(`${buildMachinePath(machineName)}`).send(options)); }, removeMachineImage: function (machineName: string, imageName: string, options?: Options): Promise<Response> { - return end(request.delete(`${buildPath(machineName)}/${imageName}`).send(options)); + return end(request.delete(`${buildMachinePath(machineName)}/${imageName}`).send(options)); + }, + + //local docker + fetchList: function (options?: Options) { + return end(request.get(`${buildLocalPath()}`).query(options)); + }, + create: function (options?: Options) { + return end(request.post(`${buildLocalPath()}`).send(options)); + }, + remove: function (imageName: string, options?: Options) { + return end(request.delete(`${buildLocalPath()}/${imageName}`).send(options)); } }
f664836eb0f13643433c0cdb93c1b1687c67412d
scripts/postbuild.ts
scripts/postbuild.ts
const fs = require('fs') const definitionsFile = 'dist/myra.d.ts' // dts-bundle is removing 'declare' so this is an ugly way to bring it back // again fs.readFile(definitionsFile, 'utf8', (err, data) => { if (err) { throw err } const result = data.replace('global {', 'declare global {') fs.writeFile(definitionsFile, result, 'utf8', err => { if (err) { throw err } // Add 'export as namespace myra' to declaration file. fs.appendFile(definitionsFile, 'export as namespace myra', (err) => { if (err) { throw err } }) }) })
const fs = require('fs') const definitionsFile = 'dist/myra.d.ts' // dts-bundle is removing 'declare' so this is an ugly way to bring it back // again fs.readFile(definitionsFile, 'utf8', (err, data) => { if (err) { throw err } const result = data.replace('global {', 'declare global {') fs.writeFile(definitionsFile, result, 'utf8', err => { if (err) { throw err } // Add 'export as namespace myra' to declaration file. fs.appendFile(definitionsFile, 'export as namespace myra', (err) => { if (err) { throw err } }) }) })
Fix post build "declare global"-fix
Fix post build "declare global"-fix
TypeScript
mit
jhdrn/myra,jhdrn/myra
--- +++ @@ -11,7 +11,7 @@ throw err } - const result = data.replace('global {', 'declare global {') + const result = data.replace('global {', 'declare global {') fs.writeFile(definitionsFile, result, 'utf8', err => { if (err) {
2bae53a7169e80503d42f19cbc0e1d67421df835
src/service/nginx.ts
src/service/nginx.ts
import {ChildProcess, spawn} from 'child_process'; import {EventEmitter} from 'events'; import {dirname} from 'path'; import * as log4js from 'log4js'; const logger = log4js.getLogger(); import * as repository from './repository'; export default class Nginx extends EventEmitter { private exePath: string; private process: ChildProcess; start(exePath: string) { logger.info('start server: ', exePath, '-c', repository.NGINX_CONFIG_PATH); this.exePath = exePath; if (exePath == null || exePath.length === 0) { this.exePath = 'nginx'; } this.process = spawn( this.exePath, ['-c', repository.NGINX_CONFIG_PATH], { cwd: dirname(this.exePath) } ); this.process.on('close', () => { logger.info('server closed'); if (!this.isAlive) { this.emit('close'); } }); } restart() { this.stop(); this.start(this.exePath); } stop() { if (this.process == null) { return; } this.process.kill(); this.process = null; } get isAlive() { return this.process != null; } }
import {ChildProcess, spawn} from 'child_process'; import {EventEmitter} from 'events'; import {dirname} from 'path'; import * as log4js from 'log4js'; const logger = log4js.getLogger(); import * as repository from './repository'; export default class Nginx extends EventEmitter { private exePath: string; private process: ChildProcess; start(exePath: string) { logger.info('Server starting: ', exePath, '-c', repository.NGINX_CONFIG_PATH); this.exePath = exePath; if (exePath == null || exePath.length === 0) { this.exePath = 'nginx'; } let process = spawn( this.exePath, ['-c', repository.NGINX_CONFIG_PATH], { cwd: dirname(this.exePath) } ); process.on('error', (e: any) => { logger.error('Server error', e); }); process.on('close', () => { logger.info('Server closed'); if (this.process === process) { this.process = null; } if (!this.isAlive) { this.emit('close'); } }); this.process = process; } restart() { this.stop(); this.start(this.exePath); } stop() { if (this.process == null) { return; } this.process.kill(); } get isAlive() { return this.process != null; } }
Fix error on first time
Fix error on first time
TypeScript
mit
progre/nginx-rtmp-frontend,progre/nginx-rtmp-frontend,progre/nginx-rtmp-frontend
--- +++ @@ -10,22 +10,29 @@ private process: ChildProcess; start(exePath: string) { - logger.info('start server: ', exePath, '-c', repository.NGINX_CONFIG_PATH); + logger.info('Server starting: ', exePath, '-c', repository.NGINX_CONFIG_PATH); this.exePath = exePath; if (exePath == null || exePath.length === 0) { this.exePath = 'nginx'; } - this.process = spawn( + let process = spawn( this.exePath, ['-c', repository.NGINX_CONFIG_PATH], { cwd: dirname(this.exePath) } ); - this.process.on('close', () => { - logger.info('server closed'); + process.on('error', (e: any) => { + logger.error('Server error', e); + }); + process.on('close', () => { + logger.info('Server closed'); + if (this.process === process) { + this.process = null; + } if (!this.isAlive) { this.emit('close'); } }); + this.process = process; } restart() { @@ -38,7 +45,6 @@ return; } this.process.kill(); - this.process = null; } get isAlive() {
20a02230b65c33c8e898173f6598886661d2e0f4
src/utils/hitItem.ts
src/utils/hitItem.ts
import { Hit, Requester } from '../types'; import { generateBadges } from './badges'; import { truncate } from './formatting'; type ExceptionStatus = 'neutral' | 'warning' | 'critical'; export interface ExceptionDescriptor { status?: ExceptionStatus; title?: string; description?: string; } const generateExceptions = (groupId: string): ExceptionDescriptor[] => { return groupId.startsWith('[Error:groupId]-') ? [ { status: 'warning', title: 'You are not qualified.' } ] : []; }; export const generateItemProps = (hit: Hit, requester: Requester | undefined) => { const { requesterName, groupId, title } = hit; const actions = [ // { // icon: 'view', // external: true, // url: `https://www.mturk.com/mturk/preview?groupId=${groupId}` // }, { primary: true, external: true, content: 'Accept', accessibilityLabel: 'Accept', icon: 'add', url: `https://www.mturk.com/mturk/previewandaccept?groupId=${groupId}` } ]; return { attributeOne: requesterName, attributeTwo: truncate(title, 80), badges: generateBadges(requester), actions, exceptions: generateExceptions(groupId) }; };
import { Hit, Requester } from '../types'; import { generateBadges } from './badges'; import { truncate } from './formatting'; type ExceptionStatus = 'neutral' | 'warning' | 'critical'; export interface ExceptionDescriptor { status?: ExceptionStatus; title?: string; description?: string; } const generateExceptions = (groupId: string): ExceptionDescriptor[] => { return groupId.startsWith('[Error:groupId]-') ? [ { status: 'warning', title: 'You are not qualified.' } ] : []; }; export const generateItemProps = (hit: Hit, requester: Requester | undefined) => { const { requesterName, groupId, title } = hit; const actions = [ // { // icon: 'view', // external: true, // url: `https://www.mturk.com/mturk/preview?groupId=${groupId}` // }, { primary: true, external: true, content: 'Accept', accessibilityLabel: 'Accept', icon: 'add', url: `https://www.mturk.com/mturk/previewandaccept?groupId=${groupId}` } ]; return { attributeOne: truncate(requesterName, 40), attributeTwo: truncate(title, 80), badges: generateBadges(requester), actions, exceptions: generateExceptions(groupId) }; };
Truncate requester names to 40 characters.
Truncate requester names to 40 characters.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -35,7 +35,7 @@ ]; return { - attributeOne: requesterName, + attributeOne: truncate(requesterName, 40), attributeTwo: truncate(title, 80), badges: generateBadges(requester), actions,
aa1f8fb5e611d2090914ffbbefaaf960d5ead45e
src/js/components/Shortcut/HotkeyDialog.tsx
src/js/components/Shortcut/HotkeyDialog.tsx
import React from 'react' import { observer } from 'mobx-react' import Dialog from '@material-ui/core/Dialog' import DialogTitle from '@material-ui/core/DialogTitle' import DialogContent from '@material-ui/core/DialogContent' import Help from './Help' import Fade from '@material-ui/core/Fade' import { useStore } from 'components/StoreContext' import { makeStyles } from '@material-ui/core' const useStyles = makeStyles({ paper: { width: '100%' } }) export default observer(props => { const classes = useStyles(props) const { shortcutStore } = useStore() const { dialogOpen, closeDialog } = shortcutStore return ( <Dialog open={dialogOpen} classes={classes} TransitionComponent={Fade} onClose={closeDialog} onBackdropClick={closeDialog} > <DialogTitle>Keyboard shortcuts</DialogTitle> <DialogContent> <Help /> </DialogContent> </Dialog> ) })
import React from 'react' import useMediaQuery from '@material-ui/core/useMediaQuery' import { observer } from 'mobx-react' import Dialog from '@material-ui/core/Dialog' import DialogTitle from '@material-ui/core/DialogTitle' import DialogContent from '@material-ui/core/DialogContent' import Help from './Help' import Fade from '@material-ui/core/Fade' import IconButton from '@material-ui/core/IconButton' import CloseIcon from '@material-ui/icons/Close' import { useStore } from 'components/StoreContext' import { makeStyles, useTheme, Typography } from '@material-ui/core' const useStyles = makeStyles(theme => ({ paper: { width: '100%' }, closeButton: { position: 'absolute', right: theme.spacing(1), top: theme.spacing(1), color: theme.palette.grey[500] } })) export default observer(props => { const theme = useTheme() const fullScreen = useMediaQuery(theme.breakpoints.down('sm')) const classes = useStyles(props) const { shortcutStore } = useStore() const { dialogOpen, closeDialog } = shortcutStore return ( <Dialog open={dialogOpen} TransitionComponent={Fade} onClose={closeDialog} onBackdropClick={closeDialog} {...{ maxWidth: 'lg', classes, fullScreen }} > <DialogTitle> <Typography variant='h6'>Keyboard shortcuts</Typography> <IconButton aria-label='close' className={classes.closeButton} onClick={closeDialog} > <CloseIcon /> </IconButton> </DialogTitle> <DialogContent> <Help /> </DialogContent> </Dialog> ) })
Make hotkey dialog responsive and add close button
fix: Make hotkey dialog responsive and add close button
TypeScript
mit
xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2
--- +++ @@ -1,32 +1,52 @@ import React from 'react' +import useMediaQuery from '@material-ui/core/useMediaQuery' import { observer } from 'mobx-react' import Dialog from '@material-ui/core/Dialog' import DialogTitle from '@material-ui/core/DialogTitle' import DialogContent from '@material-ui/core/DialogContent' import Help from './Help' import Fade from '@material-ui/core/Fade' +import IconButton from '@material-ui/core/IconButton' +import CloseIcon from '@material-ui/icons/Close' import { useStore } from 'components/StoreContext' -import { makeStyles } from '@material-ui/core' +import { makeStyles, useTheme, Typography } from '@material-ui/core' -const useStyles = makeStyles({ +const useStyles = makeStyles(theme => ({ paper: { width: '100%' + }, + closeButton: { + position: 'absolute', + right: theme.spacing(1), + top: theme.spacing(1), + color: theme.palette.grey[500] } -}) +})) export default observer(props => { + const theme = useTheme() + const fullScreen = useMediaQuery(theme.breakpoints.down('sm')) const classes = useStyles(props) const { shortcutStore } = useStore() const { dialogOpen, closeDialog } = shortcutStore return ( <Dialog open={dialogOpen} - classes={classes} TransitionComponent={Fade} onClose={closeDialog} onBackdropClick={closeDialog} + {...{ maxWidth: 'lg', classes, fullScreen }} > - <DialogTitle>Keyboard shortcuts</DialogTitle> + <DialogTitle> + <Typography variant='h6'>Keyboard shortcuts</Typography> + <IconButton + aria-label='close' + className={classes.closeButton} + onClick={closeDialog} + > + <CloseIcon /> + </IconButton> + </DialogTitle> <DialogContent> <Help /> </DialogContent>
f4ad3c8fe1311acede16cf17bb4074adceaa97b3
templates/module/_name.config.ts
templates/module/_name.config.ts
import { Inject } from "<%= decoratorPath %>"; import { <%= pName %>Controller } from "./<%= hName %>.controller"; @Inject("$stateProvider") export class <%= pName %>Config { constructor(stateProvider: ng.ui.IStateProvider) { stateProvider .state("<%= appName %>.<%= name %>", { url: "/<%= pName %>", views: { <%= viewName %>: { templateUrl: "<%= tplPath %><%= hName %>/<%= hName %>.tpl.html", controller: <%= pName %>Controller, controllerAs: "<%= ctrlAlias %>" } } }); } }
import { Inject } from "<%= decoratorPath %>"; @Inject("$stateProvider") export class <%= pName %>Config { constructor(stateProvider: ng.ui.IStateProvider) { stateProvider .state("<%= appName %>.<%= name %>", { url: "/<%= pName %>", views: { <%= viewName %>: { templateUrl: "<%= tplPath %><%= hName %>/<%= hName %>.tpl.html", controller: "<%= pName %>Controller", controllerAs: "<%= ctrlAlias %>" } } }); } }
Use controller name instead of function
Use controller name instead of function
TypeScript
mit
Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli
--- +++ @@ -1,5 +1,4 @@ import { Inject } from "<%= decoratorPath %>"; -import { <%= pName %>Controller } from "./<%= hName %>.controller"; @Inject("$stateProvider") export class <%= pName %>Config { @@ -10,7 +9,7 @@ views: { <%= viewName %>: { templateUrl: "<%= tplPath %><%= hName %>/<%= hName %>.tpl.html", - controller: <%= pName %>Controller, + controller: "<%= pName %>Controller", controllerAs: "<%= ctrlAlias %>" } }
23235826067be76bdbea742451a4c25c2e595ff1
src/app/components/about/about.component.ts
src/app/components/about/about.component.ts
import { Component, OnInit, AfterViewChecked } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { DocumentRef } from '../../services/documentRef.service'; import { UserConfig } from '../../config/user.config'; @Component({ selector: 'about-component', templateUrl: './about.component.html', styleUrls: ['./about.component.scss'] }) export class AboutComponent implements OnInit, AfterViewChecked { private avatar: String = UserConfig.about.avatar; private descriptionLong: String = UserConfig.about.description_long; private descriptionShort: String = UserConfig.about.description_short; private email: String = UserConfig.about.email; private location: String = UserConfig.about.location; private job: String = UserConfig.about.job; private social: Array<Object> = UserConfig.social; private skills: Array<Object> = UserConfig.skills; private recognition: Array<Object> = UserConfig.recognition; constructor(private titleService: Title, private docRef: DocumentRef) {} ngOnInit(): void { this.titleService.setTitle('About - Brett Oberg'); } ngAfterViewChecked(): void { const el = this.docRef.nativeElement.getElementById('about--content-description-long'); if (el !== null && el !== undefined) { el.innerHTML = this.descriptionLong; } } }
import { Component, OnInit, AfterViewChecked } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { DocumentRef } from '../../services/documentRef.service'; import { UserConfig } from '../../config/user.config'; @Component({ selector: 'about-component', templateUrl: './about.component.html', styleUrls: ['./about.component.scss'] }) export class AboutComponent implements OnInit, AfterViewChecked { public avatar: String = UserConfig.about.avatar; public descriptionLong: String = UserConfig.about.description_long; public descriptionShort: String = UserConfig.about.description_short; public email: String = UserConfig.about.email; public location: String = UserConfig.about.location; public job: String = UserConfig.about.job; public social: Array<Object> = UserConfig.social; public skills: Array<Object> = UserConfig.skills; public recognition: Array<Object> = UserConfig.recognition; constructor(private titleService: Title, private docRef: DocumentRef) {} ngOnInit(): void { this.titleService.setTitle('About - Brett Oberg'); } ngAfterViewChecked(): void { const el = this.docRef.nativeElement.getElementById('about--content-description-long'); if (el !== null && el !== undefined) { el.innerHTML = this.descriptionLong; } } }
Change AboutComponent member variables to 'public'
Change AboutComponent member variables to 'public'
TypeScript
mit
bjoberg/brettoberg.com,bjoberg/brettoberg.com,bjoberg/brettoberg.com
--- +++ @@ -10,15 +10,15 @@ }) export class AboutComponent implements OnInit, AfterViewChecked { - private avatar: String = UserConfig.about.avatar; - private descriptionLong: String = UserConfig.about.description_long; - private descriptionShort: String = UserConfig.about.description_short; - private email: String = UserConfig.about.email; - private location: String = UserConfig.about.location; - private job: String = UserConfig.about.job; - private social: Array<Object> = UserConfig.social; - private skills: Array<Object> = UserConfig.skills; - private recognition: Array<Object> = UserConfig.recognition; + public avatar: String = UserConfig.about.avatar; + public descriptionLong: String = UserConfig.about.description_long; + public descriptionShort: String = UserConfig.about.description_short; + public email: String = UserConfig.about.email; + public location: String = UserConfig.about.location; + public job: String = UserConfig.about.job; + public social: Array<Object> = UserConfig.social; + public skills: Array<Object> = UserConfig.skills; + public recognition: Array<Object> = UserConfig.recognition; constructor(private titleService: Title, private docRef: DocumentRef) {}
0434e64a3cd8be68fc498fa1eec35298d0386582
src/app/file-store/file-store.service.ts
src/app/file-store/file-store.service.ts
import { Injectable } from '@angular/core'; import { AudioPlayerService } from '../audio-player/audio-player.service'; import { ChartFileImporterService } from '../chart-file/importer/chart-file-importer.service'; @Injectable() export class FileStoreService { private $audioFileName: string; private $chartFileName: string; constructor( private audioPlayer: AudioPlayerService, private chartFileImporter: ChartFileImporterService) { } get audioFileName(): string { return this.$audioFileName; } set audioFile(file: File) { this.$audioFileName = file.name; this.audioPlayer.audio = URL.createObjectURL(file); } get chartFileName(): string { return this.$chartFileName; } set chartFile(file: File) { this.$chartFileName = file.name; const reader = new FileReader(); reader.onload = () => { this.chartFileImporter.import(reader.result); }; reader.readAsText(file); } }
import { Injectable } from '@angular/core'; import { AudioPlayerService } from '../audio-player/audio-player.service'; import { ChartFileImporterService } from '../chart-file/importer/chart-file-importer.service'; @Injectable() export class FileStoreService { private $audioFileName: string; private $chartFileName: string; constructor( private audioPlayer: AudioPlayerService, private chartFileImporter: ChartFileImporterService) { } get audioFileName(): string { return this.$audioFileName; } set audioFile(file: File) { if (this.audioPlayer.playing) { this.audioPlayer.stop(); } this.$audioFileName = file.name; this.audioPlayer.audio = URL.createObjectURL(file); } get chartFileName(): string { return this.$chartFileName; } set chartFile(file: File) { if (this.audioPlayer.playing) { this.audioPlayer.stop(); } this.$chartFileName = file.name; const reader = new FileReader(); reader.onload = () => { this.chartFileImporter.import(reader.result); }; reader.readAsText(file); } }
Stop audio when new files are loaded
fix: Stop audio when new files are loaded
TypeScript
mit
nb48/chart-hero,nb48/chart-hero,nb48/chart-hero
--- +++ @@ -19,6 +19,9 @@ } set audioFile(file: File) { + if (this.audioPlayer.playing) { + this.audioPlayer.stop(); + } this.$audioFileName = file.name; this.audioPlayer.audio = URL.createObjectURL(file); } @@ -28,6 +31,9 @@ } set chartFile(file: File) { + if (this.audioPlayer.playing) { + this.audioPlayer.stop(); + } this.$chartFileName = file.name; const reader = new FileReader(); reader.onload = () => {
48125589a3bb2f4ddac9d5b80cdbd63fcb49543f
tests/SharedElementTransitionGroup.test.tsx
tests/SharedElementTransitionGroup.test.tsx
import {mount} from 'enzyme'; import jasmineEnzyme from 'jasmine-enzyme'; import * as React from 'react'; import {SharedElementTransitionGroup} from '../src'; describe('SharedElementTransitionGroup', () => { const Foo = () => ( <div>Foo</div> ); const Bar = () => ( <div>Bar</div> ); class MyComponent extends React.Component { public state: { toggle: boolean, }; constructor() { super(); this.state = { toggle: true, }; } public render() { return ( <SharedElementTransitionGroup> {this.state.toggle && <Foo />} {!this.state.toggle && <Bar />} </SharedElementTransitionGroup> ); } } beforeEach(() => { jasmineEnzyme(); }); it('should render the correct elements', () => { const wrapper = mount(<MyComponent />); expect(wrapper.find('Foo')).toBePresent(); expect(wrapper.find('Bar')).not.toBePresent(); }); it('should render the correct elements', () => { const wrapper = mount(<MyComponent />); wrapper.setState({ toggle: false, }); expect(wrapper.find('Foo')).not.toBePresent(); expect(wrapper.find('Bar')).toBePresent(); }); });
import {mount} from 'enzyme'; import jasmineEnzyme from 'jasmine-enzyme'; import * as React from 'react'; import {SharedElementTransitionGroup} from '../src'; describe('SharedElementTransitionGroup', () => { class Foo extends React.Component { public render() { return <div>Foo</div>; } }; class Bar extends React.Component { public render() { return <div>Bar</div>; } }; class MyComponent extends React.Component { public state: { toggle: boolean, }; constructor() { super(); this.state = { toggle: true, }; } public render() { return ( <SharedElementTransitionGroup> {this.state.toggle && <Foo />} {!this.state.toggle && <Bar />} </SharedElementTransitionGroup> ); } } beforeEach(() => { jasmineEnzyme(); }); it('should render the correct elements', () => { const wrapper = mount(<MyComponent />); expect(wrapper.find('Foo')).toBePresent(); expect(wrapper.find('Bar')).not.toBePresent(); }); it('should render the correct elements', () => { const wrapper = mount(<MyComponent />); wrapper.setState({ toggle: false, }); expect(wrapper.find('Foo')).not.toBePresent(); expect(wrapper.find('Bar')).toBePresent(); }); });
Make child components class components
Make child components class components Stateless components will not work
TypeScript
mit
bkazi/react-layout-transition,bkazi/react-layout-transition,bkazi/react-layout-transition
--- +++ @@ -5,12 +5,17 @@ import {SharedElementTransitionGroup} from '../src'; describe('SharedElementTransitionGroup', () => { - const Foo = () => ( - <div>Foo</div> - ); - const Bar = () => ( - <div>Bar</div> - ); + class Foo extends React.Component { + public render() { + return <div>Foo</div>; + } + }; + class Bar extends React.Component { + public render() { + return <div>Bar</div>; + } + }; + class MyComponent extends React.Component { public state: { toggle: boolean,
b326b81d845f1adbe5a05370fd840bd21942ea0c
src/dependument.manager.ts
src/dependument.manager.ts
import { IFileSystem } from './filesystem/filesystem.i'; import { ITemplateFileSystem } from './templates/templatefilesystem.i'; import * as Path from 'path'; export class DependumentManager { private _fileSystem : IFileSystem; private _templateFileSystem : ITemplateFileSystem; constructor(fileSystem: IFileSystem, templateFileSystem: ITemplateFileSystem) { this._fileSystem = fileSystem; this._templateFileSystem = templateFileSystem; } }
import { IFileSystem } from './filesystem/filesystem.i'; import { ITemplateFileSystem } from './templates/templatefilesystem.i'; import { IOptions } from './options/options.i'; import * as Path from 'path'; export class DependumentManager { private _fileSystem : IFileSystem; private _templateFileSystem : ITemplateFileSystem; public options: IOptions; constructor(fileSystem: IFileSystem, templateFileSystem: ITemplateFileSystem) { this._fileSystem = fileSystem; this._templateFileSystem = templateFileSystem; this.options = { templates: { dependencyTemplateFile: "dependency.md", outputTemplateFile: "output.md" } }; } }
Create options object in DependumentManager constructor
Create options object in DependumentManager constructor
TypeScript
unlicense
dependument/dependument,Jameskmonger/dependument,Jameskmonger/dependument,dependument/dependument
--- +++ @@ -1,13 +1,22 @@ import { IFileSystem } from './filesystem/filesystem.i'; import { ITemplateFileSystem } from './templates/templatefilesystem.i'; +import { IOptions } from './options/options.i'; import * as Path from 'path'; export class DependumentManager { private _fileSystem : IFileSystem; private _templateFileSystem : ITemplateFileSystem; + public options: IOptions; constructor(fileSystem: IFileSystem, templateFileSystem: ITemplateFileSystem) { this._fileSystem = fileSystem; this._templateFileSystem = templateFileSystem; + + this.options = { + templates: { + dependencyTemplateFile: "dependency.md", + outputTemplateFile: "output.md" + } + }; } }
435719f8e8a71218bcae1c1775ab1d080a1a1b99
src/ui/RendererUI.ts
src/ui/RendererUI.ts
/// <reference path="../../typings/threejs/three.d.ts" /> import * as THREE from "three"; import {Node} from "../Graph"; import {IActivatableUI} from "../UI"; export class RendererUI implements IActivatableUI { public graphSupport: boolean = true; private renderer: THREE.WebGLRenderer; private camera: THREE.PerspectiveCamera; private scene: THREE.Scene; constructor (container: HTMLElement) { this.renderer = new THREE.WebGLRenderer(); this.renderer.setSize(640, 480); this.renderer.setClearColor(new THREE.Color(0x202020), 1.0); this.renderer.sortObjects = false; this.renderer.domElement.style.width = "100%"; this.renderer.domElement.style.height = "100%"; container.appendChild(this.renderer.domElement); this.camera = new THREE.PerspectiveCamera(50, 4 / 3, 0.4, 1100); this.scene = new THREE.Scene(); this.renderer.render(this.scene, this.camera); window.requestAnimationFrame(this.animate.bind(this)); } public activate(): void { return; } public deactivate(): void { return; } public display(node: Node): void { return; } private animate(): void { window.requestAnimationFrame(this.animate.bind(this)); this.renderer.render(this.scene, this.camera); } } export default RendererUI;
/// <reference path="../../typings/threejs/three.d.ts" /> import * as THREE from "three"; import {Node} from "../Graph"; import {IActivatableUI} from "../UI"; export class RendererUI implements IActivatableUI { public graphSupport: boolean = true; private renderer: THREE.WebGLRenderer; private camera: THREE.PerspectiveCamera; private scene: THREE.Scene; constructor (container: HTMLElement) { this.renderer = new THREE.WebGLRenderer(); let width: number = container.offsetWidth; this.renderer.setSize(width, width * 3 / 4); this.renderer.setClearColor(new THREE.Color(0x2020FF), 1.0); this.renderer.sortObjects = false; this.renderer.domElement.style.width = "100%"; this.renderer.domElement.style.height = "100%"; container.appendChild(this.renderer.domElement); this.camera = new THREE.PerspectiveCamera(50, 4 / 3, 0.4, 1100); this.scene = new THREE.Scene(); this.renderer.render(this.scene, this.camera); window.requestAnimationFrame(this.animate.bind(this)); } public activate(): void { return; } public deactivate(): void { return; } public display(node: Node): void { return; } private animate(): void { window.requestAnimationFrame(this.animate.bind(this)); this.renderer.render(this.scene, this.camera); } } export default RendererUI;
Set renderer size based on container width.
Set renderer size based on container width.
TypeScript
mit
mapillary/mapillary-js,mapillary/mapillary-js
--- +++ @@ -13,8 +13,10 @@ constructor (container: HTMLElement) { this.renderer = new THREE.WebGLRenderer(); - this.renderer.setSize(640, 480); - this.renderer.setClearColor(new THREE.Color(0x202020), 1.0); + + let width: number = container.offsetWidth; + this.renderer.setSize(width, width * 3 / 4); + this.renderer.setClearColor(new THREE.Color(0x2020FF), 1.0); this.renderer.sortObjects = false; this.renderer.domElement.style.width = "100%";
c3dbfd95306af19d3e296af407766bc29ed33deb
src/parallel/static/partitionParallel.ts
src/parallel/static/partitionParallel.ts
import { IParallelEnumerable } from "../../types" /** * Paritions the Iterable<T> into a tuple of failing and passing arrays * based on the predicate. * @param source Elements to Partition * @param predicate Pass / Fail condition * @returns [pass, fail] */ export const partitionParallel = async <TSource>( source: IParallelEnumerable<TSource>, predicate: (x: TSource) => boolean): Promise<[TSource[], TSource[]]> => { const fail: TSource[] = [] const pass: TSource[] = [] for await (const value of source) { if (predicate(value) === true) { pass.push(value) } else { fail.push(value) } } return [pass, fail] }
import { IParallelEnumerable } from "../../types" /** * Paritions the IParallelEnumerable<T> into a tuple of failing and passing arrays * based on the predicate. * @param source Elements to Partition * @param predicate Pass / Fail condition * @returns [pass, fail] */ export const partitionParallel = async <TSource>( source: IParallelEnumerable<TSource>, predicate: (x: TSource) => boolean): Promise<[pass: TSource[], fail: TSource[]]> => { const fail: TSource[] = [] const pass: TSource[] = [] for await (const value of source) { if (predicate(value) === true) { pass.push(value) } else { fail.push(value) } } return [pass, fail] }
Improve typing for partial parallel
Improve typing for partial parallel
TypeScript
mit
arogozine/LinqToTypeScript,arogozine/LinqToTypeScript
--- +++ @@ -1,14 +1,14 @@ import { IParallelEnumerable } from "../../types" /** - * Paritions the Iterable<T> into a tuple of failing and passing arrays + * Paritions the IParallelEnumerable<T> into a tuple of failing and passing arrays * based on the predicate. * @param source Elements to Partition * @param predicate Pass / Fail condition * @returns [pass, fail] */ export const partitionParallel = async <TSource>( - source: IParallelEnumerable<TSource>, predicate: (x: TSource) => boolean): Promise<[TSource[], TSource[]]> => { + source: IParallelEnumerable<TSource>, predicate: (x: TSource) => boolean): Promise<[pass: TSource[], fail: TSource[]]> => { const fail: TSource[] = [] const pass: TSource[] = []
e2e2d808e2c900eef265274a20bc806f9f096c8f
app/src/lib/stores/helpers/onboarding-tutorial.ts
app/src/lib/stores/helpers/onboarding-tutorial.ts
export class OnboardingTutorial { public constructor({ resolveEditor, getEditor }) { this.skipInstallEditor = false this.skipCreatePR = false this.resolveEditor = resolveEditor this.getEditor = getEditor } public getCurrentStep() { // call all other methods to check where we're at } private async isEditorInstalled(): Promise<boolean> { if (this.skipInstallEditor || this.getEditor()) { return true } else { await this.resolveEditor() return !!this.getEditor() } } private isBranchCreated(): boolean { return false } private hasChangedFile(repository): boolean { return this.getChangedFiles(repository).length > 0 } private hasCommit(): boolean { return false } private commitPushed(): boolean { return false } private pullRequestCreated(): boolean { if (this.skipCreatePR) { return true } return false } public skipEditorInstall() { this.skipEditorInstall = true } public skipCreatePR() { this.skipCreatePR = true } }
export class OnboardingTutorial { public constructor({ resolveEditor, getEditor }) { this.skipInstallEditor = false this.skipCreatePR = false this.resolveEditor = resolveEditor this.getEditor = getEditor } public getCurrentStep(repository) { if (!repository.isTutorialRepository) { return null } // call all other methods to check where we're at } private async isEditorInstalled(): Promise<boolean> { if (this.skipInstallEditor || this.getEditor()) { return true } else { await this.resolveEditor() return !!this.getEditor() } } private isBranchCreated(): boolean { return false } private hasChangedFile(repository): boolean { return this.getChangedFiles(repository).length > 0 } private hasCommit(): boolean { return false } private commitPushed(): boolean { return false } private pullRequestCreated(): boolean { if (this.skipCreatePR) { return true } return false } public skipEditorInstall() { this.skipEditorInstall = true } public skipCreatePR() { this.skipCreatePR = true } }
Check if repo is tutorial repo
Check if repo is tutorial repo
TypeScript
mit
j-f1/forked-desktop,say25/desktop,say25/desktop,kactus-io/kactus,shiftkey/desktop,shiftkey/desktop,desktop/desktop,artivilla/desktop,desktop/desktop,kactus-io/kactus,desktop/desktop,desktop/desktop,kactus-io/kactus,j-f1/forked-desktop,artivilla/desktop,say25/desktop,kactus-io/kactus,say25/desktop,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop
--- +++ @@ -6,7 +6,10 @@ this.getEditor = getEditor } - public getCurrentStep() { + public getCurrentStep(repository) { + if (!repository.isTutorialRepository) { + return null + } // call all other methods to check where we're at }
26dce28bf03c337556595e25e79104d8c12796d3
src/renderer/pages/PreferencesPage/Checkbox.tsx
src/renderer/pages/PreferencesPage/Checkbox.tsx
import { actions } from "common/actions"; import { Dispatch, PreferencesState } from "common/types"; import React from "react"; import { hookWithProps } from "renderer/hocs/hook"; import Label from "renderer/pages/PreferencesPage/Label"; class Checkbox extends React.PureComponent<Props> { render() { const { name, active, children, dispatch, label } = this.props; return ( <Label active={active}> <input type="checkbox" checked={active} onChange={this.onChange} /> <span> {label} </span> {children} </Label> ); } onChange = (e: React.ChangeEvent<HTMLInputElement>) => { const { dispatch } = this.props; dispatch(actions.updatePreferences({ [name]: e.currentTarget.checked })); }; } interface Props { name: keyof PreferencesState; label: string | JSX.Element; children?: any; dispatch: Dispatch; active: boolean; } export default hookWithProps(Checkbox)(map => ({ active: map((rs, props) => rs.preferences[props.name]), }))(Checkbox);
import { actions } from "common/actions"; import { Dispatch, PreferencesState } from "common/types"; import React from "react"; import { hookWithProps } from "renderer/hocs/hook"; import Label from "renderer/pages/PreferencesPage/Label"; class Checkbox extends React.PureComponent<Props> { render() { const { active, children, label } = this.props; return ( <Label active={active}> <input type="checkbox" checked={active} onChange={this.onChange} /> <span> {label} </span> {children} </Label> ); } onChange = (e: React.ChangeEvent<HTMLInputElement>) => { const { name, dispatch } = this.props; dispatch(actions.updatePreferences({ [name]: e.currentTarget.checked })); }; } interface Props { name: keyof PreferencesState; label: string | JSX.Element; children?: any; dispatch: Dispatch; active: boolean; } export default hookWithProps(Checkbox)(map => ({ active: map((rs, props) => rs.preferences[props.name]), }))(Checkbox);
Fix checkbox in preferences (regression from react-lint spree)
Fix checkbox in preferences (regression from react-lint spree)
TypeScript
mit
itchio/itchio-app,itchio/itch,itchio/itchio-app,leafo/itchio-app,itchio/itchio-app,itchio/itch,itchio/itch,itchio/itch,leafo/itchio-app,itchio/itch,leafo/itchio-app,itchio/itch
--- +++ @@ -6,7 +6,7 @@ class Checkbox extends React.PureComponent<Props> { render() { - const { name, active, children, dispatch, label } = this.props; + const { active, children, label } = this.props; return ( <Label active={active}> @@ -18,7 +18,7 @@ } onChange = (e: React.ChangeEvent<HTMLInputElement>) => { - const { dispatch } = this.props; + const { name, dispatch } = this.props; dispatch(actions.updatePreferences({ [name]: e.currentTarget.checked })); }; }
aeec996ac9afc43c32b7e13ee12eb4ab072f9727
client/app/account/account.component.spec.ts
client/app/account/account.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AccountComponent } from './account.component'; describe('AccountComponent', () => { let component: AccountComponent; let fixture: ComponentFixture<AccountComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ AccountComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AccountComponent); component = fixture.componentInstance; fixture.detectChanges(); }); /*it('should create', () => { expect(component).toBeTruthy(); });*/ });
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { AccountComponent } from './account.component'; import { AuthService } from '../services/auth.service'; import { UserService } from '../services/user.service'; import { ToastComponent } from '../shared/toast/toast.component'; import { of } from 'rxjs'; class AuthServiceMock { } class UserServiceMock { mockUser = { username: 'Test user', email: '[email protected]', role: 'user' }; getUser() { return of(this.mockUser); } } describe('Component: Account', () => { let component: AccountComponent; let fixture: ComponentFixture<AccountComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ FormsModule ], declarations: [ AccountComponent ], providers: [ ToastComponent, { provide: AuthService, useClass: AuthServiceMock }, { provide: UserService, useClass: UserServiceMock }, ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AccountComponent); component = fixture.componentInstance; fixture.detectChanges(); component.user = { username: 'Test user', email: '[email protected]' }; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should display the page header text', () => { const el = fixture.debugElement.query(By.css('h4')).nativeElement; expect(el.textContent).toContain('Account settings'); }); it('should display the username and email inputs filled', async () => { await fixture.whenStable(); const [usernameInput, emailInput] = fixture.debugElement.queryAll(By.css('input')); expect(usernameInput.nativeElement.value).toContain('Test user'); expect(emailInput.nativeElement.value).toContain('[email protected]'); }); it('should display the save button and be enabled', () => { const saveBtn = fixture.debugElement.query(By.css('button')); expect(saveBtn.nativeElement.disabled).toBeFalsy(); }); });
Add unit test to account component
Add unit test to account component
TypeScript
mit
DavideViolante/Angular-Full-Stack,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular-Full-Stack,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular-Full-Stack,DavideViolante/Angular-Full-Stack
--- +++ @@ -1,14 +1,39 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { FormsModule } from '@angular/forms'; import { AccountComponent } from './account.component'; +import { AuthService } from '../services/auth.service'; +import { UserService } from '../services/user.service'; +import { ToastComponent } from '../shared/toast/toast.component'; +import { of } from 'rxjs'; -describe('AccountComponent', () => { +class AuthServiceMock { } + +class UserServiceMock { + mockUser = { + username: 'Test user', + email: '[email protected]', + role: 'user' + }; + getUser() { + return of(this.mockUser); + } +} + +describe('Component: Account', () => { let component: AccountComponent; let fixture: ComponentFixture<AccountComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ AccountComponent ] + imports: [ FormsModule ], + declarations: [ AccountComponent ], + providers: [ + ToastComponent, + { provide: AuthService, useClass: AuthServiceMock }, + { provide: UserService, useClass: UserServiceMock }, + ] }) .compileComponents(); })); @@ -17,9 +42,32 @@ fixture = TestBed.createComponent(AccountComponent); component = fixture.componentInstance; fixture.detectChanges(); + component.user = { + username: 'Test user', + email: '[email protected]' + }; + fixture.detectChanges(); }); - /*it('should create', () => { + it('should create', () => { expect(component).toBeTruthy(); - });*/ + }); + + it('should display the page header text', () => { + const el = fixture.debugElement.query(By.css('h4')).nativeElement; + expect(el.textContent).toContain('Account settings'); + }); + + it('should display the username and email inputs filled', async () => { + await fixture.whenStable(); + const [usernameInput, emailInput] = fixture.debugElement.queryAll(By.css('input')); + expect(usernameInput.nativeElement.value).toContain('Test user'); + expect(emailInput.nativeElement.value).toContain('[email protected]'); + }); + + it('should display the save button and be enabled', () => { + const saveBtn = fixture.debugElement.query(By.css('button')); + expect(saveBtn.nativeElement.disabled).toBeFalsy(); + }); + });
440dd109a005659be7340a96a2b9203e1c66939c
src/renderer/visualizer/circle-visualizer.ts
src/renderer/visualizer/circle-visualizer.ts
import { setTimeout } from "timers"; import { Visualizer } from "./visualizer"; export default class CircleVisualizer extends Visualizer { constructor(canvas: HTMLCanvasElement) { super(canvas, 32); } public start(): void { super.start(); this.drawFunction = (freqs, times, drawContext, canvas) => { const frequency = freqs[0]; const scaledFrequency = frequency / 10; drawContext.beginPath(); drawContext.arc(canvas.width / 2, canvas.height / 2, scaledFrequency, 0, 2 * Math.PI); drawContext.fillStyle = "white"; drawContext.fill(); }; } public stop(): void { // Allow for animation to finish setTimeout(() => { super.stop(); }, 500); } }
import { Visualizer } from "./visualizer"; export default class CircleVisualizer extends Visualizer { constructor(canvas: HTMLCanvasElement) { super(canvas, 32); } public start(): void { super.start(); this.drawFunction = (freqs, times, drawContext, canvas) => { const frequency = freqs[0]; const scaledFrequency = frequency / 10; drawContext.beginPath(); drawContext.arc(canvas.width / 2, canvas.height / 2, scaledFrequency, 0, 2 * Math.PI); drawContext.fillStyle = "white"; drawContext.fill(); }; } public stop(): void { // Allow for animation to finish setTimeout(() => { super.stop(); }, 500); } }
Remove un-nessesary import + prettier
Remove un-nessesary import + prettier
TypeScript
mit
dolanmiu/MMM-awesome-alexa,dolanmiu/MMM-awesome-alexa
--- +++ @@ -1,8 +1,6 @@ -import { setTimeout } from "timers"; import { Visualizer } from "./visualizer"; export default class CircleVisualizer extends Visualizer { - constructor(canvas: HTMLCanvasElement) { super(canvas, 32); }
ee6f5b3312d72d5dc4861feaf32f0900f649a0f3
packages/components/containers/api/DelinquentModal.tsx
packages/components/containers/api/DelinquentModal.tsx
import { c } from 'ttag'; import { getInvoicesPathname } from '@proton/shared/lib/apps/helper'; import { AlertModal, ButtonLike, ModalProps, SettingsLink } from '../../components'; import { useConfig } from '../../hooks'; const DelinquentModal = (props: ModalProps) => { const { APP_NAME } = useConfig(); const title = c('Delinquent modal title').t`Overdue invoice`; return ( <AlertModal title={title} buttons={[ <ButtonLike color="norm" as={SettingsLink} path={getInvoicesPathname(APP_NAME)}> {c('Action').t`View invoice`} </ButtonLike>, ]} {...props} > <div> {c('Info') .t`Your Proton account is currently on hold. To continue using your account, please pay any overdue invoices.`} </div> </AlertModal> ); }; export default DelinquentModal;
import { c } from 'ttag'; import { getInvoicesPathname } from '@proton/shared/lib/apps/helper'; import { AlertModal, ButtonLike, ModalProps, SettingsLink } from '../../components'; import { useConfig } from '../../hooks'; const DelinquentModal = (props: ModalProps) => { const { APP_NAME } = useConfig(); const title = c('Delinquent modal title').t`Overdue invoice`; return ( <AlertModal title={title} buttons={[ <ButtonLike color="norm" as={SettingsLink} path={getInvoicesPathname(APP_NAME)} onClick={props.onClose}> {c('Action').t`View invoice`} </ButtonLike>, ]} {...props} > <div> {c('Info') .t`Your Proton account is currently on hold. To continue using your account, please pay any overdue invoices.`} </div> </AlertModal> ); }; export default DelinquentModal;
Allow to close the delinquent modal
Allow to close the delinquent modal It may be triggered from API handlers in account
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -12,7 +12,7 @@ <AlertModal title={title} buttons={[ - <ButtonLike color="norm" as={SettingsLink} path={getInvoicesPathname(APP_NAME)}> + <ButtonLike color="norm" as={SettingsLink} path={getInvoicesPathname(APP_NAME)} onClick={props.onClose}> {c('Action').t`View invoice`} </ButtonLike>, ]}
ee12b1fa3f7e66ca5e6fe2e804525de8a1725363
packages/xlucene-parser/src/functions/index.ts
packages/xlucene-parser/src/functions/index.ts
import { xLuceneTypeConfig, xLuceneVariables } from '@terascope/types'; import geoBoxFn from './geo/box'; import geoDistanceFn from './geo/distance'; import geoPolygonFn from './geo/polygon'; import geoContainsPointFn from './geo/contains-point'; import { FunctionDefinition, FunctionMethods, FunctionNode } from '../interfaces'; export enum xLuceneFunction { geoDistance = 'geoDistance', geoBox = 'geoBox', geoPolygon = 'geoPolygon', geoContainsPoint = 'geoContainsPoint', } export const xLuceneFunctions: Record<xLuceneFunction, FunctionDefinition> = { geoDistance: geoDistanceFn, geoBox: geoBoxFn, geoPolygon: geoPolygonFn, geoContainsPoint: geoContainsPointFn }; export function initFunction({ node, variables, type_config }: { node: FunctionNode, variables?: xLuceneVariables, type_config: xLuceneTypeConfig, }): FunctionMethods { const fnType = xLuceneFunctions[node.name] as FunctionDefinition|undefined; if (fnType == null) { throw new Error(`Could not find an xLucene function with name "${name}"`); } return fnType.create({ type_config, node, variables: variables ?? {} }); }
import { xLuceneTypeConfig, xLuceneVariables } from '@terascope/types'; import geoBoxFn from './geo/box'; import geoDistanceFn from './geo/distance'; import geoPolygonFn from './geo/polygon'; import geoContainsPointFn from './geo/contains-point'; import { FunctionDefinition, FunctionMethods, FunctionNode } from '../interfaces'; export enum xLuceneFunction { geoDistance = 'geoDistance', geoBox = 'geoBox', geoPolygon = 'geoPolygon', geoContainsPoint = 'geoContainsPoint', } export const xLuceneFunctions: Record<xLuceneFunction, FunctionDefinition> = { geoDistance: geoDistanceFn, geoBox: geoBoxFn, geoPolygon: geoPolygonFn, geoContainsPoint: geoContainsPointFn }; export function initFunction({ node, variables, type_config }: { node: FunctionNode, variables?: xLuceneVariables, type_config: xLuceneTypeConfig, }): FunctionMethods { const fnType = xLuceneFunctions[node.name] as FunctionDefinition|undefined; if (fnType == null) { throw new TypeError(`Unknown xLucene function "${node.name}"`); } return fnType.create({ type_config, node, variables: variables ?? {} }); }
Fix unknown xLucene function error
Fix unknown xLucene function error
TypeScript
apache-2.0
terascope/teraslice,terascope/teraslice,terascope/teraslice,terascope/teraslice
--- +++ @@ -26,7 +26,7 @@ }): FunctionMethods { const fnType = xLuceneFunctions[node.name] as FunctionDefinition|undefined; if (fnType == null) { - throw new Error(`Could not find an xLucene function with name "${name}"`); + throw new TypeError(`Unknown xLucene function "${node.name}"`); } return fnType.create({
a985dda35dc605e345656bd0db6aa3413c79bd82
src/app/editor/modal-maps-list/filtermaps.pipe.ts
src/app/editor/modal-maps-list/filtermaps.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; import { OptionMap } from "../../map/map"; @Pipe({name: 'filterMaps'}) export class FilterMapsPipe implements PipeTransform { transform(maps: OptionMap[], query: string, activePage: number): OptionMap[] { const filteredMaps = maps .filter( m => { if (m.title === undefined){ m.title = ""; } if (m.uid === undefined){ m.uid = -1; } return m.title.toLowerCase().includes(query.toLowerCase()) || m.uid.toString().includes(query); } ); return filteredMaps; } }
import { Pipe, PipeTransform } from '@angular/core'; import { OptionMap } from "../../map/map"; @Pipe({name: 'filterMaps'}) export class FilterMapsPipe implements PipeTransform { transform(maps: OptionMap[], query: string, activePage: number): OptionMap[] { const filteredMaps = maps .filter( m => { if (m.title === undefined){ m.title = ""; } if (m.uid === undefined){ m.uid = -1; } return m.title.toString().toLowerCase().includes(query.toLowerCase()) || m.uid.toString().includes(query); } ); return filteredMaps; } }
Fix if title is numeric
Fix if title is numeric
TypeScript
mit
ABAPlan/abaplan-core,ABAPlan/abaplan-core,ABAPlan/abaplan-core
--- +++ @@ -14,7 +14,7 @@ if (m.uid === undefined){ m.uid = -1; } - return m.title.toLowerCase().includes(query.toLowerCase()) || m.uid.toString().includes(query); + return m.title.toString().toLowerCase().includes(query.toLowerCase()) || m.uid.toString().includes(query); } );
0dcd6d314bc4849983e21ae835c967d952dbcb9e
src/lib/log.ts
src/lib/log.ts
/** * Simple logging system */ import { format } from 'util'; export function debug(...args: any[]) { return _debug(...args); } export function die(...args: any[]) { error(...args).then(() => { process.exit(1); }); } export function error(...args: any[]) { return log(...args); } export function log(...args: any[]) { const time = new Date().toLocaleTimeString('en-US', { hour12: false }); return new Promise(resolve => { process.stderr.write(`${time} ${format.apply(null, args)}\n`, resolve); }); } export function print(message: Buffer | string) { if (typeof message !== 'string') { message = message.toString('utf8'); } return new Promise(resolve => { process.stdout.write(message, resolve); }); } let _debug = (..._args: any[]) => { return Promise.resolve<{}>(null); }; if (process.env['VIM_TSS_LOG']) { const verbosity = Number(process.env['VIM_TSS_LOG']); if (verbosity > 0) { _debug = log; } }
/** * Simple logging system */ import { format } from 'util'; export function debug(...args: any[]) { return _debug(...args); } export function die(...args: any[]) { error(...args).then(() => { process.exit(1); }); } export function error(...args: any[]) { return log('Error:', ...args); } export function log(...args: any[]) { const time = new Date().toLocaleTimeString('en-US', { hour12: false }); return new Promise(resolve => { process.stderr.write(`${time} ${format.apply(null, args)}\n`, resolve); }); } export function print(message: Buffer | string) { if (typeof message !== 'string') { message = message.toString('utf8'); } return new Promise(resolve => { process.stdout.write(message, resolve); }); } let _debug = (..._args: any[]) => { return Promise.resolve<{}>(null); }; if (process.env['VIM_TSS_LOG']) { const verbosity = Number(process.env['VIM_TSS_LOG']); if (verbosity > 0) { _debug = log; } }
Add 'Error:' to CLI error messages
Add 'Error:' to CLI error messages
TypeScript
mit
jason0x43/vim-tss
--- +++ @@ -15,7 +15,7 @@ } export function error(...args: any[]) { - return log(...args); + return log('Error:', ...args); } export function log(...args: any[]) {
d7be8867581c6582e54f911073a65a362b7f4ece
src/navigation/breadcrumbs/breadcrumbs-service.ts
src/navigation/breadcrumbs/breadcrumbs-service.ts
export default class BreadcrumbsService { constructor() { this._handlers = []; this._items = []; this._activeItem = ''; } listen(handler) { this._handlers.push(handler); return () => { this._handlers.splice(this._handlers.indexOf(handler), 1); }; } _notify() { this._handlers.forEach(handler => handler()); } get items() { return this._items; } set items(items) { this._items = items; this._notify(); } get activeItem() { return this._activeItem; } set activeItem(item) { this._activeItem = item; this._notify(); } }
export default class BreadcrumbsService { private _handlers = []; private _items = []; private _activeItem = ''; listen(handler) { this._handlers.push(handler); return () => { this._handlers.splice(this._handlers.indexOf(handler), 1); }; } _notify() { this._handlers.forEach(handler => handler()); } get items() { return this._items; } set items(items) { this._items = items; this._notify(); } get activeItem() { return this._activeItem; } set activeItem(item) { this._activeItem = item; this._notify(); } }
Fix TypeScript compilation error in BreadcrumbsService.
Fix TypeScript compilation error in BreadcrumbsService.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -1,9 +1,7 @@ export default class BreadcrumbsService { - constructor() { - this._handlers = []; - this._items = []; - this._activeItem = ''; - } + private _handlers = []; + private _items = []; + private _activeItem = ''; listen(handler) { this._handlers.push(handler);
65d2d8bb6734c22270de847f6ba6f838879de931
vscode/init.ts
vscode/init.ts
// @ts-ignore: ignore vscode module import import { extensions, ExtensionContext } from 'vscode'; // @ts-ignore: ignore Path module import import * as path from 'path'; // @ts-ignore: ignore child_process module import import { exec } from 'child_process'; // Export full list of installed extensions function exportExtensions(): void { exec(path.join('~', 'dotfiles', 'setup', 'export_vscode_extensions.sh')); } // Install synced extensions not already installed on this machine function installLatestExtensions(): void { exec(path.join('~', 'dotfiles', 'setup', 'install_vscode_extensions.sh')); } export function init(context: ExtensionContext): void { // Detect when an extension is installed, uninstalled, enabled, or disabled extensions.onDidChange(() => exportExtensions()); // installLatestExtensions(); }
// @ts-ignore: ignore vscode import import { ExtensionContext } from 'vscode'; export function init(context: ExtensionContext): void { // Do nothing for now }
Undo broken extension sync functionality
Undo broken extension sync functionality
TypeScript
mit
caleb531/dotfiles,caleb531/dotfiles,caleb531/dotfiles,caleb531/dotfiles
--- +++ @@ -1,23 +1,6 @@ -// @ts-ignore: ignore vscode module import -import { extensions, ExtensionContext } from 'vscode'; -// @ts-ignore: ignore Path module import -import * as path from 'path'; -// @ts-ignore: ignore child_process module import -import { exec } from 'child_process'; - -// Export full list of installed extensions -function exportExtensions(): void { - exec(path.join('~', 'dotfiles', 'setup', 'export_vscode_extensions.sh')); -} - - -// Install synced extensions not already installed on this machine -function installLatestExtensions(): void { - exec(path.join('~', 'dotfiles', 'setup', 'install_vscode_extensions.sh')); -} +// @ts-ignore: ignore vscode import +import { ExtensionContext } from 'vscode'; export function init(context: ExtensionContext): void { - // Detect when an extension is installed, uninstalled, enabled, or disabled - extensions.onDidChange(() => exportExtensions()); - // installLatestExtensions(); + // Do nothing for now }
1cecdfe5b4bd211967f2fe28c0194190e1317978
ui/src/components/Footer.tsx
ui/src/components/Footer.tsx
import React, {FunctionComponent} from 'react' export const Footer: FunctionComponent = () => { return ( <div id="footer"> <hr /> Lovingly crafted by{' '} <a href="http://github.com/coddingtonbear">Adam Coddington</a> and others. See our <a href="/privacy-policy">Privacy Policy</a> and{' '} <a href="/terms-of-service">Terms of Service</a>. <br /> Questions? Ask on{' '} <a href="https://gitter.im/coddingtonbear/inthe.am">Gitter</a>. <a href="http://github.com/coddingtonbear/inthe.am"> Contribute to this project on Github </a> . </div> ) } export default Footer
import React, {FunctionComponent} from 'react' import {Link} from 'react-router-dom' export const Footer: FunctionComponent = () => { return ( <div id="footer"> <hr /> Lovingly crafted by{' '} <a href="http://github.com/coddingtonbear">Adam Coddington</a> and others. See our <Link to="/privacy-policy">Privacy Policy</Link> and{' '} <Link to="/terms-of-service">Terms of Service</Link>. <br /> Questions? Ask on{' '} <a href="https://gitter.im/coddingtonbear/inthe.am">Gitter</a>. <a href="http://github.com/coddingtonbear/inthe.am"> Contribute to this project on Github </a> . </div> ) } export default Footer
Use in-page linking to get to TOS and PP.
Use in-page linking to get to TOS and PP.
TypeScript
agpl-3.0
coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am,coddingtonbear/inthe.am
--- +++ @@ -1,4 +1,5 @@ import React, {FunctionComponent} from 'react' +import {Link} from 'react-router-dom' export const Footer: FunctionComponent = () => { return ( @@ -6,8 +7,8 @@ <hr /> Lovingly crafted by{' '} <a href="http://github.com/coddingtonbear">Adam Coddington</a> and others. - See our <a href="/privacy-policy">Privacy Policy</a> and{' '} - <a href="/terms-of-service">Terms of Service</a>. + See our <Link to="/privacy-policy">Privacy Policy</Link> and{' '} + <Link to="/terms-of-service">Terms of Service</Link>. <br /> Questions? Ask on{' '} <a href="https://gitter.im/coddingtonbear/inthe.am">Gitter</a>.
8421e7800feff33466426920807893d38b52c77b
lib/core-server/src/utils/get-manager-builder.ts
lib/core-server/src/utils/get-manager-builder.ts
import path from 'path'; import { getInterpretedFile, serverRequire, Options } from '@storybook/core-common'; export async function getManagerBuilder(configDir: Options['configDir']) { const main = path.resolve(configDir, 'main'); const mainFile = getInterpretedFile(main); const { core } = mainFile ? serverRequire(mainFile) : { core: null }; const builderPackage = core?.builder === 'webpack5' ? '@storybook/manager-webpack5' : '@storybook/manager-webpack4'; const managerBuilder = await import(builderPackage); return managerBuilder; }
import path from 'path'; import { getInterpretedFile, serverRequire, Options } from '@storybook/core-common'; export async function getManagerBuilder(configDir: Options['configDir']) { const main = path.resolve(configDir, 'main'); const mainFile = getInterpretedFile(main); const { core } = mainFile ? serverRequire(mainFile) : { core: null }; const builderPackage = core?.builder === 'webpack5' ? require.resolve('@storybook/manager-webpack5', { paths: [main] }) : '@storybook/manager-webpack4'; const managerBuilder = await import(builderPackage); return managerBuilder; }
Resolve configured manager builder relative to user's project
Resolve configured manager builder relative to user's project
TypeScript
mit
storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -7,7 +7,9 @@ const { core } = mainFile ? serverRequire(mainFile) : { core: null }; const builderPackage = - core?.builder === 'webpack5' ? '@storybook/manager-webpack5' : '@storybook/manager-webpack4'; + core?.builder === 'webpack5' + ? require.resolve('@storybook/manager-webpack5', { paths: [main] }) + : '@storybook/manager-webpack4'; const managerBuilder = await import(builderPackage); return managerBuilder;
84255a5d1cb94d38e3ac1ce47ede5e276f8b381c
src/reactors/launch/launch-type-for-action.ts
src/reactors/launch/launch-type-for-action.ts
import { join } from "path"; import butler from "../../util/butler"; import { devNull } from "../../logger"; import Context from "../../context"; export type LaunchType = "native" | "html" | "external" | "native" | "shell"; export default async function launchTypeForAction( ctx: Context, appPath: string, actionPath: string, ): Promise<LaunchType> { if (/\.(app|exe|bat|sh)$/i.test(actionPath)) { return "native"; } if (/\.html?$/i.test(actionPath)) { return "html"; } if (/^https?:/i.test(actionPath)) { return "external"; } const fullPath = join(appPath, actionPath); const confRes = await butler.configureSingle({ path: fullPath, logger: devNull, ctx, }); if (!confRes) { return "shell"; } switch (confRes.flavor) { case "windows": case "windows-script": case "macos": case "linux": case "app-macos": return "native"; default: return "shell"; } }
import butler from "../../util/butler"; import { devNull } from "../../logger"; import Context from "../../context"; import expandManifestPath from "./expand-manifest-path"; export type LaunchType = "native" | "html" | "external" | "native" | "shell"; export default async function launchTypeForAction( ctx: Context, appPath: string, actionPath: string, ): Promise<LaunchType> { if (/^https?:/i.test(actionPath)) { return "external"; } const fullPath = expandManifestPath(appPath, actionPath); const confRes = await butler.configureSingle({ path: fullPath, logger: devNull, ctx, }); if (!confRes) { return "shell"; } switch (confRes.flavor) { case "windows": case "windows-script": case "macos": case "linux": case "app-macos": return "native"; case "html": return "html"; default: return "shell"; } }
Fix {{EXT}} usage in manifests
Fix {{EXT}} usage in manifests
TypeScript
mit
itchio/itch,itchio/itch,itchio/itchio-app,itchio/itch,itchio/itch,leafo/itchio-app,itchio/itchio-app,leafo/itchio-app,itchio/itch,leafo/itchio-app,itchio/itchio-app,itchio/itch
--- +++ @@ -1,7 +1,7 @@ -import { join } from "path"; import butler from "../../util/butler"; import { devNull } from "../../logger"; import Context from "../../context"; +import expandManifestPath from "./expand-manifest-path"; export type LaunchType = "native" | "html" | "external" | "native" | "shell"; @@ -10,19 +10,11 @@ appPath: string, actionPath: string, ): Promise<LaunchType> { - if (/\.(app|exe|bat|sh)$/i.test(actionPath)) { - return "native"; - } - - if (/\.html?$/i.test(actionPath)) { - return "html"; - } - if (/^https?:/i.test(actionPath)) { return "external"; } - const fullPath = join(appPath, actionPath); + const fullPath = expandManifestPath(appPath, actionPath); const confRes = await butler.configureSingle({ path: fullPath, @@ -40,6 +32,8 @@ case "linux": case "app-macos": return "native"; + case "html": + return "html"; default: return "shell"; }
99597bdce5e5c4ddf5abc330bdd7d2b58fb7aabf
packages/delir/domain/Renderer/operations.ts
packages/delir/domain/Renderer/operations.ts
import { operation } from '@ragg/fleur' import { remote } from 'electron' import { join } from 'path' import * as EditorOps from '../Editor/operations' import { RendererActions } from './actions' import FSPluginLoader from './FSPluginLoader' export const loadPlugins = operation(async (context) => { const userDir = remote.app.getPath('appData') const loader = new FSPluginLoader() const loaded = [ // await loader.loadPackageDir(join(remote.app.getAppPath(), '/plugins')), await loader.loadPackageDir(join(userDir, '/delir/plugins')), ] const successes = [].concat(...loaded.map<any>(({loaded}) => loaded)) const fails = [].concat(...loaded.map<any>(({failed}) => failed)) if (fails.length > 0) { const failedPlugins = fails.map((fail: any) => fail.package).join(', ') const message = fails.map((fail: any) => fail.reason).join('\n\n') await context.executeOperation(EditorOps.notify, { message: `${failedPlugins}`, title: `Failed to load ${fails.length} plugins`, level: 'error', timeout: 5000, detail: message, }) } __DEV__ && console.log('Plugin loaded', successes, 'Failed:', fails) context.dispatch(RendererActions.addPlugins, { plugins: successes }) }) export const setPreviewCanvas = operation((context, arg: { canvas: HTMLCanvasElement }) => { context.dispatch(RendererActions.setPreviewCanvas, arg) })
import { operation } from '@ragg/fleur' import { remote } from 'electron' import { join } from 'path' import * as EditorOps from '../Editor/operations' import { RendererActions } from './actions' import FSPluginLoader from './FSPluginLoader' export const loadPlugins = operation(async (context) => { const userDir = remote.app.getPath('appData') const loader = new FSPluginLoader() const loaded = [ await (__DEV__ ? loader.loadPackageDir(join((global as any).__dirname, '../plugins')) : []), await loader.loadPackageDir(join(userDir, '/delir/plugins')), ] const successes = [].concat(...loaded.map<any>(({loaded}) => loaded)) const fails = [].concat(...loaded.map<any>(({failed}) => failed)) if (fails.length > 0) { const failedPlugins = fails.map((fail: any) => fail.package).join(', ') const message = fails.map((fail: any) => fail.reason).join('\n\n') await context.executeOperation(EditorOps.notify, { message: `${failedPlugins}`, title: `Failed to load ${fails.length} plugins`, level: 'error', timeout: 5000, detail: message, }) } __DEV__ && console.log('Plugin loaded', successes, 'Failed:', fails) context.dispatch(RendererActions.addPlugins, { plugins: successes }) }) export const setPreviewCanvas = operation((context, arg: { canvas: HTMLCanvasElement }) => { context.dispatch(RendererActions.setPreviewCanvas, arg) })
Enable to load plugin in development
Enable to load plugin in development
TypeScript
mit
Ragg-/Delir,Ragg-/Delir,Ragg-/Delir,Ragg-/Delir
--- +++ @@ -11,7 +11,7 @@ const loader = new FSPluginLoader() const loaded = [ - // await loader.loadPackageDir(join(remote.app.getAppPath(), '/plugins')), + await (__DEV__ ? loader.loadPackageDir(join((global as any).__dirname, '../plugins')) : []), await loader.loadPackageDir(join(userDir, '/delir/plugins')), ]
5d6a98827d8676deee126d757b08b3dbeae7526b
test/setup.ts
test/setup.ts
import * as jsdom from "jsdom"; declare var global: any; const exposedProperties = ["window", "navigator", "document"]; const doc = jsdom.jsdom("<!doctype html><html><body></body></html>"); global.document = doc; global.window = doc.defaultView; Object.keys(document.defaultView).forEach((property: string) => { if (typeof global[property] === "undefined") { exposedProperties.push(property); global[property] = document.defaultView[<any>property]; } }); global.navigator = { userAgent: "node.js" };
import * as jsdom from "jsdom"; import { XMLHttpRequest } from "xmlhttprequest"; declare var global: any; const exposedProperties = ["window", "navigator", "document"]; const doc = jsdom.jsdom("<!doctype html><html><body></body></html>", { virtualConsole: jsdom.createVirtualConsole().sendTo(console), }); global.document = doc; global.window = doc.defaultView; // fix the XMLHttpRequest API implementation global.window.XMLHttpRequest = XMLHttpRequest; Object.keys(document.defaultView).forEach((property: string) => { if (typeof global[property] === "undefined") { exposedProperties.push(property); global[property] = document.defaultView[<any>property]; } }); global.navigator = { userAgent: "node.js" };
Replace jsdom XMLHttpRequest implementation and link Node and jsdom consoles.
Replace jsdom XMLHttpRequest implementation and link Node and jsdom consoles.
TypeScript
mit
Josh-ES/react-here-maps,Josh-ES/react-here-maps
--- +++ @@ -1,13 +1,19 @@ import * as jsdom from "jsdom"; +import { XMLHttpRequest } from "xmlhttprequest"; declare var global: any; const exposedProperties = ["window", "navigator", "document"]; -const doc = jsdom.jsdom("<!doctype html><html><body></body></html>"); +const doc = jsdom.jsdom("<!doctype html><html><body></body></html>", { + virtualConsole: jsdom.createVirtualConsole().sendTo(console), +}); global.document = doc; global.window = doc.defaultView; + +// fix the XMLHttpRequest API implementation +global.window.XMLHttpRequest = XMLHttpRequest; Object.keys(document.defaultView).forEach((property: string) => { if (typeof global[property] === "undefined") {
78e93a3a0fe6a7b2b722deb1ade83cfa424db681
public/app/core/components/Tooltip/Popper.tsx
public/app/core/components/Tooltip/Popper.tsx
import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; interface Props { renderContent: (content: any) => any; show: boolean; placement?: any; content: string | ((props: any) => JSX.Element); refClassName?: string; } class Popper extends PureComponent<Props> { render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; return ( <Manager> <Reference> {({ ref }) => ( <div className={`popper_ref ${refClassName || ''}`} ref={ref}> {children} </div> )} </Reference> {show && ( <ReactPopper placement={placement}> {({ ref, style, placement, arrowProps }) => { return ( <div ref={ref} style={style} data-placement={placement} className="popper"> <div className="popper__background"> {renderContent(content)} <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> </div> </div> ); }} </ReactPopper> )} </Manager> ); } } export default Popper;
import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; import Transition from 'react-transition-group/Transition'; const defaultTransitionStyles = { transition: 'opacity 200ms linear', opacity: 0, }; const transitionStyles = { exited: { opacity: 0 }, entering: { opacity: 0 }, entered: { opacity: 1 }, exiting: { opacity: 0 }, }; interface Props { renderContent: (content: any) => any; show: boolean; placement?: any; content: string | ((props: any) => JSX.Element); refClassName?: string; } class Popper extends PureComponent<Props> { render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; return ( <Manager> <Reference> {({ ref }) => ( <div className={`popper_ref ${refClassName || ''}`} ref={ref}> {children} </div> )} </Reference> <Transition in={show} timeout={100}> {transitionState => ( <ReactPopper placement={placement}> {({ ref, style, placement, arrowProps }) => { return ( <div ref={ref} style={{ ...style, ...defaultTransitionStyles, ...transitionStyles[transitionState], }} data-placement={placement} className="popper" > <div className="popper__background"> {renderContent(content)} <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> </div> </div> ); }} </ReactPopper> )} </Transition> </Manager> ); } } export default Popper;
Add fade in transition to tooltip
panel-header: Add fade in transition to tooltip
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -1,5 +1,18 @@ import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; +import Transition from 'react-transition-group/Transition'; + +const defaultTransitionStyles = { + transition: 'opacity 200ms linear', + opacity: 0, +}; + +const transitionStyles = { + exited: { opacity: 0 }, + entering: { opacity: 0 }, + entered: { opacity: 1 }, + exiting: { opacity: 0 }, +}; interface Props { renderContent: (content: any) => any; @@ -13,6 +26,7 @@ render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; + return ( <Manager> <Reference> @@ -22,20 +36,31 @@ </div> )} </Reference> - {show && ( - <ReactPopper placement={placement}> - {({ ref, style, placement, arrowProps }) => { - return ( - <div ref={ref} style={style} data-placement={placement} className="popper"> - <div className="popper__background"> - {renderContent(content)} - <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> + <Transition in={show} timeout={100}> + {transitionState => ( + <ReactPopper placement={placement}> + {({ ref, style, placement, arrowProps }) => { + return ( + <div + ref={ref} + style={{ + ...style, + ...defaultTransitionStyles, + ...transitionStyles[transitionState], + }} + data-placement={placement} + className="popper" + > + <div className="popper__background"> + {renderContent(content)} + <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> + </div> </div> - </div> - ); - }} - </ReactPopper> - )} + ); + }} + </ReactPopper> + )} + </Transition> </Manager> ); }
715a3359c7ed33ec17f2bc1ca2a7698cce1315d5
APM/src/app/app.component.ts
APM/src/app/app.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'pm-root', template: ` <div> <h1>{{pageTitle}}</h1> <pm-products></pm-products> </div> ` }) export class AppComponent { pageTitle: string = 'Acme Product Management'; }
import { Component } from '@angular/core'; @Component({ selector: 'pm-root', template: ` <div> <h1>{{pageTitle}}</h1> <pm-products></pm-products> </div> ` }) export class AppComponent { pageTitle: string = 'Acmeh Product Management'; }
Test commit for new username
Test commit for new username
TypeScript
mit
GugaGongadze/Angular-GettingStarted,GugaGongadze/Angular-GettingStarted,GugaGongadze/Angular-GettingStarted
--- +++ @@ -11,5 +11,5 @@ }) export class AppComponent { - pageTitle: string = 'Acme Product Management'; + pageTitle: string = 'Acmeh Product Management'; }
6678a73ea74d0cea54ad50f4b9e82ecf8535f639
app/src/lib/feature-flag.ts
app/src/lib/feature-flag.ts
const Disable = false /** * Enables the application to opt-in for preview features based on runtime * checks. This is backed by the GITHUB_DESKTOP_PREVIEW_FEATURES environment * variable, which is checked for non-development environments. */ function enableDevelopmentFeatures(): boolean { if (Disable) { return false } if (__DEV__) { return true } if (process.env.GITHUB_DESKTOP_PREVIEW_FEATURES === '1') { return true } return false } /** Should the app enable beta features? */ function enableBetaFeatures(): boolean { return enableDevelopmentFeatures() || __RELEASE_CHANNEL__ === 'beta' } /** Should merge tool integration be enabled? */ export function enableMergeTool(): boolean { return enableDevelopmentFeatures() } export function enableCompareSidebar(): boolean { return true }
const Disable = false /** * Enables the application to opt-in for preview features based on runtime * checks. This is backed by the GITHUB_DESKTOP_PREVIEW_FEATURES environment * variable, which is checked for non-development environments. */ function enableDevelopmentFeatures(): boolean { if (Disable) { return false } if (__DEV__) { return true } if (process.env.GITHUB_DESKTOP_PREVIEW_FEATURES === '1') { return true } return false } /** Should the app enable beta features? */ function enableBetaFeatures(): boolean { return enableDevelopmentFeatures() || __RELEASE_CHANNEL__ === 'beta' } /** Should merge tool integration be enabled? */ export function enableMergeTool(): boolean { return enableDevelopmentFeatures() } /** Should the new Compare view be enabled? */ export function enableCompareSidebar(): boolean { return true }
Document the function that does the same thing the last one did
Document the function that does the same thing the last one did
TypeScript
mit
kactus-io/kactus,desktop/desktop,shiftkey/desktop,kactus-io/kactus,say25/desktop,shiftkey/desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,say25/desktop,artivilla/desktop,desktop/desktop,shiftkey/desktop,artivilla/desktop,say25/desktop,j-f1/forked-desktop,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,desktop/desktop,j-f1/forked-desktop,desktop/desktop,j-f1/forked-desktop,say25/desktop
--- +++ @@ -31,6 +31,7 @@ return enableDevelopmentFeatures() } +/** Should the new Compare view be enabled? */ export function enableCompareSidebar(): boolean { return true }
c66d734667d5c5eb911469f70b665c4434f9c92b
app/src/services/EnvService.ts
app/src/services/EnvService.ts
/* * The MIT License (MIT) * Copyright (c) 2016 Heat Ledger Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ enum EnvType { NODEJS, BROWSER } @Service('env') class EnvService { public type: EnvType; constructor() { try { if (typeof window['require'] == 'function' && window['require']('child_process')) { this.type = EnvType.NODEJS; } else { this.type = EnvType.BROWSER; } } catch (e) { this.type = EnvType.BROWSER; } } }
/* * The MIT License (MIT) * Copyright (c) 2016 Heat Ledger Ltd. * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ enum EnvType { NODEJS, BROWSER } @Service('env') class EnvService { public type: EnvType; constructor() { try { if (typeof window['require'] == 'function' && window['require']('child_process')) { require('ssl-root-cas').inject(); this.type = EnvType.NODEJS; } else { this.type = EnvType.BROWSER; } } catch (e) { this.type = EnvType.BROWSER; } } }
Load ssl root certs on nodejs detection
Load ssl root certs on nodejs detection
TypeScript
mit
Heat-Ledger-Ltd/heat-ui,Heat-Ledger-Ltd/heat-ui,Heat-Ledger-Ltd/heat-ui
--- +++ @@ -30,6 +30,7 @@ constructor() { try { if (typeof window['require'] == 'function' && window['require']('child_process')) { + require('ssl-root-cas').inject(); this.type = EnvType.NODEJS; } else {
87a841e7c77f0ebf42ab161540290b0b873f8074
app/src/ui/notification/new-commits-banner.tsx
app/src/ui/notification/new-commits-banner.tsx
import * as React from 'react' import { ButtonGroup } from '../lib/button-group' import { Button } from '../lib/button' import { Ref } from '../lib/ref' import { Octicon, OcticonSymbol } from '../octicons' import { Branch } from '../../models/branch' interface INewCommitsBannerProps { /** * The number of commits behind `branch` */ readonly commitsBehind: number /** * The target branch that will accept commits * from the current branch */ readonly baseBranch: Branch readonly onCompareClicked: () => void readonly onMergeClicked: () => void } /** * Banner used to notify user that there branch is _commitsBehind_ * commits behind `branch` */ export class NewCommitsBanner extends React.Component< INewCommitsBannerProps, {} > { public render() { return ( <div className="notification-banner diverge-banner"> <div className="notification-banner-content"> <p> Your branch is <strong>{this.props.commitsBehind} commits</strong>{' '} behind <Ref>{this.props.baseBranch.name}</Ref> </p> <a className="close" aria-label="Dismiss banner"> <Octicon symbol={OcticonSymbol.x} /> </a> </div> <ButtonGroup> <Button type="submit" onClick={this.props.onCompareClicked}> Compare </Button> <Button onClick={this.props.onMergeClicked}>Merge...</Button> </ButtonGroup> </div> ) } }
import * as React from 'react' import { ButtonGroup } from '../lib/button-group' import { Button } from '../lib/button' import { Ref } from '../lib/ref' import { Octicon, OcticonSymbol } from '../octicons' import { Branch } from '../../models/branch' interface INewCommitsBannerProps { /** * The number of commits behind `branch` */ readonly commitsBehindBaseBranch: number /** * The target branch that will accept commits * from the current branch */ readonly baseBranch: Branch readonly onCompareClicked: () => void readonly onMergeClicked: () => void } /** * Banner used to notify user that there branch is _commitsBehind_ * commits behind `branch` */ export class NewCommitsBanner extends React.Component< INewCommitsBannerProps, {} > { public render() { return ( <div className="notification-banner diverge-banner"> <div className="notification-banner-content"> <p> Your branch is <strong>{this.props.commitsBehindBaseBranch} commits</strong>{' '} behind <Ref>{this.props.baseBranch.name}</Ref> </p> <a className="close" aria-label="Dismiss banner"> <Octicon symbol={OcticonSymbol.x} /> </a> </div> <ButtonGroup> <Button type="submit" onClick={this.props.onCompareClicked}> Compare </Button> <Button onClick={this.props.onMergeClicked}>Merge...</Button> </ButtonGroup> </div> ) } }
Add just a bit more context to the prop name
Add just a bit more context to the prop name
TypeScript
mit
artivilla/desktop,say25/desktop,j-f1/forked-desktop,say25/desktop,say25/desktop,shiftkey/desktop,j-f1/forked-desktop,kactus-io/kactus,desktop/desktop,kactus-io/kactus,artivilla/desktop,j-f1/forked-desktop,shiftkey/desktop,j-f1/forked-desktop,artivilla/desktop,shiftkey/desktop,desktop/desktop,kactus-io/kactus,desktop/desktop,artivilla/desktop,say25/desktop,kactus-io/kactus,shiftkey/desktop,desktop/desktop
--- +++ @@ -9,7 +9,7 @@ /** * The number of commits behind `branch` */ - readonly commitsBehind: number + readonly commitsBehindBaseBranch: number /** * The target branch that will accept commits @@ -33,7 +33,7 @@ <div className="notification-banner diverge-banner"> <div className="notification-banner-content"> <p> - Your branch is <strong>{this.props.commitsBehind} commits</strong>{' '} + Your branch is <strong>{this.props.commitsBehindBaseBranch} commits</strong>{' '} behind <Ref>{this.props.baseBranch.name}</Ref> </p>
07d3e2e31e70ec533ff2a0e176aebda6484a7b59
adapter/adapter-ts.ts
adapter/adapter-ts.ts
// Target interface Print { printWeak(): string; printStrong(): string; } // Adaptee class Banner { private banner: string; constructor(banner: string) { this.banner = banner; } printWithParen(): string { return `(${this.banner})`; } printWithAster(): string { return `*${this.banner}*`; } } // Adapter class PrintBanner extends Banner implements Print { constructor(banner: string) { super(banner); } printWeak() { return super.printWithParen(); } printStrong() { return super.printWithAster(); } } // Client const pb: PrintBanner = new PrintBanner('12V'); pb.printStrong(); pb.printWeak();
// Target interface Print { printWeak(): string; printStrong(): string; } // Adaptee class Banner { private banner: string; constructor(banner: string) { this.banner = banner; } printWithParen(): string { return `(${this.banner})`; } printWithAster(): string { return `*${this.banner}*`; } } // Adapter class PrintBanner extends Banner implements Print { constructor(banner: string) { super(banner); } printWeak() { return super.printWithParen(); } printStrong() { return super.printWithAster(); } } /*class PrintBanner implements Print { private banner: Banner; constructor(banner: Banner) { this.banner = banner; } printWeak(): string { return this.banner.printWithParen(); } printStrong(): string { return this.banner.printWithParen(); } }*/ // Client const pb: PrintBanner = new PrintBanner('12V'); pb.printStrong(); pb.printWeak();
Add one more implementation for adapter pattern
Add one more implementation for adapter pattern
TypeScript
mit
Erichain/design-patterns-in-typescript,Erichain/design-patterns-in-typescript
--- +++ @@ -36,6 +36,22 @@ } } +/*class PrintBanner implements Print { + private banner: Banner; + + constructor(banner: Banner) { + this.banner = banner; + } + + printWeak(): string { + return this.banner.printWithParen(); + } + + printStrong(): string { + return this.banner.printWithParen(); + } +}*/ + // Client const pb: PrintBanner = new PrintBanner('12V'); pb.printStrong();
178516d06f507a2bf7f2c97af41e1e64fb000ff4
packages/ivi-test/src/dom.ts
packages/ivi-test/src/dom.ts
import { VNode, render, update } from "ivi"; import { triggerNextTick, triggerNextFrame } from "./scheduler"; import { reset } from "./reset"; import { VNodeWrapper } from "./vdom"; let _container: HTMLDivElement | null = null; export class DOMRenderer { private container: HTMLDivElement; constructor(container: HTMLDivElement) { this.container = container; } render(vnode: VNode<any>): VNodeWrapper { render(vnode, this.container); return new VNodeWrapper(vnode, null, {}); } update(): void { update(); } nextTick(): void { triggerNextTick(); } nextFrame(time?: number): void { triggerNextFrame(time); } } export function initDOMRenderer(): DOMRenderer { if (_container === null) { _container = document.createElement("div"); _container.className = "ivi-dom-test-container"; document.body.appendChild(_container); } else { _container.innerText = ""; } reset(); return new DOMRenderer(_container); }
import { VNode, render, update } from "ivi"; import { triggerNextTick, triggerNextFrame } from "./scheduler"; import { reset } from "./reset"; import { VNodeWrapper } from "./vdom"; let _container: HTMLDivElement | null = null; /** * DOMRenderer is a helper object for testing Virtual DOM in a real DOM. */ export class DOMRenderer { private container: HTMLDivElement; constructor(container: HTMLDivElement) { this.container = container; } /** * render renders a VNode in a test container and returns a VNodeWrapper object. * * @param vnode VNode. * @returns VNodeWrapper object. */ render(vnode: VNode<any>): VNodeWrapper { render(vnode, this.container); return new VNodeWrapper(vnode, null, {}); } /** * update triggers update in a scheduler. */ update(): void { update(); } /** * nextTick triggers next tick in a scheduler and execute all microtasks, tasks and frame updates. */ nextTick(): void { triggerNextTick(); } /** * nextFrame triggers next frame in a scheduler and executal all frame updates. * * @param time Current time. */ nextFrame(time?: number): void { triggerNextFrame(time); } } /** * initDOMRenderer instantiates and initializes DOMRenderer object. * * @returns DOMRenderer. */ export function initDOMRenderer(): DOMRenderer { if (_container === null) { _container = document.createElement("div"); _container.className = "ivi-dom-test-container"; document.body.appendChild(_container); } else { _container.innerText = ""; } reset(); return new DOMRenderer(_container); }
Add comments in ivi-test package
Add comments in ivi-test package
TypeScript
mit
ivijs/ivi,ivijs/ivi
--- +++ @@ -5,6 +5,9 @@ let _container: HTMLDivElement | null = null; +/** + * DOMRenderer is a helper object for testing Virtual DOM in a real DOM. + */ export class DOMRenderer { private container: HTMLDivElement; @@ -12,24 +15,46 @@ this.container = container; } + /** + * render renders a VNode in a test container and returns a VNodeWrapper object. + * + * @param vnode VNode. + * @returns VNodeWrapper object. + */ render(vnode: VNode<any>): VNodeWrapper { render(vnode, this.container); return new VNodeWrapper(vnode, null, {}); } + /** + * update triggers update in a scheduler. + */ update(): void { update(); } + /** + * nextTick triggers next tick in a scheduler and execute all microtasks, tasks and frame updates. + */ nextTick(): void { triggerNextTick(); } + /** + * nextFrame triggers next frame in a scheduler and executal all frame updates. + * + * @param time Current time. + */ nextFrame(time?: number): void { triggerNextFrame(time); } } +/** + * initDOMRenderer instantiates and initializes DOMRenderer object. + * + * @returns DOMRenderer. + */ export function initDOMRenderer(): DOMRenderer { if (_container === null) { _container = document.createElement("div");
4fe9e9368ad35b205038ccf4836fc4319975dd98
app/util/list-util.ts
app/util/list-util.ts
/** * @author Daniel de Oliveira */ export class ListUtil { /** * Generate a new list with elements which are contained in l but not in r */ public static subtract(l: string[], r: string[]): string[] { return l.filter(item => r.indexOf(item) === -1); } public static add(list: string[], item: string): string[] { return (list.indexOf(item) > -1) ? list : list.concat([item]); } public static remove(list: string[], item: string): string[] { const _list = list.slice(0); const index: number = _list.indexOf(item); if (index == -1) return _list; _list.splice(index, 1); return _list; } }
/** * @author Daniel de Oliveira */ export class ListUtil { /** * Generate a new list with elements which are contained in l but not in r */ public static subtract(l: string[], r: string[]): string[] { return l.filter(item => r.indexOf(item) === -1); } public static add(list: string[], item: string): string[] { return (list.indexOf(item) > -1) ? list : list.concat([item]); } public static remove(list: string[], item: string): string[] { return list.filter(itm => itm != item); } }
Make short and side effect free
Make short and side effect free
TypeScript
apache-2.0
codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client
--- +++ @@ -20,10 +20,6 @@ public static remove(list: string[], item: string): string[] { - const _list = list.slice(0); - const index: number = _list.indexOf(item); - if (index == -1) return _list; - _list.splice(index, 1); - return _list; + return list.filter(itm => itm != item); } }
acb3b52acf600cd127a068f00b62386134c0ab2f
applications/mail/src/app/components/message/extras/calendar/ExtraEventSummary.tsx
applications/mail/src/app/components/message/extras/calendar/ExtraEventSummary.tsx
import { RequireSome } from '@proton/shared/lib/interfaces/utils'; import { InvitationModel } from '../../../../helpers/calendar/invite'; import { getAttendeeSummaryText, getHasBeenUpdatedText, getOrganizerSummaryText, } from '../../../../helpers/calendar/summary'; export const getSummaryContent = (firstLine?: string, secondLine?: string) => { if (!firstLine && !secondLine) { return null; } const content = firstLine && secondLine ? ( <> <span>{firstLine}</span> <span>{secondLine}</span> </> ) : ( <span>{firstLine || secondLine}</span> ); return <div className="mt0-5 mb0-5 rounded bordered bg-weak p0-5 flex flex-column">{content}</div>; }; interface Props { model: RequireSome<InvitationModel, 'invitationIcs'>; } const ExtraEventSummary = ({ model }: Props) => { const { isImport, hideSummary, isOrganizerMode, isPartyCrasher } = model; const summaryText = isOrganizerMode ? getOrganizerSummaryText(model) : getAttendeeSummaryText(model); const hasBeenUpdatedText = getHasBeenUpdatedText(model); if (isImport || hideSummary || isPartyCrasher || !summaryText) { return null; } return getSummaryContent(hasBeenUpdatedText, summaryText); }; export default ExtraEventSummary;
import { RequireSome } from '@proton/shared/lib/interfaces/utils'; import { InvitationModel } from '../../../../helpers/calendar/invite'; import { getAttendeeSummaryText, getHasBeenUpdatedText, getOrganizerSummaryText, } from '../../../../helpers/calendar/summary'; export const getSummaryContent = (firstLine?: string, secondLine?: string) => { if (!firstLine && !secondLine) { return null; } const content = firstLine && secondLine ? ( <> <span>{firstLine}</span> <span>{secondLine}</span> </> ) : ( <span>{firstLine || secondLine}</span> ); return <div className="mt0-5 mb0-5 rounded bordered bg-weak p0-5 flex flex-column text-break">{content}</div>; }; interface Props { model: RequireSome<InvitationModel, 'invitationIcs'>; } const ExtraEventSummary = ({ model }: Props) => { const { isImport, hideSummary, isOrganizerMode, isPartyCrasher } = model; const summaryText = isOrganizerMode ? getOrganizerSummaryText(model) : getAttendeeSummaryText(model); const hasBeenUpdatedText = getHasBeenUpdatedText(model); if (isImport || hideSummary || isPartyCrasher || !summaryText) { return null; } return getSummaryContent(hasBeenUpdatedText, summaryText); }; export default ExtraEventSummary;
Add text-break class to the ics widget summary to handle long contact names
Add text-break class to the ics widget summary to handle long contact names CALWEB-2880
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -20,7 +20,7 @@ <span>{firstLine || secondLine}</span> ); - return <div className="mt0-5 mb0-5 rounded bordered bg-weak p0-5 flex flex-column">{content}</div>; + return <div className="mt0-5 mb0-5 rounded bordered bg-weak p0-5 flex flex-column text-break">{content}</div>; }; interface Props {
095c26b18ce0038a5893637dd7222b149e5641dd
test/setup.ts
test/setup.ts
/// <reference path="./types/index.d.ts" /> import expect = require('expect.js'); import * as assert from 'assert'; import * as tsr from '../src/index'; import * as util from './util'; global.expect = expect; global.assert = assert; global.tsr = tsr; global.util = util;
/// <reference path="./types/globals.d.ts" /> import expect = require('expect.js'); import * as assert from 'assert'; import * as tsr from '../src/index'; import * as util from './util'; global.expect = expect; global.assert = assert; global.tsr = tsr; global.util = util;
Fix loading types in test environment
Fix loading types in test environment
TypeScript
mit
fabiandev/ts-runtime,fabiandev/ts-runtime,fabiandev/ts-runtime
--- +++ @@ -1,4 +1,4 @@ -/// <reference path="./types/index.d.ts" /> +/// <reference path="./types/globals.d.ts" /> import expect = require('expect.js'); import * as assert from 'assert';
3270f35ffb5241c2af5dd13bb413bfae2c63bdef
src/v2/Apps/Consign/Components/ConsignMeta.tsx
src/v2/Apps/Consign/Components/ConsignMeta.tsx
import React from "react" import { Link, Meta, Title } from "react-head" import { getENV } from "v2/Utils/getENV" export const ConsignMeta: React.FC = () => { const title = `WIP Consign Title | Artsy` // FIXME: Need real title const href = `${getENV("APP_URL")}/consign2` // FIXME: consign2 const metaDescription = "WIP" const metaImage = null // FIXME: Need image for embeds return ( <> <Title>{title}</Title> <Meta property="og:title" content={title} /> {metaDescription && ( <> <Meta name="description" content={metaDescription} /> <Meta property="og:description" content={metaDescription} /> <Meta property="twitter:description" content={metaDescription} /> </> )} <Link rel="canonical" href={href} /> <Meta property="og:url" content={href} /> <Meta property="og:type" content="website" /> <Meta property="twitter:card" content="summary" /> {metaImage && <Meta property="og:image" content={metaImage.src} />} </> ) }
import React from "react" import { Link, Meta, Title } from "react-head" import { getENV } from "v2/Utils/getENV" export const ConsignMeta: React.FC = () => { const title = `Sell Artwork with Artsy | Art Consignment | Artsy` const href = `${getENV("APP_URL")}/consign2` // FIXME: consign2 const metaDescription = "Sell and consign your art with Artsy. Get competitive offers from the world’s top auction houses and galleries to sell art from your collection. Submit today at no cost." const metaImage = null // FIXME: Need image for embeds return ( <> <Title>{title}</Title> <Meta property="og:title" content={title} /> {metaDescription && ( <> <Meta name="description" content={metaDescription} /> <Meta property="og:description" content={metaDescription} /> <Meta property="twitter:description" content={metaDescription} /> </> )} <Link rel="canonical" href={href} /> <Meta property="og:url" content={href} /> <Meta property="og:type" content="website" /> <Meta property="twitter:card" content="summary" /> {metaImage && <Meta property="og:image" content={metaImage.src} />} </> ) }
Update title and meta description for /consign2
Update title and meta description for /consign2
TypeScript
mit
joeyAghion/force,artsy/force,joeyAghion/force,joeyAghion/force,joeyAghion/force,artsy/force-public,artsy/force,artsy/force-public,artsy/force,artsy/force
--- +++ @@ -3,9 +3,10 @@ import { getENV } from "v2/Utils/getENV" export const ConsignMeta: React.FC = () => { - const title = `WIP Consign Title | Artsy` // FIXME: Need real title + const title = `Sell Artwork with Artsy | Art Consignment | Artsy` const href = `${getENV("APP_URL")}/consign2` // FIXME: consign2 - const metaDescription = "WIP" + const metaDescription = + "Sell and consign your art with Artsy. Get competitive offers from the world’s top auction houses and galleries to sell art from your collection. Submit today at no cost." const metaImage = null // FIXME: Need image for embeds return (
99c4c75dfc396ca4aae26c16ea977e1765c25a89
react-redux-todos/src/containers/FilterLink.ts
react-redux-todos/src/containers/FilterLink.ts
import { connect } from 'react-redux' import { Dispatch } from 'redux' import { createSetVisibilityFilter } from '../actions/createSetVisibilityFilter' import { Filter } from '../model/Filter' import { Link } from '../components/Link' import { RootStore } from '../model/RootStore' interface StateProps { active: boolean } interface DispatchProps { onClick: () => void } interface OwnProps { filter: Filter } interface LinkPropTypes { active: boolean, children: React.ReactChildren, onClick: () => void } interface MergedProps { active: boolean, filter: Filter, onClick: () => void } const mapStateToProps = (state: RootStore, ownProps: OwnProps): StateProps => { return { active: ownProps.filter === state.visibilityFilter } } const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: OwnProps): DispatchProps => { return { onClick: () => { dispatch(createSetVisibilityFilter(ownProps.filter)) } } } // TODO: Add types to the connect method: TStateProps, TDispatchProps, TOwnProps and maybe also TMergedProps. Adding the merged properties might fix the build issue in Link.tsx. // tslint:disable-next-line variable-name export const FilterLink = connect<StateProps, DispatchProps, OwnProps, LinkPropTypes>( mapStateToProps, mapDispatchToProps )(Link)
import { connect } from 'react-redux' import { Dispatch } from 'redux' import { createSetVisibilityFilter } from '../actions/createSetVisibilityFilter' import { Filter } from '../model/Filter' import { Link } from '../components/Link' import { RootStore } from '../model/RootStore' interface StateProps { active: boolean } interface DispatchProps { onClick: () => void } interface OwnProps { filter: Filter } const mapStateToProps = (state: RootStore, ownProps: OwnProps): StateProps => { return { active: ownProps.filter === state.visibilityFilter } } const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: OwnProps): DispatchProps => { return { onClick: () => { dispatch(createSetVisibilityFilter(ownProps.filter)) } } } // TODO: 'as any' is required to make it build. Hopefully this will soon get fixed, so it's no longer necessary. // tslint:disable-next-line variable-name export const FilterLink = connect( mapStateToProps, mapDispatchToProps )(Link) as any
Fix the build and clean up
Fix the build and clean up
TypeScript
unlicense
janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations
--- +++ @@ -18,18 +18,6 @@ filter: Filter } -interface LinkPropTypes { - active: boolean, - children: React.ReactChildren, - onClick: () => void -} - -interface MergedProps { - active: boolean, - filter: Filter, - onClick: () => void -} - const mapStateToProps = (state: RootStore, ownProps: OwnProps): StateProps => { return { active: ownProps.filter === state.visibilityFilter @@ -44,9 +32,9 @@ } } -// TODO: Add types to the connect method: TStateProps, TDispatchProps, TOwnProps and maybe also TMergedProps. Adding the merged properties might fix the build issue in Link.tsx. +// TODO: 'as any' is required to make it build. Hopefully this will soon get fixed, so it's no longer necessary. // tslint:disable-next-line variable-name -export const FilterLink = connect<StateProps, DispatchProps, OwnProps, LinkPropTypes>( +export const FilterLink = connect( mapStateToProps, mapDispatchToProps -)(Link) +)(Link) as any
ca7d4d6c176b7c52ff0c224d3baf804c6e047b6a
react-redux-todos/src/containers/FilterLink.ts
react-redux-todos/src/containers/FilterLink.ts
import { connect } from 'react-redux' import { Dispatch } from 'redux' import { createSetVisibilityFilter } from '../actions/createSetVisibilityFilter' import { Filter } from '../model/Filter' import { Link } from '../components/Link' import { RootStore } from '../model/RootStore' interface OwnProps { filter: Filter } const mapStateToProps = (state: RootStore, ownProps: OwnProps) => { return { active: ownProps.filter === state.visibilityFilter } } const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: OwnProps) => { return { onClick: () => { dispatch(createSetVisibilityFilter(ownProps.filter)) } } } // tslint:disable-next-line variable-name export const FilterLink = connect( mapStateToProps, mapDispatchToProps )(Link)
import { connect } from 'react-redux' import { Dispatch } from 'redux' import { createSetVisibilityFilter } from '../actions/createSetVisibilityFilter' import { Filter } from '../model/Filter' import { Link } from '../components/Link' import { RootStore } from '../model/RootStore' interface FilterLinkProps { filter: Filter } const mapStateToProps = (state: RootStore, ownProps: FilterLinkProps) => { return { active: ownProps.filter === state.visibilityFilter } } const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: FilterLinkProps) => { return { onClick: () => { dispatch(createSetVisibilityFilter(ownProps.filter)) } } } // tslint:disable-next-line variable-name export const FilterLink = connect( mapStateToProps, mapDispatchToProps )(Link)
Use more explicit name for properties
Use more explicit name for properties
TypeScript
unlicense
janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations
--- +++ @@ -6,17 +6,17 @@ import { Link } from '../components/Link' import { RootStore } from '../model/RootStore' -interface OwnProps { +interface FilterLinkProps { filter: Filter } -const mapStateToProps = (state: RootStore, ownProps: OwnProps) => { +const mapStateToProps = (state: RootStore, ownProps: FilterLinkProps) => { return { active: ownProps.filter === state.visibilityFilter } } -const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: OwnProps) => { +const mapDispatchToProps = (dispatch: Dispatch<RootStore>, ownProps: FilterLinkProps) => { return { onClick: () => { dispatch(createSetVisibilityFilter(ownProps.filter))
4f75e0306d28d91c1d2dda36a6dd286862a61be2
src/property-decorators/logger.ts
src/property-decorators/logger.ts
export interface LoggerPropertyOptions { getter?: boolean; prefix?: string; setter?: boolean; } export function LoggerProperty(loggerOptions?: LoggerPropertyOptions) { const getter = (loggerOptions && 'getter' in loggerOptions) ? !!loggerOptions.getter : true; const prefix = (loggerOptions && loggerOptions.prefix) ? (loggerOptions.prefix + ' ') : ''; const setter = (loggerOptions && 'setter' in loggerOptions) ? !!loggerOptions.setter : true; return function(target: Object, propertyKey: string | symbol) { let value = target[propertyKey]; Reflect.deleteProperty[propertyKey]; Reflect.defineProperty(target, propertyKey, { get: () => { if(getter) console.log(`${prefix}Getting value for field "${propertyKey}":`, value); return value; }, set: (val) => { if(setter) console.log(`${prefix}Setting value for field "${propertyKey}":`, val); value = val; } }); } }
export interface LoggerPropertyOptions { /** Flag to log property accesses (getter) */ getter?: boolean; /** String to prepend to the log trace */ prefix?: string; /** Flag to log property assignments (setter) */ setter?: boolean; } /** * Decorator to log property accesses (getters and/or setters) * * @export * @param {LoggerPropertyOptions} [loggerOptions] * @returns */ export function LoggerProperty(loggerOptions?: LoggerPropertyOptions) { const getter = (loggerOptions && 'getter' in loggerOptions) ? !!loggerOptions.getter : true; const prefix = (loggerOptions && loggerOptions.prefix) ? (loggerOptions.prefix + ' ') : ''; const setter = (loggerOptions && 'setter' in loggerOptions) ? !!loggerOptions.setter : true; return function(target: Object, propertyKey: string | symbol) { let value = target[propertyKey]; Reflect.deleteProperty[propertyKey]; Reflect.defineProperty(target, propertyKey, { get: () => { if(getter) console.log(`${prefix}Getting value for field "${propertyKey}":`, value); return value; }, set: (val) => { if(setter) console.log(`${prefix}Setting value for field "${propertyKey}":`, val); value = val; } }); } }
Update decorator comments (interface and function)
Update decorator comments (interface and function)
TypeScript
mit
semagarcia/typescript-decorators,semagarcia/typescript-decorators
--- +++ @@ -1,9 +1,21 @@ export interface LoggerPropertyOptions { + /** Flag to log property accesses (getter) */ getter?: boolean; + + /** String to prepend to the log trace */ prefix?: string; + + /** Flag to log property assignments (setter) */ setter?: boolean; } +/** + * Decorator to log property accesses (getters and/or setters) + * + * @export + * @param {LoggerPropertyOptions} [loggerOptions] + * @returns + */ export function LoggerProperty(loggerOptions?: LoggerPropertyOptions) { const getter = (loggerOptions && 'getter' in loggerOptions) ? !!loggerOptions.getter : true; const prefix = (loggerOptions && loggerOptions.prefix) ? (loggerOptions.prefix + ' ') : '';
f492d18cf2fe51d7615ecaea65b98b4b068e4780
src/pages/groupComparison/ClinicalDataUtils.ts
src/pages/groupComparison/ClinicalDataUtils.ts
import { getServerConfig } from 'config/config'; export function getComparisonCategoricalNaValue(): string[] { const rawString = getServerConfig().comparison_categorical_na_values; const naValues = rawString.split(','); return naValues; }
import { getServerConfig } from 'config/config'; const NA_VALUES_DELIMITER = '|'; export function getComparisonCategoricalNaValue(): string[] { const rawString = getServerConfig().comparison_categorical_na_values; const naValues = rawString.split(NA_VALUES_DELIMITER); return naValues; }
Change comparison page na category delimiter
Change comparison page na category delimiter
TypeScript
agpl-3.0
cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,alisman/cbioportal-frontend
--- +++ @@ -1,7 +1,9 @@ import { getServerConfig } from 'config/config'; + +const NA_VALUES_DELIMITER = '|'; export function getComparisonCategoricalNaValue(): string[] { const rawString = getServerConfig().comparison_categorical_na_values; - const naValues = rawString.split(','); + const naValues = rawString.split(NA_VALUES_DELIMITER); return naValues; }
423483b825a2505384f2c18a251d787eaf6534fd
packages/common/modules/i18n/index.native.ts
packages/common/modules/i18n/index.native.ts
import i18n from 'i18next'; import * as Expo from 'expo'; import { reactI18nextModule } from 'react-i18next'; import settings from '../../../../settings'; import { addResourcesI18n } from '../../utils'; import modules from '..'; const languageDetector = { type: 'languageDetector', async: true, // flags below detection to be async detect: async (callback: (lang: string) => string) => { const lng = await Expo.SecureStore.getItemAsync('i18nextLng'); return callback(lng || (await (Expo as any).Localization.getCurrentLocaleAsync()).replace('_', '-')); }, init: () => {}, cacheUserLanguage: async (lng: string) => { Expo.SecureStore.setItemAsync('i18nextLng', lng); } }; if (settings.i18n.enabled) { i18n .use(languageDetector) .use(reactI18nextModule) .init({ fallbackLng: settings.i18n.fallbackLng, resources: {}, debug: false, // set true to show logs whitelist: settings.i18n.langList, interpolation: { escapeValue: false // not needed for react!! }, react: { wait: false } }); process.nextTick(() => { addResourcesI18n(i18n, modules.localizations); }); } export default {};
import i18n from 'i18next'; import * as Expo from 'expo'; import { reactI18nextModule } from 'react-i18next'; import settings from '../../../../settings'; import { addResourcesI18n } from '../../utils'; import modules from '..'; const languageDetector = { type: 'languageDetector', async: true, // flags below detection to be async detect: async (callback: (lang: string) => string) => { const lng = await Expo.SecureStore.getItemAsync('i18nextLng'); return callback(lng || (await (Expo as any).Localization.getLocalizationAsync()).locale.replace('_', '-')); }, init: () => {}, cacheUserLanguage: async (lng: string) => { Expo.SecureStore.setItemAsync('i18nextLng', lng); } }; if (settings.i18n.enabled) { i18n .use(languageDetector) .use(reactI18nextModule) .init({ fallbackLng: settings.i18n.fallbackLng, resources: {}, debug: false, // set true to show logs whitelist: settings.i18n.langList, interpolation: { escapeValue: false // not needed for react!! }, react: { wait: false } }); process.nextTick(() => { addResourcesI18n(i18n, modules.localizations); }); } export default {};
Use new Expo API to get current locale
Use new Expo API to get current locale Fixes: #904
TypeScript
mit
sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit
--- +++ @@ -11,7 +11,7 @@ async: true, // flags below detection to be async detect: async (callback: (lang: string) => string) => { const lng = await Expo.SecureStore.getItemAsync('i18nextLng'); - return callback(lng || (await (Expo as any).Localization.getCurrentLocaleAsync()).replace('_', '-')); + return callback(lng || (await (Expo as any).Localization.getLocalizationAsync()).locale.replace('_', '-')); }, init: () => {}, cacheUserLanguage: async (lng: string) => {
f779d76ed73db107c45271ff1ee12f6a62a636bf
react-json-pretty/index.d.ts
react-json-pretty/index.d.ts
// Type definitions for react-json-pretty 1.3 // Project: https://github.com/chenckang/react-json-pretty // Definitions by: Karol Janyst <https://github.com/LKay> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { ComponentClass, HTMLProps } from "react"; export as namespace JSONPretty; export = JSONPretty; declare const JSONPretty: JSONPretty; type JSONPretty = ComponentClass<JSONPretty.JSONPrettyProps>; declare namespace JSONPretty { export interface JSONPrettyProps extends HTMLProps<JSONPretty> { json: {} | string; } }
// Type definitions for react-json-pretty 1.3 // Project: https://github.com/chenckang/react-json-pretty // Definitions by: Karol Janyst <https://github.com/LKay> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 import { ComponentClass, HTMLProps } from "react"; export as namespace JSONPretty; export = JSONPretty; declare const JSONPretty: JSONPretty; type JSONPretty = ComponentClass<JSONPretty.JSONPrettyProps>; declare namespace JSONPretty { export interface JSONPrettyProps extends HTMLProps<JSONPretty> { json: {} | string; } }
Set target compiler to 2.1
Set target compiler to 2.1
TypeScript
mit
aciccarello/DefinitelyTyped,AgentME/DefinitelyTyped,YousefED/DefinitelyTyped,minodisk/DefinitelyTyped,magny/DefinitelyTyped,johan-gorter/DefinitelyTyped,dsebastien/DefinitelyTyped,johan-gorter/DefinitelyTyped,aciccarello/DefinitelyTyped,minodisk/DefinitelyTyped,AgentME/DefinitelyTyped,abbasmhd/DefinitelyTyped,YousefED/DefinitelyTyped,benliddicott/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,abbasmhd/DefinitelyTyped,jimthedev/DefinitelyTyped,zuzusik/DefinitelyTyped,isman-usoh/DefinitelyTyped,arusakov/DefinitelyTyped,jimthedev/DefinitelyTyped,smrq/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,zuzusik/DefinitelyTyped,ashwinr/DefinitelyTyped,QuatroCode/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,mcrawshaw/DefinitelyTyped,arusakov/DefinitelyTyped,georgemarshall/DefinitelyTyped,benishouga/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,alexdresko/DefinitelyTyped,rolandzwaga/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,markogresak/DefinitelyTyped,QuatroCode/DefinitelyTyped,mcrawshaw/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,progre/DefinitelyTyped,nycdotnet/DefinitelyTyped,one-pieces/DefinitelyTyped,benishouga/DefinitelyTyped,nycdotnet/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,benishouga/DefinitelyTyped,zuzusik/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,progre/DefinitelyTyped,jimthedev/DefinitelyTyped,amir-arad/DefinitelyTyped,chrootsu/DefinitelyTyped,mcliment/DefinitelyTyped,arusakov/DefinitelyTyped,AgentME/DefinitelyTyped,smrq/DefinitelyTyped,isman-usoh/DefinitelyTyped,borisyankov/DefinitelyTyped,ashwinr/DefinitelyTyped,alexdresko/DefinitelyTyped,rolandzwaga/DefinitelyTyped,chrootsu/DefinitelyTyped
--- +++ @@ -2,6 +2,7 @@ // Project: https://github.com/chenckang/react-json-pretty // Definitions by: Karol Janyst <https://github.com/LKay> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import { ComponentClass, HTMLProps } from "react";
a7c0819fcc14e82b5d43a9a41a946d6ec5ff6627
test/interactions/theme_colors/theme_colors_test.ts
test/interactions/theme_colors/theme_colors_test.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {assert} from 'chai'; import {$$, waitFor} from '../../shared/helper.js'; import {loadComponentDocExample} from '../helpers/shared.js'; async function getListOfColorsFromList(selector: string) { await waitFor(`${selector} li`); const codeBlocks = await $$(`${selector} li code`); const variableNames = await Promise.all(codeBlocks.map(async block => { const text = await block.evaluate(code => (code as HTMLElement).innerText); return text.split(':')[0]; })); return variableNames; } describe('theme colors', () => { it('lists the colors in both light and dark mode', async () => { await loadComponentDocExample('theme_colors/basic.html'); const lightModeVariables = await getListOfColorsFromList('.light-mode'); const darkModeVariables = await getListOfColorsFromList('.dark-mode'); assert.lengthOf(lightModeVariables, 18); assert.deepEqual(lightModeVariables, darkModeVariables); }); });
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {assert} from 'chai'; import {$$, waitFor} from '../../shared/helper.js'; import {loadComponentDocExample} from '../helpers/shared.js'; async function getListOfColorsFromList(selector: string) { await waitFor(`${selector} li`); const codeBlocks = await $$(`${selector} li code`); const variableNames = await Promise.all(codeBlocks.map(async block => { const text = await block.evaluate(code => (code as HTMLElement).innerText); return text.split(':')[0]; })); return variableNames; } describe('theme colors', () => { it('lists the colors in both light and dark mode', async () => { await loadComponentDocExample('theme_colors/basic.html'); const lightModeVariables = await getListOfColorsFromList('.light-mode'); const darkModeVariables = await getListOfColorsFromList('.dark-mode'); assert.strictEqual(lightModeVariables[0], '--color-primary'); assert.deepEqual(lightModeVariables, darkModeVariables); }); });
Fix failing theme_color interaction test
Fix failing theme_color interaction test This test was failing as we have added more colors. This doesn't yet matter as these tests are yet to run on CQ, but they will soon! [email protected] Change-Id: I7f1d709a0fbdc3c2d8b23f345a720cad9eb2d8d9 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2571125 Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Jack Franklin <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -21,7 +21,7 @@ await loadComponentDocExample('theme_colors/basic.html'); const lightModeVariables = await getListOfColorsFromList('.light-mode'); const darkModeVariables = await getListOfColorsFromList('.dark-mode'); - assert.lengthOf(lightModeVariables, 18); + assert.strictEqual(lightModeVariables[0], '--color-primary'); assert.deepEqual(lightModeVariables, darkModeVariables); }); });
e7296892fed3ac93ea8ffe9f9680c78427563375
src/logger.ts
src/logger.ts
import chalk from 'chalk' export interface ILogger { log(...args: any[]): void warn(...args: any[]): void error(...args: any[]): void } export class Logger implements ILogger { public title(...args: any[]) { console.log(chalk.bold(...args)) } public log(...args: any[]) { console.log(...args) } public warn(...args: any[]) { console.warn(chalk.yellow(...args)) } public error(...args: any[]) { console.error(chalk.red(...args)) } }
import chalk from 'chalk' export interface ILogger { log(...args: any[]): void warn(...args: any[]): void error(...args: any[]): void } export class Logger implements ILogger { public log(...args: any[]) { console.log(...args) } public warn(...args: any[]) { console.warn(chalk.yellow(...args)) } public error(...args: any[]) { console.error(chalk.red(...args)) } }
Remove title method from Logger
Remove title method from Logger
TypeScript
mit
pawelgalazka/microcli,pawelgalazka/microcli
--- +++ @@ -7,9 +7,6 @@ } export class Logger implements ILogger { - public title(...args: any[]) { - console.log(chalk.bold(...args)) - } public log(...args: any[]) { console.log(...args) }