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
cf79ce75cd616e6cf9c43bd866d76c9ff6c6bea1
src/extension/utils/vscode/editor.ts
src/extension/utils/vscode/editor.ts
import * as vs from "vscode"; export function showCode(editor: vs.TextEditor, displayRange: vs.Range, highlightRange: vs.Range, selectionRange?: vs.Range): void { if (selectionRange) editor.selection = new vs.Selection(selectionRange.start, selectionRange.end); // Ensure the code is visible on screen. editor.revealRange(displayRange, vs.TextEditorRevealType.InCenterIfOutsideViewport); // Re-reveal the first line, to ensure it was always visible (eg. in case the main range was bigger than the screen). // Using .Default means it'll do as little scrolling as possible. editor.revealRange(new vs.Range(displayRange.start, displayRange.start), vs.TextEditorRevealType.Default); // TODO: Implement highlighting // See https://github.com/Microsoft/vscode/issues/45059 } class EnvUtils { public async openInBrowser(url: string): Promise<boolean> { return vs.env.openExternal(vs.Uri.parse(url)); } public async asExternalUri(uri: vs.Uri): Promise<vs.Uri> { // TODO: Remove this scheme mapping when https://github.com/microsoft/vscode/issues/84819 // is resolved. const scheme = uri.scheme; const fakeScheme = scheme === "ws" ? "http" : "https"; const mappedUri = await vs.env.asExternalUri(uri.with({ scheme: fakeScheme })); return mappedUri.with({ scheme }); } } export const envUtils = new EnvUtils();
import * as vs from "vscode"; export function showCode(editor: vs.TextEditor, displayRange: vs.Range, highlightRange: vs.Range, selectionRange?: vs.Range): void { if (selectionRange) editor.selection = new vs.Selection(selectionRange.start, selectionRange.end); // Ensure the code is visible on screen. editor.revealRange(displayRange, vs.TextEditorRevealType.InCenterIfOutsideViewport); // TODO: Implement highlighting // See https://github.com/Microsoft/vscode/issues/45059 } class EnvUtils { public async openInBrowser(url: string): Promise<boolean> { return vs.env.openExternal(vs.Uri.parse(url)); } public async asExternalUri(uri: vs.Uri): Promise<vs.Uri> { // TODO: Remove this scheme mapping when https://github.com/microsoft/vscode/issues/84819 // is resolved. const scheme = uri.scheme; const fakeScheme = scheme === "ws" ? "http" : "https"; const mappedUri = await vs.env.asExternalUri(uri.with({ scheme: fakeScheme })); return mappedUri.with({ scheme }); } } export const envUtils = new EnvUtils();
Remove workaround for VS Code issue that's now resolved
Remove workaround for VS Code issue that's now resolved
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -6,10 +6,6 @@ // Ensure the code is visible on screen. editor.revealRange(displayRange, vs.TextEditorRevealType.InCenterIfOutsideViewport); - - // Re-reveal the first line, to ensure it was always visible (eg. in case the main range was bigger than the screen). - // Using .Default means it'll do as little scrolling as possible. - editor.revealRange(new vs.Range(displayRange.start, displayRange.start), vs.TextEditorRevealType.Default); // TODO: Implement highlighting // See https://github.com/Microsoft/vscode/issues/45059
7c949f10ea177ce857a7902629dd22f649d9faff
app/src/lib/git/index.ts
app/src/lib/git/index.ts
export * from './apply' export * from './branch' export * from './checkout' export * from './clone' export * from './commit' export * from './config' export * from './core' export * from './description' export * from './diff' export * from './fetch' export * from './for-each-ref' export * from './index' export * from './init' export * from './log' export * from './pull' export * from './push' export * from './reflog' export * from './refs' export * from './remote' export * from './reset' export * from './rev-list' export * from './rev-parse' export * from './status' export * from './update-ref' export * from './var' export * from './merge' export * from './diff-index' export * from './checkout-index' export * from './revert' export * from './rm' export * from './submodule' export * from './interpret-trailers' export * from './gitignore' export * from './rebase' export * from './format-patch' export * from './worktree' export * from './tag'
export * from './apply' export * from './branch' export * from './checkout' export * from './clone' export * from './commit' export * from './config' export * from './core' export * from './description' export * from './diff' export * from './fetch' export * from './for-each-ref' export * from './init' export * from './log' export * from './pull' export * from './push' export * from './reflog' export * from './refs' export * from './remote' export * from './reset' export * from './rev-list' export * from './rev-parse' export * from './status' export * from './update-ref' export * from './var' export * from './merge' export * from './diff-index' export * from './checkout-index' export * from './revert' export * from './rm' export * from './submodule' export * from './interpret-trailers' export * from './gitignore' export * from './rebase' export * from './format-patch' export * from './worktree' export * from './tag'
Remove cyclic dependency that makes everything :fire:
Remove cyclic dependency that makes everything :fire:
TypeScript
mit
desktop/desktop,shiftkey/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,kactus-io/kactus,say25/desktop,kactus-io/kactus,say25/desktop,desktop/desktop,say25/desktop,kactus-io/kactus,artivilla/desktop,artivilla/desktop,artivilla/desktop,shiftkey/desktop,j-f1/forked-desktop,artivilla/desktop,kactus-io/kactus,say25/desktop,j-f1/forked-desktop,j-f1/forked-desktop,desktop/desktop,shiftkey/desktop
--- +++ @@ -9,7 +9,6 @@ export * from './diff' export * from './fetch' export * from './for-each-ref' -export * from './index' export * from './init' export * from './log' export * from './pull'
3a72c2099cf61dc26b96b6ab7bb3a3f29fed4d3f
src/assertion-error.ts
src/assertion-error.ts
interface IAssertionErrorOptions { message: string; expected?: Object; actual?: Object; showDiff?: boolean; } export default function ({ message, expected, actual, showDiff }: IAssertionErrorOptions): Error { const error = new Error(message); // Properties used by Mocha and other frameworks to show errors error['expected'] = expected; error['actual'] = actual; error['showDiff'] = showDiff; // Set the error name to an AssertionError error.name = 'AssertionError'; return error; }
export default function ({ message, expected, actual, showDiff }: { message: string; expected?: Object; actual?: Object; showDiff?: boolean; }): Error { const error = new Error(message); // Properties used by Mocha and other frameworks to show errors error['expected'] = expected; error['actual'] = actual; error['showDiff'] = showDiff; // Set the error name to an AssertionError error.name = 'AssertionError'; return error; }
Fix use of private interface
Fix use of private interface
TypeScript
mit
dylanparry/ceylon,dylanparry/ceylon
--- +++ @@ -1,11 +1,9 @@ -interface IAssertionErrorOptions { +export default function ({ message, expected, actual, showDiff }: { message: string; expected?: Object; actual?: Object; showDiff?: boolean; -} - -export default function ({ message, expected, actual, showDiff }: IAssertionErrorOptions): Error { +}): Error { const error = new Error(message); // Properties used by Mocha and other frameworks to show errors
b5044e0050a7bf238b6f7c643b189fe8d89d6166
src/app/shared/categories.ts
src/app/shared/categories.ts
import { Category } from './category.model'; export const CATEGORIES: Category[] = [ { "id": "AudioVideo", "name": "Audio & Video" }, { "id": "Development", "name": "Development" }, { "id": "Education", "name": "Education" }, { "id": "Game", "name": "Game" }, { "id": "Graphics", "name": "Graphics" }, { "id": "Network", "name": "Network" }, { "id": "Office", "name": "Office" }, { "id": "Science", "name": "Science" }, { "id": "Settings", "name": "Settings" }, { "id": "Utility", "name": "Utility" }, ];
import { Category } from './category.model'; export const CATEGORIES: Category[] = [ { "id": "AudioVideo", "name": "Audio & Video" }, { "id": "Development", "name": "Developer Tools" }, { "id": "Education", "name": "Education" }, { "id": "Game", "name": "Games" }, { "id": "Graphics", "name": "Graphics & Photography" }, { "id": "Network", "name": "Communication & News" }, { "id": "Office", "name": "Productivity" }, { "id": "Science", "name": "Science" }, { "id": "Settings", "name": "Settings" }, { "id": "Utility", "name": "Utilities" }, ];
Rename category names to use the same as Gnome Software
Rename category names to use the same as Gnome Software Fixes https://github.com/flathub/linux-store-frontend/issues/71
TypeScript
apache-2.0
jgarciao/linux-store-frontend,jgarciao/linux-store-frontend,jgarciao/linux-store-frontend
--- +++ @@ -7,7 +7,7 @@ }, { "id": "Development", - "name": "Development" + "name": "Developer Tools" }, { "id": "Education", @@ -15,19 +15,19 @@ }, { "id": "Game", - "name": "Game" + "name": "Games" }, { "id": "Graphics", - "name": "Graphics" + "name": "Graphics & Photography" }, { "id": "Network", - "name": "Network" + "name": "Communication & News" }, { "id": "Office", - "name": "Office" + "name": "Productivity" }, { "id": "Science", @@ -39,6 +39,6 @@ }, { "id": "Utility", - "name": "Utility" + "name": "Utilities" }, ];
15ba173abe2476cdc5d8f0d22f37430c18b95f6f
typings/webpack.d.ts
typings/webpack.d.ts
interface WebpackRequireEnsureCallback { (req: WebpackRequire): void } interface WebpackRequire { (id: string): any; (paths: string[], callback: (...modules: any[]) => void): void; ensure(ids: string[], callback: WebpackRequireEnsureCallback, chunkName?: string): Promise<void>; context(directory: string, useSubDirectories?: boolean, regExp?: RegExp): WebpackContext; } interface WebpackContext extends WebpackRequire { keys(): string[]; } declare var require: WebpackRequire; declare function $import<T>( path: string ): Promise<T>;
interface WebpackRequireEnsureCallback { (req: WebpackRequire): void } interface WebpackRequire { (id: string): any; (paths: string[], callback: (...modules: any[]) => void): void; ensure(ids: string[], callback: WebpackRequireEnsureCallback, chunkName?: string): Promise<void>; context(directory: string, useSubDirectories?: boolean, regExp?: RegExp): WebpackContext; } interface WebpackContext extends WebpackRequire { keys(): string[]; } declare var require: WebpackRequire; declare function $import( path: string ): Promise<any>;
Change $import typing to not be generic
Change $import typing to not be generic
TypeScript
mit
gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib
--- +++ @@ -14,4 +14,4 @@ } declare var require: WebpackRequire; -declare function $import<T>( path: string ): Promise<T>; +declare function $import( path: string ): Promise<any>;
08c446a8a68eb94afd5c8a01dae409e138da55e3
frontend/src/environments/environment.ts
frontend/src/environments/environment.ts
// The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. // The list of which env maps to which file can be found in `.angular-cli.json`. import {Environment} from './environment.model'; export const environment: Environment = { production: false, api: 'https://demo-tsmean.herokuapp.com/api/v1' // api: 'http://localhost:4242/api/v1' };
// The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. // The list of which env maps to which file can be found in `.angular-cli.json`. import {Environment} from './environment.model'; export const environment: Environment = { production: false, api: 'http://localhost:4242/api/v1', };
Fix env frontend dev config
Fix env frontend dev config
TypeScript
mit
tsmean/tsmean,tsmean/tsmean,tsmean/tsmean,tsmean/tsmean
--- +++ @@ -6,6 +6,5 @@ export const environment: Environment = { production: false, - api: 'https://demo-tsmean.herokuapp.com/api/v1' - // api: 'http://localhost:4242/api/v1' + api: 'http://localhost:4242/api/v1', };
a7b70ce21bd5b5856a497a101a37cb1cefc7bfd5
src/index.ts
src/index.ts
import { parse } from './ast'; import { emitString } from './emitter'; import { transform, TypeInjectorTransformer, FunctionBlockTransformer, MethodChainTransformer, AnonymousFunctionTransformer } from './transformers'; import * as fs from 'fs'; declare function require(name: string): any; declare var process: any; const util = require('util'); export const typewrite = (file: string, outputFilePath: string): void => { const result = getTypeWrittenString(file); fs.writeFileSync(outputFilePath, result); }; export const getTypeWrittenString = (file: string): string => { const { sourceFile, typeChecker } = parse([file]); const transformers = [ new FunctionBlockTransformer(), new AnonymousFunctionTransformer(typeChecker), new MethodChainTransformer(typeChecker), new TypeInjectorTransformer(typeChecker) ]; const transformedSourceFile = transform(sourceFile, transformers); return emitString(transformedSourceFile, { include_headers: '' }); };
import { parse } from './ast'; import { emitString } from './emitter'; import { transform, TypeInjectorTransformer, FunctionBlockTransformer, AnonymousFunctionTransformer } from './transformers'; import * as fs from 'fs'; declare function require(name: string): any; declare var process: any; const util = require('util'); export const typewrite = (file: string, outputFilePath: string): void => { const result = getTypeWrittenString(file); fs.writeFileSync(outputFilePath, result); }; export const getTypeWrittenString = (file: string): string => { const { sourceFile, typeChecker } = parse([file]); const transformers = [ new FunctionBlockTransformer(), new AnonymousFunctionTransformer(typeChecker), new TypeInjectorTransformer(typeChecker) ]; const transformedSourceFile = transform(sourceFile, transformers); return emitString(transformedSourceFile, { include_headers: '' }); };
Stop using method chain transformer
Stop using method chain transformer
TypeScript
mit
AmnisIO/typewriter,AmnisIO/typewriter,AmnisIO/typewriter
--- +++ @@ -4,7 +4,6 @@ transform, TypeInjectorTransformer, FunctionBlockTransformer, - MethodChainTransformer, AnonymousFunctionTransformer } from './transformers'; import * as fs from 'fs'; @@ -23,7 +22,6 @@ const transformers = [ new FunctionBlockTransformer(), new AnonymousFunctionTransformer(typeChecker), - new MethodChainTransformer(typeChecker), new TypeInjectorTransformer(typeChecker) ]; const transformedSourceFile = transform(sourceFile, transformers);
4ce4bcd77abc41dca870dcddfc12b4547e901b7d
src/app/states/devices/device-og-kit.ts
src/app/states/devices/device-og-kit.ts
import { AbstractDevice, DeviceParams, DeviceParamsModel, DeviceParamType, DeviceType, RawDevice } from './abstract-device'; import { _ } from '@biesbjerg/ngx-translate-extract/dist/utils/utils'; export class DeviceOGKit extends AbstractDevice { readonly deviceType = DeviceType.OGKit; apparatusVersion = DeviceType.OGKit; params: DeviceParams = { audioHits: true, visualHits: true }; paramsModel: DeviceParamsModel = { audioHits: { label: <string>_('SENSORS.PARAM.AUDIO_HITS'), type: DeviceParamType.Boolean }, visualHits: { label: <string>_('SENSORS.PARAM.VISUAL_HITS'), type: DeviceParamType.Boolean } }; constructor(rawDevice: RawDevice) { super(rawDevice); const manufacturerData = rawDevice.advertising instanceof ArrayBuffer ? new Uint8Array(rawDevice.advertising).slice(23, 29) : new Uint8Array(rawDevice.advertising.kCBAdvDataManufacturerData); this.apparatusId = new TextDecoder('utf8').decode(manufacturerData); } }
import { AbstractDevice, DeviceParams, DeviceParamsModel, DeviceParamType, DeviceType, RawDevice } from './abstract-device'; import { _ } from '@biesbjerg/ngx-translate-extract/dist/utils/utils'; export class DeviceOGKit extends AbstractDevice { readonly deviceType = DeviceType.OGKit; apparatusVersion = DeviceType.OGKit; params: DeviceParams = { audioHits: true, visualHits: true }; paramsModel: DeviceParamsModel = { audioHits: { label: <string>_('SENSORS.PARAM.AUDIO_HITS'), type: DeviceParamType.Boolean }, visualHits: { label: <string>_('SENSORS.PARAM.VISUAL_HITS'), type: DeviceParamType.Boolean } }; constructor(rawDevice: RawDevice) { super(rawDevice); const manufacturerData = rawDevice.advertising instanceof ArrayBuffer ? new Uint8Array(rawDevice.advertising).slice(23, 29) : new Uint8Array(rawDevice.advertising.kCBAdvDataManufacturerData); this.apparatusId = new TextDecoder('utf8').decode(manufacturerData).replace(/\0/g, ''); } }
Fix OGKit device id read on iOS
Fix OGKit device id read on iOS
TypeScript
apache-2.0
openradiation/openradiation-mobile,openradiation/openradiation-mobile,openradiation/openradiation-mobile,openradiation/openradiation-mobile
--- +++ @@ -33,6 +33,6 @@ rawDevice.advertising instanceof ArrayBuffer ? new Uint8Array(rawDevice.advertising).slice(23, 29) : new Uint8Array(rawDevice.advertising.kCBAdvDataManufacturerData); - this.apparatusId = new TextDecoder('utf8').decode(manufacturerData); + this.apparatusId = new TextDecoder('utf8').decode(manufacturerData).replace(/\0/g, ''); } }
51a09b7354ac0727e6da8e0f6cc00382d22faa41
packages/omi-cli/template/app-ts/src/index.tsx
packages/omi-cli/template/app-ts/src/index.tsx
import { tag, WeElement, render, h } from 'omi' import './hello-omi'; import * as logo from './omi.png'; interface AbcEvent extends Event { detail: { name: string; age: number; } } interface MyAppProps { name: string; } interface MyAppData { abc: string; passToChild: string; } @tag('my-app') class MyApp extends WeElement<MyAppProps, MyAppData> { static get data(): MyAppData { return { abc: '', passToChild: '' }; } /** * bind CustomEvent * @TODO @xcatliu @dntzhang It's hard to find the event data type */ onAbc = (evt: AbcEvent) => { // get evt data by evt.detail this.data.abc = ` by ${evt.detail.name}` this.update() } css() { return ` div { color: green; } ` } render() { console.log(logo); return ( <div> <img src={logo} /> Hello {this.props.name} {this.data.abc} <hello-omi onAbc={this.onAbc} prop-from-parent={this.data.passToChild} msg="Omi"></hello-omi> </div> ) } } render(<my-app name='Omi v4.0'></my-app>, '#root')
import { tag, WeElement, render, h } from 'omi' import './hello-omi'; import * as logo from './omi.png'; interface AbcEvent extends Event { detail: { name: string; age: number; } } interface MyAppProps { name: string; } interface MyAppData { abc: string; passToChild: string; } @tag('my-app') class MyApp extends WeElement<MyAppProps, MyAppData> { static get data(): MyAppData { return { abc: '', passToChild: '' }; } /** * bind CustomEvent * @TODO @xcatliu @dntzhang It's hard to find the event data type */ onAbc = (evt: AbcEvent) => { // get evt data by evt.detail this.data.abc = ` by ${evt.detail.name}` this.update() } css() { return ` div { color: green; } ` } render() { return ( <div> <img src={logo} /> Hello {this.props.name} {this.data.abc} <hello-omi onAbc={this.onAbc} prop-from-parent={this.data.passToChild} msg="Omi"></hello-omi> </div> ) } } render(<my-app name='Omi v4.0'></my-app>, '#root')
Remove useless console.log for omi-ts
Remove useless console.log for omi-ts
TypeScript
mit
AlloyTeam/Nuclear,AlloyTeam/Nuclear
--- +++ @@ -47,7 +47,6 @@ } render() { - console.log(logo); return ( <div> <img src={logo} />
28ff5e1e3fa570a1e80db17a9532dd1bac4f2bb4
src/types.ts
src/types.ts
export interface State { inputText: string alphabets: Array<Alphabet> } export interface Alphabet { priority: number letters: Array<Letter> } export interface Letter { value: string block: string } export interface ShermanLetter extends Letter { dots?: number vert?: number lines: number }
export interface State { inputText: string alphabets: Alphabet[] } export interface Alphabet { priority: number letters: Letter[] } export interface Letter { value: string block: string } export interface ShermanLetter extends Letter { dots?: number vert?: number lines: number }
Use the other, better array syntax
Use the other, better array syntax
TypeScript
mit
rossjrw/gallifreyo,rossjrw/gallifreyo,rossjrw/gallifreyo
--- +++ @@ -1,11 +1,11 @@ export interface State { inputText: string - alphabets: Array<Alphabet> + alphabets: Alphabet[] } export interface Alphabet { priority: number - letters: Array<Letter> + letters: Letter[] } export interface Letter {
d9d3661ff654e97a3f4052963797d4ed2a412eae
src/utils.ts
src/utils.ts
export default class Utils { public static getPlatformConfig(platformId: string): any { const config = require(`../platforms/${platformId}/config.json`); return config; } }
export default class Utils { public static getPlatformConfig(platformId: string): any { const config = require(`../platforms/${platformId}/config.json`); return config; } public static getTemplate(platformId: string, templateId: string, type: string): any { const config = require(`../platforms/${platformId}/templates/${templateId}/${type}.json`); return config; } }
Add helper function getTemplate to Utils
Add helper function getTemplate to Utils
TypeScript
mit
schulcloud/node-notification-service,schulcloud/node-notification-service,schulcloud/node-notification-service
--- +++ @@ -3,4 +3,9 @@ const config = require(`../platforms/${platformId}/config.json`); return config; } + + public static getTemplate(platformId: string, templateId: string, type: string): any { + const config = require(`../platforms/${platformId}/templates/${templateId}/${type}.json`); + return config; + } }
dd8d0ba0aeb6099e94af3fc27331485626344208
src/index.ts
src/index.ts
/** * @file The primary entry for Framewerk. * * @author Justin Toon * @license MIT * * @requires ./prototypes/fw.controller.js:Controller * @requires ./prototypes/fw.plugin.js:Plugin */ import { Controller, Plugin } from './prototypes'; interface ControllerList { [key: string]: () => Controller; } /** * A framework for managing scripting on top of server-rendered pages. * * @class Framewerk * @since 0.1.0 */ function fw(controllers: ControllerList, plugins: Plugin[]) { return { initialize }; //////////// /** * Initialize the Framewerk package. * * @since 0.1.0 */ function initialize() { const controllerKeys = Object.keys(controllers); if (controllerKeys.length) { controllerKeys.forEach(name => { controllers[name]().initialize(); }); } } } export { fw, Controller, Plugin };
/** * @file The primary entry for Framewerk. * * @author Justin Toon * @license MIT * * @requires ./prototypes/fw.controller.js:Controller * @requires ./prototypes/fw.plugin.js:Plugin */ import { Controller, Plugin } from './prototypes'; import { dataSelector } from './utils/fw.utils'; interface ControllerList { [key: string]: () => Controller; } /** * A framework for managing scripting on top of server-rendered pages. * * @class Framewerk * @since 0.1.0 */ function fw(controllers: ControllerList, plugins: Plugin[]) { return { initialize }; //////////// /** * Initialize the Framewerk package. * * @since 0.1.0 */ function initialize() { const controllerKeys = Object.keys(controllers); if (controllerKeys.length) { controllerKeys.forEach(name => { const selector = dataSelector('controller', name); const container = document.querySelector(selector); if (container) { controllers[name]().initialize(); } }); } } } export { fw, Controller, Plugin };
Check for data-controller presence before initializing
Check for data-controller presence before initializing
TypeScript
mit
overneath42/framewerk
--- +++ @@ -9,6 +9,7 @@ */ import { Controller, Plugin } from './prototypes'; +import { dataSelector } from './utils/fw.utils'; interface ControllerList { [key: string]: () => Controller; @@ -37,7 +38,12 @@ if (controllerKeys.length) { controllerKeys.forEach(name => { - controllers[name]().initialize(); + const selector = dataSelector('controller', name); + const container = document.querySelector(selector); + + if (container) { + controllers[name]().initialize(); + } }); } }
34b818bef0be07779e40f6bd359f6ccb07a0fbca
src/index.ts
src/index.ts
#!/usr/bin/env node console.log("vim-js-alternate: initialized"); import ProjectionLoader from "./ProjectionLoader"; import { ProjectionResolver } from "./ProjectionResolver"; var Vim = require("vim-node-driver"); var vim = new Vim(); var projectionLoader = new ProjectionLoader(); var projectionResolver = new ProjectionResolver(projectionLoader); var currentAlternateFile = null; vim.on("BufEnter", (args) => { var currentBuffer = args.currentBuffer; if(currentBuffer) { currentAlternateFile = projectionResolver.getAlternate(currentBuffer); console.log("Resolving projection for: " + currentBuffer + " | " + projectionResolver.getAlternate(currentBuffer)); } }); vim.addCommand("Alternate", () => { if(currentAlternateFile) vim.exec("edit " + currentAlternateFile) }); console.log("command registered")
#!/usr/bin/env node console.log("vim-js-alternate: initialized"); import ProjectionLoader from "./ProjectionLoader"; import { ProjectionResolver } from "./ProjectionResolver"; var Vim = require("vim-node-driver"); var vim = new Vim(); var projectionLoader = new ProjectionLoader(); var projectionResolver = new ProjectionResolver(projectionLoader); var currentBuffer; var currentAlternateFile = null; var alternateCache = {}; vim.on("BufEnter", (args) => { currentBuffer = args.currentBuffer; if(currentBuffer) { currentAlternateFile = projectionResolver.getAlternate(currentBuffer); console.log("Resolving projection for: " + currentBuffer + " | " + projectionResolver.getAlternate(currentBuffer)); } }); vim.addCommand("Alternate", () => { var alternateFile = currentAlternateFile; // If not resolved, try the cache if(!alternateFile) alternateFile = alternateCache[currentBuffer]; if(alternateFile) { // Store a reverse mapping so we can jump back easily alternateCache[alternateFile] = currentBuffer; vim.exec("edit " + alternateFile) } }); console.log("command registered")
Set up an alternate file cache if the reverse mapping isn't explicitly defined
Set up an alternate file cache if the reverse mapping isn't explicitly defined
TypeScript
mit
extr0py/vim-js-alternate,extr0py/vim-js-alternate
--- +++ @@ -11,10 +11,13 @@ var projectionLoader = new ProjectionLoader(); var projectionResolver = new ProjectionResolver(projectionLoader); +var currentBuffer; var currentAlternateFile = null; +var alternateCache = {}; + vim.on("BufEnter", (args) => { - var currentBuffer = args.currentBuffer; + currentBuffer = args.currentBuffer; if(currentBuffer) { currentAlternateFile = projectionResolver.getAlternate(currentBuffer); console.log("Resolving projection for: " + currentBuffer + " | " + projectionResolver.getAlternate(currentBuffer)); @@ -22,8 +25,18 @@ }); vim.addCommand("Alternate", () => { - if(currentAlternateFile) - vim.exec("edit " + currentAlternateFile) + + var alternateFile = currentAlternateFile; + + // If not resolved, try the cache + if(!alternateFile) + alternateFile = alternateCache[currentBuffer]; + + if(alternateFile) { + // Store a reverse mapping so we can jump back easily + alternateCache[alternateFile] = currentBuffer; + vim.exec("edit " + alternateFile) + } });
bf9fc000bfc00909a6178a3c7b34814c910befc1
src/ui/popup/index.tsx
src/ui/popup/index.tsx
/** * Copyright (c) 2017 Kenny Do * * 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 * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createUIStore } from 'redux-webext'; import { sleep } from '../../services/Libs'; import fontAwesomeImports from '../font-awesome-imports'; import App from './App'; fontAwesomeImports(); async function initApp() { let store = await createUIStore(); while (!store.getState()) { await sleep(250); store = await createUIStore(); } const mountNode = document.createElement('div'); document.body.appendChild(mountNode); if (browserDetect() === 'Chrome') { await new Promise(resolve => setTimeout(resolve, 100)); } ReactDOM.render( <Provider store={store}> <App /> </Provider>, mountNode, ); } initApp();
/** * Copyright (c) 2017 Kenny Do * * 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 * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import { createUIStore } from 'redux-webext'; import { sleep } from '../../services/Libs'; import ErrorBoundary from '../common_components/ErrorBoundary'; import fontAwesomeImports from '../font-awesome-imports'; import App from './App'; fontAwesomeImports(); async function initApp() { let store = await createUIStore(); while (!store.getState()) { await sleep(250); store = await createUIStore(); } const mountNode = document.createElement('div'); document.body.appendChild(mountNode); if (browserDetect() === 'Chrome') { await new Promise(resolve => setTimeout(resolve, 100)); } ReactDOM.render( <Provider store={store}> <ErrorBoundary> <App /> </ErrorBoundary> </Provider>, mountNode, ); } initApp();
Add an ErrorBoundary to the popup
Add an ErrorBoundary to the popup
TypeScript
mit
Cookie-AutoDelete/Cookie-AutoDelete,mrdokenny/Cookie-AutoDelete,Cookie-AutoDelete/Cookie-AutoDelete,Cookie-AutoDelete/Cookie-AutoDelete,mrdokenny/Cookie-AutoDelete
--- +++ @@ -14,6 +14,7 @@ import { Provider } from 'react-redux'; import { createUIStore } from 'redux-webext'; import { sleep } from '../../services/Libs'; +import ErrorBoundary from '../common_components/ErrorBoundary'; import fontAwesomeImports from '../font-awesome-imports'; import App from './App'; @@ -34,7 +35,9 @@ ReactDOM.render( <Provider store={store}> - <App /> + <ErrorBoundary> + <App /> + </ErrorBoundary> </Provider>, mountNode, );
176cd5c61e198d1ed172d10fa0abe8c2b6f53dad
src/app/app.spec.ts
src/app/app.spec.ts
import { it, inject, injectAsync, beforeEachProviders, TestComponentBuilder } from 'angular2/testing'; // Load the implementations that should be tested import {App} from './app'; import {countTotal} from './lib/utils'; import {BudgetService} from './services/budget.service'; import {budgetItems} from './budget/budget-items.mock'; describe('App', () => { // provide our implementations or mocks to the dependency injector beforeEachProviders(() => [ App, BudgetService ]); it('should have a model', inject([ App ], (app) => { let md = app.model; expect(md.sum).toEqual(0); expect(md.description).toEqual(''); })); it('should count total', () => { let sum = countTotal(budgetItems); expect(sum).toEqual(560); }); it('should read from localStorage', inject([BudgetService], (service) => { service.fillWithTestData(); let items = service.getItems(); for (let i = 0; i < budgetItems.length; i++) { expect(items[i].sum).toEqual(budgetItems[i].sum); expect(items[i].description).toEqual(budgetItems[i].description); } })); });
import { it, inject, injectAsync, beforeEachProviders, TestComponentBuilder } from 'angular2/testing'; // Load the implementations that should be tested import {App} from './app'; import {countTotal} from './lib/utils'; import {BudgetService} from './services/budget.service'; import {BudgetItem} from './budget/budget-item'; import {budgetItems} from './budget/budget-items.mock'; describe('App', () => { // provide our implementations or mocks to the dependency injector beforeEachProviders(() => [ App, BudgetService ]); it('should have a model', inject([ App ], (app) => { let md: BudgetItem = app.model; expect(md.sum).toEqual(0); expect(md.description).toEqual(''); })); }); describe('utils', () => { it('should count total', () => { let sum: number = countTotal(budgetItems); expect(sum).toEqual(560); }); }); describe('BudgetService', () => { beforeEachProviders(() => [ BudgetService ]); beforeEach( () => { localStorage.clear(); }); it('should read from localStorage', inject([BudgetService], (service) => { service.fillWithTestData(); let items: BudgetItem[] = service.getItems(); for (let i = 0; i < budgetItems.length; i++) { expect(items[i].sum).toEqual(budgetItems[i].sum); expect(items[i].description).toEqual(budgetItems[i].description); } })); it('should add new item', inject([BudgetService], (service) => { let newItem: BudgetItem = new BudgetItem(-30, 'Coffee'); service.addItem(newItem); let resItem = service.getItems()[0]; expect(resItem.sum).toEqual(newItem.sum); expect(resItem.description).toEqual(newItem.description); })); });
Split tests into test suits & test addItem()
Split tests into test suits & test addItem()
TypeScript
mit
bluebirrrrd/ng2-budget,bluebirrrrd/ng2-budget,bluebirrrrd/ng2-budget
--- +++ @@ -10,6 +10,7 @@ import {App} from './app'; import {countTotal} from './lib/utils'; import {BudgetService} from './services/budget.service'; +import {BudgetItem} from './budget/budget-item'; import {budgetItems} from './budget/budget-items.mock'; @@ -21,23 +22,45 @@ ]); it('should have a model', inject([ App ], (app) => { - let md = app.model; + let md: BudgetItem = app.model; expect(md.sum).toEqual(0); expect(md.description).toEqual(''); })); +}); +describe('utils', () => { + it('should count total', () => { - let sum = countTotal(budgetItems); + let sum: number = countTotal(budgetItems); expect(sum).toEqual(560); + }); + +}); + +describe('BudgetService', () => { + beforeEachProviders(() => [ + BudgetService + ]); + + beforeEach( () => { + localStorage.clear(); }); it('should read from localStorage', inject([BudgetService], (service) => { service.fillWithTestData(); - let items = service.getItems(); + let items: BudgetItem[] = service.getItems(); for (let i = 0; i < budgetItems.length; i++) { expect(items[i].sum).toEqual(budgetItems[i].sum); expect(items[i].description).toEqual(budgetItems[i].description); } })); + it('should add new item', inject([BudgetService], (service) => { + let newItem: BudgetItem = new BudgetItem(-30, 'Coffee'); + service.addItem(newItem); + let resItem = service.getItems()[0]; + expect(resItem.sum).toEqual(newItem.sum); + expect(resItem.description).toEqual(newItem.description); + })); + });
9db4dc352013e5352ff3737ea3aefe917b0fe871
src/modules/pwsh.ts
src/modules/pwsh.ts
import { symlinkOrReplaceFilesInFolderSync } from '../util/files'; import * as fs from 'fs'; import * as logHelper from '../util/log-helper'; import * as path from 'path'; export function install(): void { if (process.platform === 'win32') { logHelper.logStepStarted('pwsh'); const sourceDir = path.join(__dirname, '../../data/pwsh'); const destDir = path.join(process.env.HOME!, 'Documents/PowerShell'); const files = fs.readdirSync(sourceDir); logHelper.logSubStepPartialStarted('applying config files'); symlinkOrReplaceFilesInFolderSync(files, sourceDir, destDir); logHelper.logSubStepPartialSuccess(); } }
import { symlinkOrReplaceFilesInFolderSync } from '../util/files'; import * as fs from 'fs'; import * as logHelper from '../util/log-helper'; import * as path from 'path'; export function install(): void { if (process.platform === 'win32') { logHelper.logStepStarted('pwsh'); const sourceDir = path.join(__dirname, '../../data/pwsh'); const destDir = path.join(process.env.USERPROFILE || process.env.HOME!, 'Documents/PowerShell'); const files = fs.readdirSync(sourceDir); logHelper.logSubStepPartialStarted('applying config files'); symlinkOrReplaceFilesInFolderSync(files, sourceDir, destDir); logHelper.logSubStepPartialSuccess(); } }
Fix missing HOME var on Windows
Fix missing HOME var on Windows
TypeScript
mit
Tyriar/dotfiles,Tyriar/dotfiles,Tyriar/dotfiles
--- +++ @@ -7,7 +7,7 @@ if (process.platform === 'win32') { logHelper.logStepStarted('pwsh'); const sourceDir = path.join(__dirname, '../../data/pwsh'); - const destDir = path.join(process.env.HOME!, 'Documents/PowerShell'); + const destDir = path.join(process.env.USERPROFILE || process.env.HOME!, 'Documents/PowerShell'); const files = fs.readdirSync(sourceDir); logHelper.logSubStepPartialStarted('applying config files'); symlinkOrReplaceFilesInFolderSync(files, sourceDir, destDir);
3fd69d677212d664ab200432d0ef25573f480621
src/commons/hooks/useSearch.ts
src/commons/hooks/useSearch.ts
import useUrlState, { Options } from '@ahooksjs/use-url-state' interface ExtOptions<T> { arrayNames?: string[] numberNames?: string[] booleanNames?: string[] } export function useSearch<T>(initialState?: T, options?: Options & ExtOptions<T>) { const { arrayNames, numberNames, booleanNames, ...tail } = options ?? {} const [urlState, setUrlState] = useUrlState<any>(initialState, { navigateMode: 'replace', ...tail, }) const state = { ...urlState } arrayNames?.forEach((name) => { const value = state[name] if (value == null) state[name] = [] state[name] = Array.isArray(value) ? value : [value] }) numberNames?.forEach((name) => { const value = state[name] if (value == null) return state[name] = typeof value === 'string' ? parseInt(value) : value }) booleanNames?.forEach((name) => { const value = state[name] if (value == null) return state[name] = typeof value === 'string' ? Boolean(value) : value }) return [state, setUrlState] as const }
import useUrlState, { Options } from '@ahooksjs/use-url-state' interface ExtOptions<T> { arrayNames?: string[] numberNames?: string[] booleanNames?: string[] } export function useSearch<T>(initialState?: T, options?: Options & ExtOptions<T>) { const { arrayNames, numberNames, booleanNames, ...tail } = options ?? {} const [urlState, setUrlState] = useUrlState<any>(initialState, { navigateMode: 'replace', ...tail, }) const state = { ...urlState } arrayNames?.forEach((name) => { const value = state[name] if (value == null) state[name] = [] state[name] = Array.isArray(value) ? value : [value] }) numberNames?.forEach((name) => { const value = state[name] if (value == null) return state[name] = typeof value === 'string' ? parseInt(value) : value }) booleanNames?.forEach((name) => { const value = state[name] if (value == null) return state[name] = typeof value === 'string' ? value === 'true' : value }) return [state, setUrlState] as const }
Fix use search parse error
feat: Fix use search parse error
TypeScript
apache-2.0
mingzuozhibi/mzzb-ui,mingzuozhibi/mzzb-ui,mingzuozhibi/mzzb-ui,mingzuozhibi/mzzb-ui
--- +++ @@ -27,7 +27,7 @@ booleanNames?.forEach((name) => { const value = state[name] if (value == null) return - state[name] = typeof value === 'string' ? Boolean(value) : value + state[name] = typeof value === 'string' ? value === 'true' : value }) return [state, setUrlState] as const
1fe0e6e1bd666da79d4dd1886fce7ace18061295
Day13-Slide-In-On-Roll/Day13-Slide-In-On-Roll/src/app/site/site.component.ts
Day13-Slide-In-On-Roll/Day13-Slide-In-On-Roll/src/app/site/site.component.ts
import { Component, OnInit, HostListener } from '@angular/core'; @Component({ selector: 'app-site', templateUrl: './site.component.html', styleUrls: ['./site.component.css'] }) export class SiteComponent implements OnInit { constructor() { } ngOnInit() { } @HostListener('window:scroll', ['$event']) checkScroll($event) { console.log($event); } }
import { Component, OnDestroy, AfterViewInit, ElementRef, Renderer } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/debounceTime'; import 'rxjs/add/observable/fromEvent' @Component({ selector: 'app-site', templateUrl: './site.component.html', styleUrls: ['./site.component.css'] }) export class SiteComponent implements AfterViewInit, OnDestroy { subscription: any; constructor(private elRef: ElementRef, private renderer: Renderer) { } ngAfterViewInit() { const sliderImages = this.elRef.nativeElement.querySelectorAll('.slide-in'); // listen to scroll event of window // receive event and return the same event // wait 20 milliseconds before sending out data this.subscription = Observable .fromEvent(window, 'scroll') .debounceTime(20) .subscribe(() => { sliderImages.forEach(this.handleSlideImage.bind(this)); }); } handleSlideImage(sliderImage: any) { // half way through the image const slideInAt = (window.scrollY + window.innerHeight) - sliderImage.height / 2; console.log({slideInAt: slideInAt}); // bottom of the image const imageBottom = sliderImage.offsetTop + sliderImage.height; console.log({offsetTop: sliderImage.offsetTop, imageBottom: imageBottom}); const isHalfShown = slideInAt > sliderImage.offsetTop; const isNotScrolledPast = window.scrollY < imageBottom; this.renderer.setElementClass(sliderImage, 'active', isHalfShown && isNotScrolledPast); } ngOnDestroy() { this.subscription.unsubscribe(); } }
Complete angular-30 Day 13 exercise
Complete angular-30 Day 13 exercise
TypeScript
mit
railsstudent/angular-30,railsstudent/angular-30,railsstudent/angular-30
--- +++ @@ -1,20 +1,45 @@ -import { Component, OnInit, HostListener } from '@angular/core'; +import { Component, OnDestroy, AfterViewInit, ElementRef, Renderer } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/debounceTime'; +import 'rxjs/add/observable/fromEvent' @Component({ selector: 'app-site', templateUrl: './site.component.html', styleUrls: ['./site.component.css'] }) -export class SiteComponent implements OnInit { +export class SiteComponent implements AfterViewInit, OnDestroy { - constructor() { } + subscription: any; - ngOnInit() { + constructor(private elRef: ElementRef, private renderer: Renderer) { } + + ngAfterViewInit() { + const sliderImages = this.elRef.nativeElement.querySelectorAll('.slide-in'); + // listen to scroll event of window + // receive event and return the same event + // wait 20 milliseconds before sending out data + this.subscription = Observable + .fromEvent(window, 'scroll') + .debounceTime(20) + .subscribe(() => { + sliderImages.forEach(this.handleSlideImage.bind(this)); + }); } - @HostListener('window:scroll', ['$event']) - checkScroll($event) { - console.log($event); + handleSlideImage(sliderImage: any) { + // half way through the image + const slideInAt = (window.scrollY + window.innerHeight) - sliderImage.height / 2; + console.log({slideInAt: slideInAt}); + // bottom of the image + const imageBottom = sliderImage.offsetTop + sliderImage.height; + console.log({offsetTop: sliderImage.offsetTop, imageBottom: imageBottom}); + const isHalfShown = slideInAt > sliderImage.offsetTop; + const isNotScrolledPast = window.scrollY < imageBottom; + this.renderer.setElementClass(sliderImage, 'active', isHalfShown && isNotScrolledPast); } + ngOnDestroy() { + this.subscription.unsubscribe(); + } }
889ac359b590168a66c7cc980778cbf2e292cb7d
src/app/hero-search.service.spec.ts
src/app/hero-search.service.spec.ts
import { fakeAsync, inject, TestBed } from '@angular/core/testing' import { BaseRequestOptions, ConnectionBackend, Http, RequestOptions, Response, ResponseOptions } from '@angular/http' import { MockBackend } from '@angular/http/testing' import { Hero } from './hero' import { HeroSearchService } from './hero-search.service' describe('HeroSearchService', () => { beforeEach(() => { this.injector = TestBed.configureTestingModule({ providers: [ { provide: ConnectionBackend, useClass: MockBackend }, { provide: RequestOptions, useClass: BaseRequestOptions }, Http, HeroSearchService ] }) this.backend = this.injector.get(ConnectionBackend) as MockBackend this.backend.connections.subscribe((connection: any) => this.connection = connection) }) it('should be created', fakeAsync(inject([HeroSearchService], (service: HeroSearchService) => { expect(service).toBeTruthy() }))) it('#search should search heroes by name', fakeAsync(inject([HeroSearchService], (service: HeroSearchService) => { let result = null service .search('A') .subscribe((heroes: Hero[]) => result = heroes) this.connection.mockRespond(new Response( new ResponseOptions({ body: JSON.stringify({ data: [] }) }) )) expect(this.connection.request.url).toMatch(/api\/heroes\?name=A$/) expect(result).toEqual([]) }))) })
import { fakeAsync, inject, TestBed } from '@angular/core/testing' import { BaseRequestOptions, ConnectionBackend, Http, RequestOptions, Response, ResponseOptions } from '@angular/http' import { MockBackend } from '@angular/http/testing' import { Hero } from './hero' import { HeroSearchService } from './hero-search.service' describe('HeroSearchService', () => { let backend: MockBackend let connection: any beforeEach(() => { this.injector = TestBed.configureTestingModule({ providers: [ { provide: ConnectionBackend, useClass: MockBackend }, { provide: RequestOptions, useClass: BaseRequestOptions }, Http, HeroSearchService ] }) backend = this.injector.get(ConnectionBackend) as MockBackend backend.connections.subscribe((con: any) => connection = con) }) it('should be created', fakeAsync(inject([HeroSearchService], (service: HeroSearchService) => { expect(service).toBeTruthy() }))) it('#search should search heroes by name', fakeAsync(inject([HeroSearchService], (service: HeroSearchService) => { let result = null service .search('A') .subscribe((heroes: Hero[]) => result = heroes) connection.mockRespond(new Response( new ResponseOptions({ body: JSON.stringify({ data: [] }) }) )) expect(connection.request.url).toMatch(/api\/heroes\?name=A$/) expect(result).toEqual([]) }))) })
Move variables outside the testing class
Move variables outside the testing class
TypeScript
mit
hckhanh/tour-of-heroes,hckhanh/tour-of-heroes,hckhanh/tour-of-heroes
--- +++ @@ -5,6 +5,9 @@ import { HeroSearchService } from './hero-search.service' describe('HeroSearchService', () => { + let backend: MockBackend + let connection: any + beforeEach(() => { this.injector = TestBed.configureTestingModule({ providers: [ @@ -15,8 +18,8 @@ ] }) - this.backend = this.injector.get(ConnectionBackend) as MockBackend - this.backend.connections.subscribe((connection: any) => this.connection = connection) + backend = this.injector.get(ConnectionBackend) as MockBackend + backend.connections.subscribe((con: any) => connection = con) }) it('should be created', fakeAsync(inject([HeroSearchService], (service: HeroSearchService) => { @@ -30,11 +33,11 @@ .search('A') .subscribe((heroes: Hero[]) => result = heroes) - this.connection.mockRespond(new Response( + connection.mockRespond(new Response( new ResponseOptions({ body: JSON.stringify({ data: [] }) }) )) - expect(this.connection.request.url).toMatch(/api\/heroes\?name=A$/) + expect(connection.request.url).toMatch(/api\/heroes\?name=A$/) expect(result).toEqual([]) }))) })
5fb08b0ba198f3709a3543549223093826f64e93
src/server/activitypub/publickey.ts
src/server/activitypub/publickey.ts
import * as express from 'express'; import context from '../../remote/activitypub/renderer/context'; import render from '../../remote/activitypub/renderer/key'; import User from '../../models/user'; const app = express.Router(); app.get('/users/:user/publickey', async (req, res) => { const userId = req.params.user; const user = await User.findOne({ _id: userId }); const rendered = render(user); rendered['@context'] = context; res.json(rendered); }); export default app;
import * as express from 'express'; import context from '../../remote/activitypub/renderer/context'; import render from '../../remote/activitypub/renderer/key'; import User, { isLocalUser } from '../../models/user'; const app = express.Router(); app.get('/users/:user/publickey', async (req, res) => { const userId = req.params.user; const user = await User.findOne({ _id: userId }); if (isLocalUser(user)) { const rendered = render(user); rendered['@context'] = context; res.json(rendered); } else { res.sendStatus(400); } }); export default app;
Check whether is local user
Check whether is local user
TypeScript
mit
Tosuke/misskey,syuilo/Misskey,syuilo/Misskey,ha-dai/Misskey,Tosuke/misskey,Tosuke/misskey,Tosuke/misskey,Tosuke/misskey,ha-dai/Misskey
--- +++ @@ -1,7 +1,7 @@ import * as express from 'express'; import context from '../../remote/activitypub/renderer/context'; import render from '../../remote/activitypub/renderer/key'; -import User from '../../models/user'; +import User, { isLocalUser } from '../../models/user'; const app = express.Router(); @@ -10,10 +10,14 @@ const user = await User.findOne({ _id: userId }); - const rendered = render(user); - rendered['@context'] = context; + if (isLocalUser(user)) { + const rendered = render(user); + rendered['@context'] = context; - res.json(rendered); + res.json(rendered); + } else { + res.sendStatus(400); + } }); export default app;
36b5c266fccaf78a3d799ad2eb1820e3db5cd2c7
AngularBasic/wwwroot/app/app.component.ts
AngularBasic/wwwroot/app/app.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'my-app', moduleId: module.id, templateUrl: 'app.template.html' }) export class AppComponent { }
import { Component } from '@angular/core'; import template from './app.template.html'; @Component({ selector: 'my-app', moduleId: module.id, template: template }) export class AppComponent { }
Use import for app template
Use import for app template
TypeScript
mit
MattJeanes/AngularBasic,MattJeanes/AngularBasic,MattJeanes/AngularBasic,MattJeanes/AngularBasic
--- +++ @@ -1,8 +1,9 @@ import { Component } from '@angular/core'; +import template from './app.template.html'; @Component({ selector: 'my-app', moduleId: module.id, - templateUrl: 'app.template.html' + template: template }) export class AppComponent { }
62a3f060f50b5b005959353aa931ec411bbfde0f
js/charts/FuzzySearch.ts
js/charts/FuzzySearch.ts
import {keyBy} from './Util' const fuzzysort = require("fuzzysort") export default class FuzzySearch<T> { strings: string[] datamap: any constructor(data: T[], key: string) { this.datamap = keyBy(data, key) this.strings = data.map((d: any) => fuzzysort.prepare(d[key])) } search(input: string): T[] { return fuzzysort.go(input, this.strings).map((result: any) => this.datamap[result._target]) } highlight(input: string, target: string): string { const result = fuzzysort.single(input, target) return result ? result.highlighted : target } }
import {keyBy} from './Util' const fuzzysort = require("fuzzysort") export default class FuzzySearch<T> { strings: string[] datamap: any constructor(data: T[], key: string) { this.datamap = keyBy(data, key) this.strings = data.map((d: any) => fuzzysort.prepare(d[key])) } search(input: string): T[] { console.log(fuzzysort.go(input, this.strings)) return fuzzysort.go(input, this.strings).map((result: any) => this.datamap[result.target]) } highlight(input: string, target: string): string { const result = fuzzysort.single(input, target) return result ? result.highlighted : target } }
Fix data selector search (ouch)
Fix data selector search (ouch)
TypeScript
mit
aaldaber/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,aaldaber/owid-grapher,aaldaber/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/our-world-in-data-grapher,aaldaber/owid-grapher,OurWorldInData/our-world-in-data-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,aaldaber/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/our-world-in-data-grapher,OurWorldInData/our-world-in-data-grapher
--- +++ @@ -11,7 +11,8 @@ } search(input: string): T[] { - return fuzzysort.go(input, this.strings).map((result: any) => this.datamap[result._target]) + console.log(fuzzysort.go(input, this.strings)) + return fuzzysort.go(input, this.strings).map((result: any) => this.datamap[result.target]) } highlight(input: string, target: string): string {
3673f77bf4a8629ca95bc5c436e298d15313b0be
utils/Formatter.ts
utils/Formatter.ts
export let changeFormattedStatus = (status: string) => { if(!status) return null; if (status.indexOf("상승") != -1 || status.indexOf("+") != -1) { return "up"; } else if (status.indexOf("하락") != -1 || status.indexOf("-") != -1) { return "up"; } else { return "new"; } }
export let changeFormattedStatus = (status: string) => { if(!status) return null; if (status.indexOf("상승") != -1 || status.indexOf("+") != -1) { return "up"; } else if (status.indexOf("하락") != -1 || status.indexOf("-") != -1) { return "down"; } else { return "new"; } };
Fix status of rank as down
Fix status of rank as down
TypeScript
mit
endlessdev/rankr,endlessdev/rankr
--- +++ @@ -3,8 +3,8 @@ if (status.indexOf("상승") != -1 || status.indexOf("+") != -1) { return "up"; } else if (status.indexOf("하락") != -1 || status.indexOf("-") != -1) { - return "up"; + return "down"; } else { return "new"; } -} +};
577753c0bdd60362f661f9d19dffd095125e8837
src/utilities.ts
src/utilities.ts
import { Client, CommandInteraction } from "discord.js"; export class Utilities { public constructor(private readonly client: Client) { } public link = async (interaction: CommandInteraction) => { const link = this.client.generateInvite({ scopes: ["applications.commands"] }); await interaction.reply(`You can invite me to your server by going to this link!\n ${link}`); }; public moveto = async (interaction: CommandInteraction) => { if (interaction.guild == null) { interaction.reply("You need to be in a server to use commands."); return; } const member = interaction.guild.members.cache.get(interaction.user.id); const destination = interaction.options.getChannel("channel"); if (member == null) { interaction.reply("???????????????"); return; } if (member.voice.channel == null) { interaction.reply("???????????????"); return; } if (destination?.type !== "GUILD_VOICE") { interaction.reply("???????????????"); return; } const promises = [...member.voice.channel.members.values()].map(toMove => toMove.voice.setChannel(destination)); await Promise.allSettled(promises); interaction.reply(`Moved everyone to the channel ${destination.name}`); }; }
import { Client, CommandInteraction } from "discord.js"; export class Utilities { public constructor(private readonly client: Client) { } public link = async (interaction: CommandInteraction) => { const link = this.client.generateInvite({ scopes: ["applications.commands"] }); await interaction.reply(`You can invite me to your server by going to this link!\n ${link}`); }; public moveto = async (interaction: CommandInteraction) => { if (interaction.guild == null) { interaction.reply("You need to be in a server to use commands."); return; } const member = interaction.guild.members.cache.get(interaction.user.id); const destination = interaction.options.getChannel("channel"); if (member == null) { console.error(`"member" is null for user "${interaction.user.tag} (${interaction.user.id})".`); interaction.reply("Sorry, there was an error moving your channel."); return; } if (member.voice.channel == null) { interaction.reply("You are not currently in any voice channel!"); return; } if (destination?.type !== "GUILD_VOICE") { console.error(`Destination channel (${destination?.type}) is not a voice channel!`); interaction.reply("Sorry, there was an error moving your channel."); return; } const promises = [...member.voice.channel.members.values()].map(toMove => toMove.voice.setChannel(destination)); await Promise.allSettled(promises); interaction.reply(`Moved everyone to the channel ${destination.name}`); }; }
Add better messages in error handling.
Add better messages in error handling.
TypeScript
mit
Armos-Games/Echo
--- +++ @@ -18,15 +18,17 @@ const member = interaction.guild.members.cache.get(interaction.user.id); const destination = interaction.options.getChannel("channel"); if (member == null) { - interaction.reply("???????????????"); + console.error(`"member" is null for user "${interaction.user.tag} (${interaction.user.id})".`); + interaction.reply("Sorry, there was an error moving your channel."); return; } if (member.voice.channel == null) { - interaction.reply("???????????????"); + interaction.reply("You are not currently in any voice channel!"); return; } if (destination?.type !== "GUILD_VOICE") { - interaction.reply("???????????????"); + console.error(`Destination channel (${destination?.type}) is not a voice channel!`); + interaction.reply("Sorry, there was an error moving your channel."); return; }
283415beab7ee4a5b12d8a74daca1f053e23038d
modules/angular2/angular2_sfx.ts
modules/angular2/angular2_sfx.ts
import * as ng from './angular2'; // the router should have its own SFX bundle // But currently the module arithmetic 'angular2/router_sfx - angular2/angular2', // is not support by system builder. import * as router from './router'; var _prevNg = (<any>window).ng; (<any>window).ng = ng; (<any>window).ngRouter = router; /** * Calling noConflict will restore window.angular to its pre-angular loading state * and return the angular module object. */ (<any>ng).noConflict = function() { (<any>window).ng = _prevNg; return ng; };
import * as ng from './angular2'; // the router and http should have their own SFX bundle // But currently the module arithemtic 'angular2/router_sfx - angular2/angular2', // is not support by system builder. import * as router from './router'; import * as http from './http'; var _prevNg = (<any>window).ng; (<any>window).ng = ng; (<any>window).ngRouter = router; (<any>window).ngHttp = http; /** * Calling noConflict will restore window.angular to its pre-angular loading state * and return the angular module object. */ (<any>ng).noConflict = function() { (<any>window).ng = _prevNg; return ng; };
Include ngHttp in SFX bundle
fix(sfx): Include ngHttp in SFX bundle fixes: #3934 Closes #3933
TypeScript
mit
caffeinetiger/angular,vicb/angular,trshafer/angular,matsko/angular,ttowncompiled/angular,aaron-goshine/angular,cassand/angular,hess-google/angular,shairez/angular,jasonaden/angular,vandres/angular,angular/angular,tamascsaba/angular,Tragetaschen/angular,nosachamos/angular,juleskremer/angular,Alireza-Dezfoolian/angular,alamgird/angular,weswigham/angular,dejour/angular,tapas4java/angular,wKoza/angular,snidima/angular,IdeaBlade/angular,amarth1982/angular,jhonmike/angular,mzgol/angular,souvikbasu/angular,vandres/angular,UIUXEngineering/angular,hdeshev/angular,chuckjaz/angular,vicb/angular,graveto/angular,SaltyDH/angular,hpinsley/angular,lfryc/angular,rbevers/angular,tapas4java/angular,IgorMinar/angular,weswigham/angular,NathanWalker/angular,tamascsaba/angular,hdeshev/angular,tycho01/angular,tolemac/angular,IgorMinar/angular,caffeinetiger/angular,ValtoFrameworks/Angular-2,chajath/angular,angular-indonesia/angular,ttowncompiled/angular,juleskremer/angular,brandonroberts/angular,naomiblack/angular,jackyxhb/angular,martinmcwhorter/angular,nishants/angular,ochafik/angular,gjungb/angular,sarunint/angular,Zyzle/angular,martinmcwhorter/angular,JanStureNielsen/angular,mhegazy/angular,gionkunz/angular,mixed/angular,mgol/angular,ultrasonicsoft/angular,angular-indonesia/angular,matsko/angular,mprobst/angular,rkirov/angular,choeller/angular,StephenFluin/angular,dydek/angular,jackyxhb/angular,heathkit/angular,zzo/angular,epotvin/angular,brandonroberts/angular,nosovk/angular,ericmartinezr/angular,zolfer/angular,mhegazy/angular,mikeybyker/angular,aboveyou00/angular,sarunint/angular,xcaliber-tech/angular,pkozlowski-opensource/angular,laskoviymishka/angular,Tragetaschen/angular,alamgird/angular,hterkelsen/angular,Alireza-Dezfoolian/angular,graveto/angular,manekinekko/angular,ericmartinezr/angular,blesh/angular,hdeshev/angular,amarth1982/angular,oaleynik/angular,gilamran/angular,cironunes/angular,laco0416/angular,kwalrath/angular,ocombe/angular,githuya/angular,aboveyou00/angular,hterkelsen/angular,yanivefraim/angular,GistIcon/angular,kegluneq/angular,gjungb/angular,mgiambalvo/angular,ScottSWu/angular,Alireza-Dezfoolian/angular,jasonaden/angular,zzo/angular,amarth1982/angular,ttowncompiled/angular,angularbrasil/angular,StacyGay/angular,e-hein/angular,Alireza-Dezfoolian/angular,hess-google/angular,lfryc/angular,cassand/angular,nickwhite917/angular,cexbrayat/angular,pkozlowski-opensource/angular,yjbanov/angular,trshafer/angular,choeller/angular,manekinekko/angular,Nijikokun/angular,heathkit/angular,gnomeontherun/angular,mgechev/angular,hansl/angular,ochafik/angular,not-for-me/angular,gkalpak/angular,zzo/angular,JiaLiPassion/angular,chrisse27/angular,pkozlowski-opensource/angular,StacyGay/angular,gionkunz/angular,chuckjaz/angular,shuhei/angular,souldreamer/angular,aboveyou00/angular,angularbrasil/angular,jhonmike/angular,yjbanov/angular,dmitriz/angular,Mathou54/angular,ttowncompiled/angular,souvikbasu/angular,Mathou54/angular,angular-indonesia/angular,robwormald/angular,shirish87/angular,petebacondarwin/angular,heathkit/angular,ocombe/angular,SaltyDH/angular,willseeyou/angular,kylecordes/angular,mdegoo/angular,Brocco/angular,filipesilva/angular,cyrilgandon/angular,itamar-Cohen/angular,dejour/angular,Toxicable/angular,domusofsail/angular,asnowwolf/angular,vsavkin/angular,tolemac/angular,zhura/angular,cexbrayat/angular,jonrimmer/angular,rkirov/angular,hpinsley/angular,willseeyou/angular,chrisse27/angular,cassand/angular,wKoza/angular,ultrasonicsoft/angular,mikeybyker/angular,kegluneq/angular,IAPark/angular,tycho01/angular,jeremymwells/angular,AlmogShaul/angular,dsebastien/angular,jteplitz602/angular,jackyxhb/angular,ttowncompiled/angular,diestrin/angular,JSMike/angular,zolfer/angular,antonmoiseev/angular,gdi2290/angular,StacyGay/angular,LucasSloan/angular,ollie314/angular,alexeagle/angular,antonmoiseev/angular,NathanWalker/angular,tyleranton/angular,mixed/angular,hankduan/angular,ericmartinezr/angular,rixrix/angular,diestrin/angular,weswigham/angular,sjtrimble/angular,jonrimmer/angular,hess-g/angular,sjtrimble/angular,hdeshev/angular,Alireza-Dezfoolian/angular,hess-g/angular,meeroslav/angular,vikerman/angular,mzgol/angular,vinagreti/angular,tyleranton/angular,kylecordes/angular,nickwhite917/angular,diestrin/angular,gionkunz/angular,vamsivarikuti/angular,manekinekko/angular,vsavkin/angular,ericmartinezr/angular,chuckjaz/angular,vsavkin/angular,alexpods/angular,erictsangx/angular,metasong/angular,TedSander/angular,shirish87/angular,naomiblack/angular,graveto/angular,shahata/angular,meeroslav/angular,devmark/angular,devmark/angular,LucasSloan/angular,awerlang/angular,itamark/angular,willseeyou/angular,shuhei/angular,JiaLiPassion/angular,youdz/angular,Flounn/angular,not-for-me/angular,hankduan/angular,hterkelsen/angular,laskoviymishka/angular,SaltyDH/angular,snidima/angular,jonrimmer/angular,chajath/angular,vikerman/angular,mgol/angular,jeremymwells/angular,kwalrath/angular,weswigham/angular,tapas4java/angular,nosovk/angular,youdz/angular,markharding/angular,dsebastien/angular,alexcastillo/angular,angular/angular,dtoroshin/n2oDoc,vinagreti/angular,e-schultz/angular,nosachamos/angular,NathanWalker/angular,bkyarger/angular,mhevery/angular,rvanmarkus/angular,mdegoo/angular,IgorMinar/angular,m18/angular,ValtoFrameworks/Angular-2,mikeybyker/angular,bkyarger/angular,templth/angular,Brocco/angular,mlynch/angular,ghetolay/angular,laskoviymishka/angular,jeremymwells/angular,Alireza-Dezfoolian/angular,mgol/angular,Flounn/angular,dydek/angular,lfryc/angular,chrisse27/angular,AlmogShaul/angular,shahata/angular,hankduan/angular,itamar-Cohen/angular,sarunint/angular,StacyGay/angular,zhura/angular,laco0416/angular,githuya/angular,alxhub/angular,ericmartinezr/angular,Mathou54/angular,rixrix/angular,templth/angular,bkyarger/angular,xcaliber-tech/angular,ValtoFrameworks/Angular-2,shirish87/angular,yanivefraim/angular,juristr/angular,Nijikokun/angular,markharding/angular,wKoza/angular,dmitriz/angular,GistIcon/angular,weswigham/angular,erictsangx/angular,caffeinetiger/angular,jhonmike/angular,souldreamer/angular,alexpods/angular,snaptech/angular,tbosch/angular,getshuvo/angular,aboveyou00/angular,mprobst/angular,IAPark/angular,vicb/angular,nishants/angular,rafacm/angular,jhonmike/angular,snaptech/angular,dsebastien/angular,cexbrayat/angular,e-schultz/angular,LucasSloan/angular,tycho01/angular,vsavkin/angular,hpinsley/angular,huoxudong125/angular,vikerman/angular,IgorMinar/angular,e-hein/angular,dtoroshin/n2oDoc,willseeyou/angular,mdegoo/angular,choeller/angular,Symagic/angular,cassand/angular,JanStureNielsen/angular,Nijikokun/angular,tbosch/angular,tapas4java/angular,petebacondarwin/angular,jasonaden/angular,kylecordes/angular,cyrilgandon/angular,mzgol/angular,chalin/angular,huoxudong125/angular,hpinsley/angular,hterkelsen/angular,StacyGay/angular,mlynch/angular,rkirov/angular,blesh/angular,trshafer/angular,naomiblack/angular,rvanmarkus/angular,hess-g/angular,smartm0use/angular,alexcastillo/angular,hansl/angular,epotvin/angular,metasong/angular,nosovk/angular,tycho01/angular,shirish87/angular,trshafer/angular,hterkelsen/angular,mdegoo/angular,IgorMinar/angular,weswigham/angular,angularbrasil/angular,shahata/angular,mhevery/angular,IdeaBlade/angular,juristr/angular,chadqueen/angular,Toxicable/angular,ScottSWu/angular,chalin/angular,alexeagle/angular,royling/angular,not-for-me/angular,getshuvo/angular,Symagic/angular,bartkeizer/angular,JSMike/angular,Tragetaschen/angular,StephenFluin/angular,cexbrayat/angular,rbevers/angular,kylecordes/angular,dejour/angular,basvandenheuvel/angular,matsko/angular,kegluneq/angular,Litor/angular,dtoroshin/n2oDoc,pk-karthik/framework-js-angular,vamsivarikuti/angular,rvanmarkus/angular,ericmartinezr/angular,mdegoo/angular,mprobst/angular,naomiblack/angular,e-schultz/angular,jteplitz602/angular,tbosch/angular,brandonroberts/angular,wKoza/angular,epotvin/angular,bartkeizer/angular,ochafik/angular,NathanWalker/angular,hannahhoward/angular,alexeagle/angular,aaron-goshine/angular,laco0416/angular,micmro/angular,meeroslav/angular,ghetolay/angular,sjtrimble/angular,ultrasonicsoft/angular,rafacm/angular,vinagreti/angular,mlaval/angular,shahata/angular,itamar-Cohen/angular,mzgol/angular,markharding/angular,e-hein/angular,shahata/angular,Toxicable/angular,mlynch/angular,alexeagle/angular,basvandenheuvel/angular,hansl/angular,kwalrath/angular,alexcastillo/angular,shuhei/angular,nickwhite917/angular,heathkit/angular,pkozlowski-opensource/angular,StephenFluin/angular,sarunint/angular,panuruj/angular,dmitriz/angular,wesleycho/angular,AlmogShaul/angular,kara/angular,metasong/angular,TedSander/angular,gdi2290/angular,hankduan/angular,gkalpak/angular,angularbrasil/angular,ochafik/angular,chajath/angular,martinmcwhorter/angular,Litor/angular,Symagic/angular,ghetolay/angular,kegluneq/angular,cyrilgandon/angular,cironunes/angular,laskoviymishka/angular,itamark/angular,jonrimmer/angular,TedSander/angular,nosachamos/angular,domusofsail/angular,robertmesserle/angular,vandres/angular,SekibOmazic/angular,snidima/angular,mhevery/angular,robertmesserle/angular,caffeinetiger/angular,yanivefraim/angular,martinmcwhorter/angular,mgechev/angular,zolfer/angular,gionkunz/angular,alamgird/angular,getshuvo/angular,caffeinetiger/angular,e-schultz/angular,xcaliber-tech/angular,royling/angular,souldreamer/angular,filipesilva/angular,Zyzle/angular,rafacm/angular,shirish87/angular,Toxicable/angular,laco0416/angular,hankduan/angular,jesperronn/angular,jelbourn/angular,Zyzle/angular,Symagic/angular,StacyGay/angular,chalin/angular,kara/angular,ultrasonicsoft/angular,SaltyDH/angular,cyrilgandon/angular,chajath/angular,choeller/angular,vinagreti/angular,mhevery/angular,nosachamos/angular,oaleynik/angular,Symagic/angular,SekibOmazic/angular,asnowwolf/angular,devmark/angular,rbevers/angular,aboveyou00/angular,panuruj/angular,tyleranton/angular,IgorMinar/angular,NathanWalker/angular,Tragetaschen/angular,mhegazy/angular,UIUXEngineering/angular,erictsangx/angular,cironunes/angular,IdeaBlade/angular,filipesilva/angular,domusofsail/angular,ScottSWu/angular,chajath/angular,dejour/angular,dtoroshin/n2oDoc,nickwhite917/angular,zolfer/angular,mhegazy/angular,not-for-me/angular,meeroslav/angular,rkirov/angular,mixed/angular,SekibOmazic/angular,hess-g/angular,NathanWalker/angular,basvandenheuvel/angular,Flounn/angular,ochafik/angular,mgol/angular,souldreamer/angular,smartm0use/angular,mlaval/angular,JiaLiPassion/angular,wesleycho/angular,nosachamos/angular,alexcastillo/angular,mgol/angular,angularbrasil/angular,JSMike/angular,mgiambalvo/angular,mprobst/angular,chalin/angular,tyleranton/angular,mgol/angular,ultrasonicsoft/angular,martinmcwhorter/angular,chadqueen/angular,jhonmike/angular,m18/angular,antonmoiseev/angular,githuya/angular,Litor/angular,robwormald/angular,gionkunz/angular,Litor/angular,yjbanov/angular,rjamet/angular,tamascsaba/angular,mlaval/angular,mikeybyker/angular,wesleycho/angular,hess-google/angular,mhevery/angular,UIUXEngineering-Forks/angular,wKoza/angular,dtoroshin/n2oDoc,Zyzle/angular,pkozlowski-opensource/angular,Nijikokun/angular,gnomeontherun/angular,huoxudong125/angular,tbosch/angular,mhegazy/angular,kylecordes/angular,panuruj/angular,Toxicable/angular,robwormald/angular,zzo/angular,GistIcon/angular,kwalrath/angular,juristr/angular,asnowwolf/angular,jelbourn/angular,chadqueen/angular,gjungb/angular,jasonaden/angular,Flounn/angular,jteplitz602/angular,tycho01/angular,youdz/angular,ollie314/angular,alexcastillo/angular,robertmesserle/angular,antonmoiseev/angular,jhonmike/angular,tolemac/angular,kwalrath/angular,rkirov/angular,IdeaBlade/angular,erictsangx/angular,choeller/angular,juristr/angular,brandonroberts/angular,UIUXEngineering/angular,jesperronn/angular,vicb/angular,hannahhoward/angular,bartkeizer/angular,sjtrimble/angular,bkyarger/angular,wKoza/angular,souldreamer/angular,smartm0use/angular,Toxicable/angular,mgiambalvo/angular,IAPark/angular,wesleycho/angular,devmark/angular,Brocco/angular,yjbanov/angular,templth/angular,robertmesserle/angular,vandres/angular,UIUXEngineering-Forks/angular,aaron-goshine/angular,cironunes/angular,ocombe/angular,aaron-goshine/angular,cassand/angular,alxhub/angular,basvandenheuvel/angular,templth/angular,e-schultz/angular,gdi2290/angular,sarunint/angular,metasong/angular,willseeyou/angular,nosovk/angular,tolemac/angular,hpinsley/angular,hannahhoward/angular,jonrimmer/angular,blesh/angular,hdeshev/angular,Brocco/angular,alfonso-presa/angular,AlmogShaul/angular,ScottSWu/angular,jackyxhb/angular,nishants/angular,vicb/angular,markharding/angular,mlynch/angular,oaleynik/angular,JanStureNielsen/angular,shahata/angular,kevinmerckx/angular,nishants/angular,lfryc/angular,jasonaden/angular,gilamran/angular,angularbrasil/angular,hannahhoward/angular,oaleynik/angular,IAPark/angular,Litor/angular,metasong/angular,alexeagle/angular,gdi2290/angular,mixed/angular,gdi2290/angular,getshuvo/angular,ValtoFrameworks/Angular-2,IdeaBlade/angular,gionkunz/angular,royling/angular,SekibOmazic/angular,shuhei/angular,githuya/angular,blesh/angular,nosachamos/angular,rkirov/angular,kegluneq/angular,sarunint/angular,IAPark/angular,itamark/angular,robwormald/angular,rafacm/angular,bartkeizer/angular,trshafer/angular,snidima/angular,dydek/angular,zolfer/angular,githuya/angular,pk-karthik/framework-js-angular,markharding/angular,micmro/angular,nishants/angular,jelbourn/angular,jteplitz602/angular,filipesilva/angular,chuckjaz/angular,alexpods/angular,mlynch/angular,shairez/angular,matsko/angular,jackyxhb/angular,mhevery/angular,awerlang/angular,mgiambalvo/angular,souvikbasu/angular,awerlang/angular,alexpods/angular,UIUXEngineering-Forks/angular,hannahhoward/angular,laskoviymishka/angular,mlaval/angular,zhura/angular,panuruj/angular,jelbourn/angular,graveto/angular,mixed/angular,vamsivarikuti/angular,tbosch/angular,cexbrayat/angular,rixrix/angular,LucasSloan/angular,micmro/angular,heathkit/angular,zzo/angular,youdz/angular,kara/angular,ollie314/angular,juristr/angular,alfonso-presa/angular,metasong/angular,kevinmerckx/angular,petebacondarwin/angular,kevinmerckx/angular,kylecordes/angular,Flounn/angular,zhura/angular,graveto/angular,trshafer/angular,yjbanov/angular,alexpods/angular,erictsangx/angular,kara/angular,ghetolay/angular,shairez/angular,dejour/angular,cironunes/angular,vamsivarikuti/angular,yjbanov/angular,jackyxhb/angular,gilamran/angular,jteplitz602/angular,hankduan/angular,bartkeizer/angular,ocombe/angular,manekinekko/angular,jasonaden/angular,petebacondarwin/angular,xcaliber-tech/angular,gjungb/angular,bkyarger/angular,rbevers/angular,kara/angular,angular/angular,jeremymwells/angular,epotvin/angular,JSMike/angular,rvanmarkus/angular,yanivefraim/angular,GistIcon/angular,UIUXEngineering-Forks/angular,itamar-Cohen/angular,getshuvo/angular,juleskremer/angular,graveto/angular,mzgol/angular,alexeagle/angular,tycho01/angular,heathkit/angular,UIUXEngineering-Forks/angular,nickwhite917/angular,LucasSloan/angular,Zyzle/angular,alamgird/angular,mgechev/angular,not-for-me/angular,laco0416/angular,wesleycho/angular,youdz/angular,kevinmerckx/angular,rbevers/angular,ScottSWu/angular,micmro/angular,tamascsaba/angular,ochafik/angular,chuckjaz/angular,gilamran/angular,gdi2290/angular,TedSander/angular,mprobst/angular,mprobst/angular,lfryc/angular,rixrix/angular,hess-g/angular,e-schultz/angular,snidima/angular,m18/angular,awerlang/angular,asnowwolf/angular,ttowncompiled/angular,tapas4java/angular,ollie314/angular,amarth1982/angular,Litor/angular,kevinmerckx/angular,snidima/angular,caffeinetiger/angular,SaltyDH/angular,jteplitz602/angular,pk-karthik/framework-js-angular,GistIcon/angular,ocombe/angular,shuhei/angular,awerlang/angular,rafacm/angular,blesh/angular,aboveyou00/angular,alfonso-presa/angular,erictsangx/angular,antonmoiseev/angular,rjamet/angular,domusofsail/angular,Tragetaschen/angular,rjamet/angular,asnowwolf/angular,vikerman/angular,basvandenheuvel/angular,chrisse27/angular,mlaval/angular,amarth1982/angular,StephenFluin/angular,SekibOmazic/angular,shairez/angular,Mathou54/angular,nishants/angular,UIUXEngineering/angular,angular/angular,ocombe/angular,vicb/angular,getshuvo/angular,StephenFluin/angular,markharding/angular,cyrilgandon/angular,gnomeontherun/angular,jesperronn/angular,shirish87/angular,TedSander/angular,m18/angular,juristr/angular,robwormald/angular,tamascsaba/angular,alfonso-presa/angular,laco0416/angular,sjtrimble/angular,angular-indonesia/angular,gilamran/angular,antonmoiseev/angular,TedSander/angular,jesperronn/angular,tyleranton/angular,hansl/angular,youdz/angular,hess-g/angular,rixrix/angular,jesperronn/angular,dmitriz/angular,basvandenheuvel/angular,oaleynik/angular,snaptech/angular,Symagic/angular,kegluneq/angular,souvikbasu/angular,yanivefraim/angular,dsebastien/angular,Nijikokun/angular,jonrimmer/angular,gjungb/angular,panuruj/angular,Zyzle/angular,cyrilgandon/angular,tyleranton/angular,itamark/angular,gilamran/angular,dydek/angular,pk-karthik/framework-js-angular,alxhub/angular,mdegoo/angular,Nijikokun/angular,mikeybyker/angular,githuya/angular,nickwhite917/angular,mgiambalvo/angular,hansl/angular,naomiblack/angular,shairez/angular,chuckjaz/angular,dydek/angular,ghetolay/angular,hdeshev/angular,jeremymwells/angular,snaptech/angular,dmitriz/angular,JiaLiPassion/angular,shuhei/angular,zhura/angular,brandonroberts/angular,mlynch/angular,aaron-goshine/angular,wesleycho/angular,epotvin/angular,lfryc/angular,AlmogShaul/angular,chadqueen/angular,ScottSWu/angular,ollie314/angular,micmro/angular,huoxudong125/angular,rvanmarkus/angular,alfonso-presa/angular,itamar-Cohen/angular,matsko/angular,zolfer/angular,hess-google/angular,m18/angular,brandonroberts/angular,UIUXEngineering-Forks/angular,vikerman/angular,robwormald/angular,gkalpak/angular,tolemac/angular,vsavkin/angular,martinmcwhorter/angular,ultrasonicsoft/angular,hannahhoward/angular,souldreamer/angular,templth/angular,alexpods/angular,JSMike/angular,willseeyou/angular,souvikbasu/angular,mzgol/angular,zhura/angular,robertmesserle/angular,dsebastien/angular,Mathou54/angular,cironunes/angular,tamascsaba/angular,bkyarger/angular,hpinsley/angular,tolemac/angular,domusofsail/angular,juleskremer/angular,rjamet/angular,itamar-Cohen/angular,epotvin/angular,vandres/angular,JanStureNielsen/angular,itamark/angular,rbevers/angular,vikerman/angular,petebacondarwin/angular,jelbourn/angular,royling/angular,alfonso-presa/angular,snaptech/angular,chadqueen/angular,vinagreti/angular,cassand/angular,manekinekko/angular,devmark/angular,petebacondarwin/angular,m18/angular,kevinmerckx/angular,GistIcon/angular,chadqueen/angular,manekinekko/angular,smartm0use/angular,mhegazy/angular,zzo/angular,huoxudong125/angular,ValtoFrameworks/Angular-2,micmro/angular,IAPark/angular,Brocco/angular,tapas4java/angular,dmitriz/angular,dsebastien/angular,hess-google/angular,e-hein/angular,jelbourn/angular,yanivefraim/angular,xcaliber-tech/angular,chrisse27/angular,mixed/angular,JanStureNielsen/angular,UIUXEngineering/angular,mgechev/angular,alxhub/angular,aaron-goshine/angular,oaleynik/angular,smartm0use/angular,juleskremer/angular,royling/angular,gnomeontherun/angular,hess-google/angular,snaptech/angular,rafacm/angular,choeller/angular,amarth1982/angular,Tragetaschen/angular,rixrix/angular,hansl/angular,meeroslav/angular,kara/angular,e-hein/angular,alexcastillo/angular,pk-karthik/framework-js-angular,filipesilva/angular,robertmesserle/angular,vamsivarikuti/angular,rvanmarkus/angular,SekibOmazic/angular,gkalpak/angular,alamgird/angular,alxhub/angular,LucasSloan/angular,nosovk/angular,Brocco/angular,jeremymwells/angular,hterkelsen/angular,mgechev/angular,huoxudong125/angular,bartkeizer/angular,diestrin/angular,devmark/angular
--- +++ @@ -1,8 +1,9 @@ import * as ng from './angular2'; -// the router should have its own SFX bundle -// But currently the module arithmetic 'angular2/router_sfx - angular2/angular2', +// the router and http should have their own SFX bundle +// But currently the module arithemtic 'angular2/router_sfx - angular2/angular2', // is not support by system builder. import * as router from './router'; +import * as http from './http'; var _prevNg = (<any>window).ng; @@ -10,6 +11,7 @@ (<any>window).ngRouter = router; +(<any>window).ngHttp = http; /** * Calling noConflict will restore window.angular to its pre-angular loading state * and return the angular module object.
751d62f275a4f55d4994fa50101cbc0e027594ea
app/touchpad/voice.service.ts
app/touchpad/voice.service.ts
import { Injectable } from '@angular/core'; import artyomjs = require('artyom.js'); const artyom = artyomjs.ArtyomBuilder.getInstance(); @Injectable() export class VoiceService { constructor() { // Get an unique ArtyomJS instance artyom.initialize({ lang: "fr-FR", // GreatBritain english continuous: false, // Listen forever soundex: true,// Use the soundex algorithm to increase accuracy debug: true, // Show messages in the console listen: true // Start to listen commands ! }); } public say(string : String) { console.log("Saying:"+string); artyom.say(string); } public sayGeocodeResult(result : /*google.maps.GeocoderResult*/any) { const address = result.address_components[0].long_name + ' '+ result.address_components[1].long_name; this.say(address); } }
import { Injectable } from '@angular/core'; import artyomjs = require('artyom.js'); @Injectable() export class VoiceService { private voiceProvider: IVoiceProvider = new ArtyomProvider(); constructor() { } public say(text: string) { console.log("Saying: ", text); this.voiceProvider.say(text); } public sayGeocodeResult(result : /*google.maps.GeocoderResult*/any) { const address = result.address_components[0].long_name + ' '+ result.address_components[1].long_name; this.voiceProvider.say(address); } } interface IVoiceProvider { say(text: string): void; } class ArtyomProvider implements IVoiceProvider { readonly artyom = artyomjs.ArtyomBuilder.getInstance(); constructor() { this.artyom.initialize({ lang: "fr-FR", // GreatBritain english continuous: false, // Listen forever soundex: true,// Use the soundex algorithm to increase accuracy debug: true, // Show messages in the console listen: false // Start to listen commands ! }); } public say(text: string): void { this.artyom.say(text); } }
Use a Provider interface to be more generic
Use a Provider interface to be more generic
TypeScript
mit
ABAPlan/abaplan-core,ABAPlan/abaplan-core,ABAPlan/abaplan-core
--- +++ @@ -1,29 +1,46 @@ import { Injectable } from '@angular/core'; import artyomjs = require('artyom.js'); -const artyom = artyomjs.ArtyomBuilder.getInstance(); @Injectable() export class VoiceService { - constructor() { - // Get an unique ArtyomJS instance - artyom.initialize({ - lang: "fr-FR", // GreatBritain english - continuous: false, // Listen forever - soundex: true,// Use the soundex algorithm to increase accuracy - debug: true, // Show messages in the console - listen: true // Start to listen commands ! - }); - } - public say(string : String) { - console.log("Saying:"+string); - artyom.say(string); + private voiceProvider: IVoiceProvider = new ArtyomProvider(); + + constructor() { } + + public say(text: string) { + console.log("Saying: ", text); + this.voiceProvider.say(text); } public sayGeocodeResult(result : /*google.maps.GeocoderResult*/any) { const address = result.address_components[0].long_name + ' '+ result.address_components[1].long_name; - this.say(address); + this.voiceProvider.say(address); } } + + +interface IVoiceProvider { + say(text: string): void; +} + +class ArtyomProvider implements IVoiceProvider { + + readonly artyom = artyomjs.ArtyomBuilder.getInstance(); + + constructor() { + this.artyom.initialize({ + lang: "fr-FR", // GreatBritain english + continuous: false, // Listen forever + soundex: true,// Use the soundex algorithm to increase accuracy + debug: true, // Show messages in the console + listen: false // Start to listen commands ! + }); + } + + public say(text: string): void { + this.artyom.say(text); + } +}
dc28200886abf51cefa597a17267c969793bea26
admin/src/js/app.ts
admin/src/js/app.ts
import * as m from 'mithril'; import Layout from 'components/layout'; import HomePage from 'pages/home'; // import RoutesPage from 'pages/routes'; import PagesPage from 'pages/pages'; import PagePage from 'pages/page'; import LoginPage from 'pages/login'; import ThemePage from 'pages/theme'; import ThemesPage from 'pages/themes'; import TemplatePage from 'pages/template'; import SettingsPage from 'pages/settings'; import DataPage from 'pages/data'; import InstallThemePage from 'pages/install-theme'; import * as WebFont from 'webfontloader'; export let routes: m.RouteDefs = { '/admin': Layout(HomePage), // '/admin/routes': RoutesPage, '/admin/pages': Layout(PagesPage), '/admin/pages/:id': Layout(PagePage), '/admin/compose': Layout(PagePage), '/admin/themes': Layout(ThemesPage), '/admin/themes/:name': Layout(ThemePage), '/admin/themes/:name/templates/:template': Layout(TemplatePage), '/admin/themes-install': Layout(InstallThemePage), '/admin/login': LoginPage, '/admin/settings': Layout(SettingsPage), '/admin/data': Layout(DataPage) }; document.addEventListener('DOMContentLoaded', () => { WebFont.load({ google: { families: ['Permanent Marker'] } }); let root = document.getElementById('app'); m.route.prefix(''); m.route(root, '/admin', routes); });
import * as m from 'mithril'; import Layout from 'components/layout'; import HomePage from 'pages/home'; // import RoutesPage from 'pages/routes'; import PagesPage from 'pages/pages'; import PagePage from 'pages/page'; import LoginPage from 'pages/login'; import ThemePage from 'pages/theme'; import ThemesPage from 'pages/themes'; import TemplatePage from 'pages/template'; import SettingsPage from 'pages/settings'; import DataPage from 'pages/data'; import InstallThemePage from 'pages/install-theme'; import * as WebFont from 'webfontloader'; export let routes: m.RouteDefs = { '/admin': Layout(HomePage), // '/admin/routes': RoutesPage, '/admin/pages': Layout(PagesPage), '/admin/pages/:id': Layout(PagePage), '/admin/compose': Layout(PagePage), '/admin/themes': Layout(ThemesPage), '/admin/themes/:name': Layout(ThemePage), '/admin/themes/:name/templates/:template...': Layout(TemplatePage), '/admin/themes-install': Layout(InstallThemePage), '/admin/login': LoginPage, '/admin/settings': Layout(SettingsPage), '/admin/data': Layout(DataPage) }; document.addEventListener('DOMContentLoaded', () => { WebFont.load({ google: { families: ['Permanent Marker'] } }); let root = document.getElementById('app'); m.route.prefix(''); m.route(root, '/admin', routes); });
Fix bug with showing nested templates.
admin: Fix bug with showing nested templates.
TypeScript
apache-2.0
ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup,ketchuphq/ketchup
--- +++ @@ -24,7 +24,7 @@ '/admin/compose': Layout(PagePage), '/admin/themes': Layout(ThemesPage), '/admin/themes/:name': Layout(ThemePage), - '/admin/themes/:name/templates/:template': Layout(TemplatePage), + '/admin/themes/:name/templates/:template...': Layout(TemplatePage), '/admin/themes-install': Layout(InstallThemePage), '/admin/login': LoginPage, '/admin/settings': Layout(SettingsPage),
774dc6c77c66c242fb59cdc42da6f641a3281377
src/app/app.routing.ts
src/app/app.routing.ts
import {Routes, RouterModule} from '@angular/router'; import {ModuleWithProviders} from '@angular/core'; import {HomeComponent} from './home/home.component'; import {ResultsComponent} from './results/results.component'; import {AboutComponent} from './about/about.component'; import {ContactComponent} from './contact/contact.component'; import {ProductDetailsComponent} from './product-details/product-details.component'; const appRoutes: Routes = [ {path: 'home', component: HomeComponent}, {path: 'results/:searchText', component: ResultsComponent}, {path: 'details/:id', component: ProductDetailsComponent}, {path: 'about', component: AboutComponent}, {path: 'contact', component: ContactComponent}, {path: '', redirectTo: '/home', pathMatch: 'full'}, {path: '**', redirectTo: '/home', pathMatch: 'full'} ]; export const appRoutingProviders: any[] = []; export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, {useHash: true});
import {Routes, RouterModule} from '@angular/router'; import {ModuleWithProviders} from '@angular/core'; import {HomeComponent} from './home/home.component'; import {ResultsComponent} from './results/results.component'; import {AboutComponent} from './about/about.component'; import {ContactComponent} from './contact/contact.component'; import {ProductDetailsComponent} from './product-details/product-details.component'; const appRoutes: Routes = [ {path: 'home', component: HomeComponent}, {path: 'results/:searchText', component: ResultsComponent}, {path: 'details/:id/:name', component: ProductDetailsComponent}, {path: 'about', component: AboutComponent}, {path: 'contact', component: ContactComponent}, {path: '', redirectTo: '/home', pathMatch: 'full'}, {path: '**', redirectTo: '/home', pathMatch: 'full'} ]; export const appRoutingProviders: any[] = []; export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes, {useHash: true});
Add name parameter to details route
Add name parameter to details route
TypeScript
bsd-3-clause
UoA-eResearch/research-hub,UoA-eResearch/research-hub,UoA-eResearch/research-hub
--- +++ @@ -11,7 +11,7 @@ const appRoutes: Routes = [ {path: 'home', component: HomeComponent}, {path: 'results/:searchText', component: ResultsComponent}, - {path: 'details/:id', component: ProductDetailsComponent}, + {path: 'details/:id/:name', component: ProductDetailsComponent}, {path: 'about', component: AboutComponent}, {path: 'contact', component: ContactComponent}, {path: '', redirectTo: '/home', pathMatch: 'full'},
1c0b146b6b0c968c10c1436abec99d9c336a1458
src/lib/grid-search.component.ts
src/lib/grid-search.component.ts
import { Component, Inject, Optional } from '@angular/core'; import { TubularGrid } from './grid.component'; import { SETTINGS_PROVIDER, ITubularSettingsProvider } from './tubular-settings.service'; @Component({ selector: 'grid-search', template: `<div> <div class="input-group input-group-sm"> <span class="input-group-addon"><i class="fa fa-search"></i></span> <input #toSearch type="text" class="form-control" [ngModel]="search" (ngModelChange)="setSearch($event)" placeholder="search . . ." /> <span class="input-group-btn" [hidden]="!toSearch.value"> <button class="btn btn-default" (click)="clearInput()"> <i class="fa fa-times-circle"></i> </button> </span> </div> </div>` }) export class GridSearch { search: string; constructor(@Optional() @Inject(SETTINGS_PROVIDER) private settingsProvider: ITubularSettingsProvider, private tbGrid: TubularGrid) { } ngOnInit() { // TODO: Restore value from localstorage? } clearInput() { this.tbGrid.freeTextSearch.next(""); this.search = ""; } setSearch(event: any) { this.tbGrid.freeTextSearch.next(event); } }
import { Component, Inject, Optional } from '@angular/core'; import { TubularGrid } from './grid.component'; import { SETTINGS_PROVIDER, ITubularSettingsProvider } from './tubular-settings.service'; @Component({ selector: 'grid-search', template: `<div> <div class="input-group input-group-sm"> <span class="input-group-addon"><i class="fa fa-search"></i></span> <input #toSearch type="text" class="form-control" [(ngModel)]="search" (ngModelChange)="setSearch($event)" placeholder="search . . ." /> <span class="input-group-btn" [hidden]="!toSearch.value"> <button class="btn btn-default" (click)="clearInput()"> <i class="fa fa-times-circle"></i> </button> </span> </div> </div>` }) export class GridSearch { search: string; constructor(@Optional() @Inject(SETTINGS_PROVIDER) private settingsProvider: ITubularSettingsProvider, private tbGrid: TubularGrid) { } ngOnInit() { // TODO: Restore value from localstorage? } clearInput() { this.tbGrid.freeTextSearch.next(""); this.search = ""; } setSearch(event: any) { this.tbGrid.freeTextSearch.next(event); } }
Fix bug in search input
Fix bug in search input
TypeScript
mit
unosquare/tubular2,unosquare/tubular2,unosquare/tubular2,unosquare/tubular2
--- +++ @@ -9,7 +9,7 @@ <div class="input-group input-group-sm"> <span class="input-group-addon"><i class="fa fa-search"></i></span> <input #toSearch type="text" class="form-control" - [ngModel]="search" + [(ngModel)]="search" (ngModelChange)="setSearch($event)" placeholder="search . . ." /> <span class="input-group-btn" [hidden]="!toSearch.value">
df8adc44284fb08d86f70695aeea28720f391c73
app/ts/tourabu_content.ts
app/ts/tourabu_content.ts
'use strict'; module TourabuEx.content { chrome.runtime.sendMessage({ type: 'content/load', body: {} }); chrome.runtime.onMessage.addListener((mes, sender, callback) => { if (mes.type === 'capture/start') { callback(getDimension()); } }); function getDimension(): TourabuEx.capture.Dimension { var gameFrame = <any>document.querySelector('#game_frame'), got = gameFrame.offsetTop, gol = gameFrame.offsetLeft, gw = gameFrame.offsetWidth, wsy = (<any>window).scrollY, wsx = (<any>window).scrollX, wiw = window.innerWidth, wih = window.innerHeight; return { y: got - wsy, x: gol - wsx, width: Math.min(gw, wiw), height: Math.min(Math.floor(580 * (gw / 960)), wih) }; } }
'use strict'; module TourabuEx.content { chrome.runtime.sendMessage({ type: 'content/load', body: {} }); chrome.runtime.onMessage.addListener((mes, sender, callback) => { if (mes.type === 'capture/start') { callback(getDimension()); } }); function getDimension(): TourabuEx.capture.Dimension { var gameFrame = $('#game_frame'), offset = gameFrame.offset(), got = offset.top, gol = offset.left, gw = gameFrame[0].offsetWidth, wsy = (<any>window).scrollY, wsx = (<any>window).scrollX, wiw = window.innerWidth, wih = window.innerHeight; return { y: got - wsy, x: gol - wsx, width: Math.min(gw, wiw), height: Math.min(Math.floor(580 * (gw / 960)), wih) }; } }
Fix problem with screen capture
Fix problem with screen capture
TypeScript
mit
ayachigin/tourabu-extension,ayachigin/tourabu-extension,ayachigin/tourabu-extension
--- +++ @@ -13,10 +13,11 @@ }); function getDimension(): TourabuEx.capture.Dimension { - var gameFrame = <any>document.querySelector('#game_frame'), - got = gameFrame.offsetTop, - gol = gameFrame.offsetLeft, - gw = gameFrame.offsetWidth, + var gameFrame = $('#game_frame'), + offset = gameFrame.offset(), + got = offset.top, + gol = offset.left, + gw = gameFrame[0].offsetWidth, wsy = (<any>window).scrollY, wsx = (<any>window).scrollX, wiw = window.innerWidth,
70222568f8ece6153b878ff82d021e3699460a75
packages/ajv/src/validate.pre-hook.ts
packages/ajv/src/validate.pre-hook.ts
import { Hook, HttpResponseBadRequest, ObjectType } from '@foal/core'; import * as Ajv from 'ajv'; const defaultInstance = new Ajv(); export function validate(schema: ObjectType, ajv = defaultInstance): Hook { const isValid = ajv.compile(schema); return ctx => { if (!isValid(ctx.body)) { return new HttpResponseBadRequest(isValid.errors as Ajv.ErrorObject[]); } }; }
import { HttpResponseBadRequest, ObjectType, PreHook } from '@foal/core'; import * as Ajv from 'ajv'; const defaultInstance = new Ajv(); export function validate(schema: ObjectType, ajv = defaultInstance): PreHook { const isValid = ajv.compile(schema); return ctx => { if (!isValid(ctx.body)) { return new HttpResponseBadRequest(isValid.errors as Ajv.ErrorObject[]); } }; }
Update @foal/ajv with PreHook type.
Update @foal/ajv with PreHook type.
TypeScript
mit
FoalTS/foal,FoalTS/foal,FoalTS/foal,FoalTS/foal
--- +++ @@ -1,9 +1,9 @@ -import { Hook, HttpResponseBadRequest, ObjectType } from '@foal/core'; +import { HttpResponseBadRequest, ObjectType, PreHook } from '@foal/core'; import * as Ajv from 'ajv'; const defaultInstance = new Ajv(); -export function validate(schema: ObjectType, ajv = defaultInstance): Hook { +export function validate(schema: ObjectType, ajv = defaultInstance): PreHook { const isValid = ajv.compile(schema); return ctx => { if (!isValid(ctx.body)) {
2c04b9977d3f60283839d6fad6863c615abe2295
src/Accordion/Accordion.tsx
src/Accordion/Accordion.tsx
import * as React from 'react'; type AccordionProps = React.HTMLAttributes<HTMLDivElement> & { accordion: boolean; }; const Accordion = ({ accordion, ...rest }: AccordionProps): JSX.Element => { const role = accordion ? 'tablist' : undefined; return <div role={role} {...rest} />; }; export default Accordion;
import * as React from 'react'; type AccordionProps = React.HTMLAttributes<HTMLDivElement> & { accordion: boolean; }; const Accordion = ({ accordion, ...rest }: AccordionProps): JSX.Element => { return <div {...rest} />; }; export default Accordion;
Remove unnecessary tablist role from accordion parent
Remove unnecessary tablist role from accordion parent
TypeScript
mit
springload/react-accessible-accordion,springload/react-accessible-accordion,springload/react-accessible-accordion
--- +++ @@ -5,9 +5,7 @@ }; const Accordion = ({ accordion, ...rest }: AccordionProps): JSX.Element => { - const role = accordion ? 'tablist' : undefined; - - return <div role={role} {...rest} />; + return <div {...rest} />; }; export default Accordion;
1ab0617ad981be6bbb38881c378902aebab1b62e
cli-access-check.ts
cli-access-check.ts
// Load the SDK and UUID import * as AWS from 'aws-sdk' import * as uuid from 'uuid' // Create an S3 client const s3 = new AWS.S3() // Create a bucket and upload something into it const bucketName = `node-sdk-check-${uuid.v4()}` async function main() { try { await s3.createBucket({ Bucket: bucketName }).promise() await s3.deleteBucket({ Bucket: bucketName }).promise() console.log("Successfull") } catch (error) { console.log(error) } } main()
// Load the SDK and UUID import { S3 } from 'aws-sdk' import * as uuid from 'uuid' // Create an S3 client const s3 = new S3() // Create a bucket and upload something into it const bucketName = `node-sdk-check-${uuid.v4()}` async function main() { try { await s3.createBucket({ Bucket: bucketName }).promise() await s3.deleteBucket({ Bucket: bucketName }).promise() console.log("Successfull") } catch (error) { console.log(error) } } main()
Use member import for S3.
Use member import for S3.
TypeScript
mit
go-westeros/aws-devops
--- +++ @@ -1,9 +1,9 @@ // Load the SDK and UUID -import * as AWS from 'aws-sdk' +import { S3 } from 'aws-sdk' import * as uuid from 'uuid' // Create an S3 client -const s3 = new AWS.S3() +const s3 = new S3() // Create a bucket and upload something into it const bucketName = `node-sdk-check-${uuid.v4()}`
449346c169c231874f89010034e9b6d1d0489660
src/service-module/types.ts
src/service-module/types.ts
/* eslint @typescript-eslint/no-explicit-any: 0 */ export interface FeathersVuexOptions { serverAlias: string addOnUpsert?: boolean autoRemove?: boolean debug?: boolean diffOnPatch?: boolean enableEvents?: boolean idField?: string keepCopiesInStore?: boolean nameStyle?: string paramsForServer?: string[] preferUpdate?: boolean replaceItems?: boolean skipRequestIfExists?: boolean whitelist?: string[] } export interface MakeServicePluginOptions { Model: any service: any addOnUpsert?: boolean diffOnPatch?: boolean enableEvents?: boolean idField?: string namespace?: string servicePath?: string state?: {} getters?: {} mutations?: {} actions?: {} }
/* eslint @typescript-eslint/no-explicit-any: 0 */ export interface FeathersVuexOptions { serverAlias: string addOnUpsert?: boolean autoRemove?: boolean debug?: boolean diffOnPatch?: boolean enableEvents?: boolean idField?: string keepCopiesInStore?: boolean nameStyle?: string paramsForServer?: string[] preferUpdate?: boolean replaceItems?: boolean skipRequestIfExists?: boolean whitelist?: string[] } export interface MakeServicePluginOptions { Model: any service: any addOnUpsert?: boolean diffOnPatch?: boolean enableEvents?: boolean idField?: string nameStyle?: string namespace?: string preferUpdate?: boolean servicePath?: string state?: {} getters?: {} mutations?: {} actions?: {} }
Add nameStyle and preferUpdate to interface
Add nameStyle and preferUpdate to interface
TypeScript
mit
feathers-plus/feathers-vuex,feathers-plus/feathers-vuex
--- +++ @@ -26,7 +26,9 @@ diffOnPatch?: boolean enableEvents?: boolean idField?: string + nameStyle?: string namespace?: string + preferUpdate?: boolean servicePath?: string state?: {} getters?: {}
877237181394a1c9b0d66c9fddbe2d83bae804c5
src/app/error/error.component.spec.ts
src/app/error/error.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TitleService } from '../shared/title.service'; import { MockTitleService } from '../shared/mocks/mock-title.service'; import { PageHeroComponent } from '../shared/page-hero/page-hero.component'; import { ErrorComponent } from './error.component'; describe('ErrorComponent', () => { const mockTitleService = new MockTitleService(); let component: ErrorComponent; let fixture: ComponentFixture<ErrorComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ RouterTestingModule ], declarations: [ PageHeroComponent, ErrorComponent ], providers: [ { provide: TitleService, useValue: mockTitleService } ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(ErrorComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create and show 404 text', () => { expect(component).toBeTruthy(); const compiled = fixture.debugElement.nativeElement; expect(compiled.querySelector('.basic-card > h2').textContent) .toContain('Feeling lost? Don’t worry'); }); it('should reset title', () => { expect(mockTitleService.mockTitle).toBe(''); }); });
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { It, Mock, Times } from 'typemoq'; import { TitleService } from '../shared/title.service'; import { PageHeroComponent } from '../shared/page-hero/page-hero.component'; import { ErrorComponent } from './error.component'; describe('ErrorComponent', () => { const mockTitleService = Mock.ofType<TitleService>(); mockTitleService.setup(x => x.setTitle(It.isAnyString())); mockTitleService.setup(x => x.resetTitle()); let component: ErrorComponent; let fixture: ComponentFixture<ErrorComponent>; beforeEach(() => { mockTitleService.reset(); TestBed.configureTestingModule({ imports: [ RouterTestingModule ], declarations: [ PageHeroComponent, ErrorComponent ], providers: [ { provide: TitleService, useFactory: () => mockTitleService.object } ] }) .compileComponents(); fixture = TestBed.createComponent(ErrorComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create and show 404 text', () => { expect(component).toBeTruthy(); const compiled = fixture.debugElement.nativeElement; expect(compiled.querySelector('.basic-card > h2').textContent) .toContain('Feeling lost? Don’t worry'); }); it('should reset title', () => { mockTitleService.verify(s => s.resetTitle(), Times.once()); }); });
Update mock usage for error component test
Update mock usage for error component test
TypeScript
apache-2.0
jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog
--- +++ @@ -1,19 +1,24 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { It, Mock, Times } from 'typemoq'; + import { TitleService } from '../shared/title.service'; -import { MockTitleService } from '../shared/mocks/mock-title.service'; - import { PageHeroComponent } from '../shared/page-hero/page-hero.component'; import { ErrorComponent } from './error.component'; describe('ErrorComponent', () => { - const mockTitleService = new MockTitleService(); + const mockTitleService = Mock.ofType<TitleService>(); + mockTitleService.setup(x => x.setTitle(It.isAnyString())); + mockTitleService.setup(x => x.resetTitle()); + let component: ErrorComponent; let fixture: ComponentFixture<ErrorComponent>; - beforeEach(async(() => { + beforeEach(() => { + mockTitleService.reset(); + TestBed.configureTestingModule({ imports: [ RouterTestingModule ], declarations: [ @@ -21,13 +26,11 @@ ErrorComponent ], providers: [ - { provide: TitleService, useValue: mockTitleService } + { provide: TitleService, useFactory: () => mockTitleService.object } ] }) .compileComponents(); - })); - beforeEach(() => { fixture = TestBed.createComponent(ErrorComponent); component = fixture.componentInstance; fixture.detectChanges(); @@ -42,6 +45,6 @@ }); it('should reset title', () => { - expect(mockTitleService.mockTitle).toBe(''); + mockTitleService.verify(s => s.resetTitle(), Times.once()); }); });
0e5a8a8ffcf231eb0c3a8b93319cc579f2f69aaf
src/components/Found.tsx
src/components/Found.tsx
import * as React from 'react'; import { Observable } from 'rxjs'; import Message from '../model/Message'; import Track from '../model/Track'; import { regexExt, regexM3U } from '../filters'; import FoundList from './FoundList'; import PlaylistItem from './PlaylistItem'; import './Found.css'; interface Props extends React.HTMLProps<HTMLDivElement> { tracks: Track[] } function Found(props: Props) { const tracks = props.tracks.filter(({ href }) => regexExt.test(href)); const playlists = props.tracks.filter(({ href }) => regexM3U.test(href)); return ( <div className="Found"> <strong>ON THIS PAGE</strong> <div> {tracks.length > 0 && <FoundList tracks={tracks} /> } {playlists.length > 0 && playlists.map(playlist => <PlaylistItem key={playlist.href} track={playlist} /> )} </div> </div> ); } export default Found;
import * as React from 'react'; import { Observable } from 'rxjs'; import Message from '../model/Message'; import Track from '../model/Track'; import { regexExt, regexM3U } from '../filters'; import FoundList from './FoundList'; import PlaylistItem from './PlaylistItem'; import './Found.css'; interface Props extends React.HTMLProps<HTMLDivElement> { tracks: Track[] } function Found(props: Props) { const tracks = props.tracks.filter(({ href }) => !regexM3U.test(href)); const playlists = props.tracks.filter(({ href }) => regexM3U.test(href)); return ( <div className="Found"> <strong>ON THIS PAGE</strong> <div> {tracks.length > 0 && <FoundList tracks={tracks} /> } {playlists.length > 0 && playlists.map(playlist => <PlaylistItem key={playlist.href} track={playlist} /> )} </div> </div> ); } export default Found;
Support tracks with correct mime type.
Support tracks with correct mime type.
TypeScript
mit
soflete/extereo,soflete/extereo
--- +++ @@ -12,7 +12,7 @@ } function Found(props: Props) { - const tracks = props.tracks.filter(({ href }) => regexExt.test(href)); + const tracks = props.tracks.filter(({ href }) => !regexM3U.test(href)); const playlists = props.tracks.filter(({ href }) => regexM3U.test(href)); return ( <div className="Found">
a9c9d70b213a2e27c53fbb41dd1ffaef759fb7fb
packages/game/src/game/components/PlayerInfo.tsx
packages/game/src/game/components/PlayerInfo.tsx
import * as React from 'react'; import { Small, Text } from 'rebass'; import InfoPane from 'game/components/InfoPane'; import { Player, User, Values } from '@battles/models'; import { userInfo } from 'os'; type PlayerInfoProps = { user: User; player: Player; isActive: boolean; }; const PlayerInfo: React.StatelessComponent<PlayerInfoProps> = ({ player, user, isActive }) => { return ( <InfoPane> <Text color={Values.ColourStrings[player.data.colour]}> {user.data.name} ({player.data.id}) <Small color="black">{isActive ? '(Active)' : ''}</Small> </Text> <Small> <Text> Gold {player.data.gold} (+ {player.data.goldProduction + player.territories.map((territory) => territory.goldProduction).reduce((a, b) => a + b, 0)} ) </Text> <Text>Victory Points {player.victoryPoints}</Text> <Text>{player.data.ready ? 'Ready' : 'Not Ready'}</Text> </Small> </InfoPane> ); }; export default PlayerInfo;
import * as React from 'react'; import { Small, Text } from 'rebass'; import InfoPane from 'game/components/InfoPane'; import { Player, User, Values } from '@battles/models'; import { userInfo } from 'os'; type PlayerInfoProps = { user: User; player: Player; isActive: boolean; }; const PlayerInfo: React.StatelessComponent<PlayerInfoProps> = ({ player, user, isActive }) => { return ( <InfoPane> <Text color={Values.ColourStrings[player.data.colour]}> {user.data.name} ({player.data.id}) <Small color="black">{isActive ? '(Active)' : ''}</Small> </Text> <Small> <Text> Gold {player.data.gold} (+ {player.data.goldProduction + player.territories.map((territory) => territory.goldProduction).reduce((a, b) => a + b, 0)} ) </Text> <Text>Victory Points {player.victoryPoints}</Text> </Small> </InfoPane> ); }; export default PlayerInfo;
Remove ready state from player info
Remove ready state from player info
TypeScript
mit
tomwwright/graph-battles,tomwwright/graph-battles,tomwwright/graph-battles
--- +++ @@ -24,7 +24,6 @@ ) </Text> <Text>Victory Points {player.victoryPoints}</Text> - <Text>{player.data.ready ? 'Ready' : 'Not Ready'}</Text> </Small> </InfoPane> );
e5edd900d2fbf36eb0fbe3747574740451631543
spec/performance/performance-suite.ts
spec/performance/performance-suite.ts
import { runBenchmarks } from './support/runner'; import { BenchmarkConfig, BenchmarkFactories } from './support/async-bench'; import { QUERY_BENCHMARKS } from './profiling/query-pipeline.perf'; import { COMPARISON } from './comparison/comparison'; import { runComparisons } from './support/compare-runner'; import { GraphQLHTTPTestEndpoint } from '../helpers/grapqhl-http-test/graphql-http-test-endpoint'; new GraphQLHTTPTestEndpoint().start(1337); const benchmarks: BenchmarkFactories = [ ...QUERY_BENCHMARKS ]; const comparisons: BenchmarkConfig[][] = [ //COMPARISON ]; async function run() { await runBenchmarks(benchmarks); for (const comparison of comparisons) { await runComparisons(comparison); } } run();
import { runBenchmarks } from './support/runner'; import { BenchmarkConfig, BenchmarkFactories } from './support/async-bench'; import { QUERY_BENCHMARKS } from './profiling/query-pipeline.perf'; import { COMPARISON } from './comparison/comparison'; import { runComparisons } from './support/compare-runner'; import { GraphQLHTTPTestEndpoint } from '../helpers/grapqhl-http-test/graphql-http-test-endpoint'; new GraphQLHTTPTestEndpoint().start(1337); const benchmarks: BenchmarkFactories = [ ...QUERY_BENCHMARKS ]; const comparisons: BenchmarkConfig[][] = [ COMPARISON ]; async function run() { await runBenchmarks(benchmarks); for (const comparison of comparisons) { await runComparisons(comparison); } } run();
Enable comparison benchmark by default
Enable comparison benchmark by default
TypeScript
mit
AEB-labs/graphql-weaver,AEB-labs/graphql-weaver
--- +++ @@ -12,7 +12,7 @@ ]; const comparisons: BenchmarkConfig[][] = [ - //COMPARISON + COMPARISON ]; async function run() {
5ec570b4ab8ac27c0e4739c2cd586f7d8b0ed9b3
src/utils/string-utils.ts
src/utils/string-utils.ts
// TODO: Add tests function signCharacter(value: number): string { return value < 0 ? '− ' /* U+2212 U+202F */ : ''; } // Prints an integer padded with leading zeroes export function formatInteger(value: number, padding: number): string { const str = value.toFixed(0); return (str.length >= padding) ? str : ('0000000000000000' + str).slice(-padding); } // Prints "H:MM" or "M:SS" with a given separator. export function formatTime2(value: number, separator: string): string { const sign = signCharacter(value); value = Math.abs(value); value = Math.floor(value); const high = Math.floor(value / 60); const low = value % 60; return sign + formatInteger(high, 1) + separator + formatInteger(low, 2); } // Prints "H:MM:SS" with a given separator. export function formatTime3(value: number, separator: string): string { const sign = signCharacter(value); value = Math.abs(value); value = Math.floor(value); const hour = Math.floor(value / 3600); const min = Math.floor(value / 60) % 60; const sec = value % 60; return sign + formatInteger(hour, 1) + separator + formatInteger(min, 2) + separator + formatInteger(sec, 2); }
// TODO: Add tests function signCharacter(value: number): string { return value < 0 ? '−' /* U+2212 */ : ''; } // Prints an integer padded with leading zeroes export function formatInteger(value: number, padding: number): string { const str = value.toFixed(0); return (str.length >= padding) ? str : ('0000000000000000' + str).slice(-padding); } // Prints "H:MM" or "M:SS" with a given separator. export function formatTime2(value: number, separator: string): string { const sign = signCharacter(value); value = Math.abs(value); value = Math.floor(value); const high = Math.floor(value / 60); const low = value % 60; return sign + formatInteger(high, 1) + separator + formatInteger(low, 2); } // Prints "H:MM:SS" with a given separator. export function formatTime3(value: number, separator: string): string { const sign = signCharacter(value); value = Math.abs(value); value = Math.floor(value); const hour = Math.floor(value / 3600); const min = Math.floor(value / 60) % 60; const sec = value % 60; return sign + formatInteger(hour, 1) + separator + formatInteger(min, 2) + separator + formatInteger(sec, 2); }
Remove space between minus sign and the number
Remove space between minus sign and the number
TypeScript
apache-2.0
sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile,sth-larp/deus-mobile
--- +++ @@ -1,7 +1,7 @@ // TODO: Add tests function signCharacter(value: number): string { - return value < 0 ? '− ' /* U+2212 U+202F */ : ''; + return value < 0 ? '−' /* U+2212 */ : ''; } // Prints an integer padded with leading zeroes
127325ecb03e36584dc0fd46c984d3344272b8ec
app/scripts/components/route/Suspended.tsx
app/scripts/components/route/Suspended.tsx
import React from 'react'; import { Redirect, Route, RouteProps } from 'react-router-dom'; import Loading from '../page/Loading'; type SuspendedComponent = typeof React.Component | React.LazyExoticComponent<React.ComponentType>; interface SuspendedProps { path: string; component: SuspendedComponent; requireAuth?: boolean; extraProps?: object; } const isLoggedIn = (): boolean => !!localStorage.token; const SuspendedRoute: React.FC<SuspendedProps> = ({ path, component: Component, requireAuth, extraProps }): React.ReactElement => ( <Route path={path} render={(props: RouteProps): React.ReactElement => !requireAuth || isLoggedIn() ? ( <React.Suspense fallback={<Loading isLoading className="wrapper" />}> <Component {...props} {...extraProps} /> </React.Suspense> ) : ( <Redirect to={{ pathname: '/login', state: { from: props.location }, }} /> ) } /> ); export default SuspendedRoute;
import React from 'react'; import { Redirect, Route, RouteProps } from 'react-router-dom'; import Loading from '../page/Loading'; type SuspendedComponent = typeof React.Component | React.FunctionComponent | React.LazyExoticComponent<React.ComponentType>; interface SuspendedProps { path: string; component: SuspendedComponent; requireAuth?: boolean; extraProps?: object; } const isLoggedIn = (): boolean => !!localStorage.token; const SuspendedRoute: React.FC<SuspendedProps> = ({ path, component: Component, requireAuth, extraProps }): React.ReactElement => ( <Route path={path} render={(props: RouteProps): React.ReactElement => !requireAuth || isLoggedIn() ? ( <React.Suspense fallback={<Loading isLoading className="wrapper" />}> <Component {...props} {...extraProps} /> </React.Suspense> ) : ( <Redirect to={{ pathname: '/login', state: { from: props.location }, }} /> ) } /> ); export default SuspendedRoute;
Allow function component type on suspended route
Allow function component type on suspended route
TypeScript
mit
benct/tomlin-web,benct/tomlin-web
--- +++ @@ -3,7 +3,7 @@ import Loading from '../page/Loading'; -type SuspendedComponent = typeof React.Component | React.LazyExoticComponent<React.ComponentType>; +type SuspendedComponent = typeof React.Component | React.FunctionComponent | React.LazyExoticComponent<React.ComponentType>; interface SuspendedProps { path: string;
355ff08e7fd4dcb178694b2920fd5ba204378208
test/HEREMap.tests.tsx
test/HEREMap.tests.tsx
import HEREMap from '../src/HEREMap'; import * as chai from 'chai'; import * as sinon from 'sinon'; import { mount, shallow } from 'enzyme'; import * as React from 'react'; describe('<HEREMap />', () => { it('should call componentDidMount when the component is mounted', () => { const spy = sinon.spy(HEREMap.prototype, 'componentDidMount'); const wrapper = mount(<HEREMap center={{ lat: 0, lng: 0 }} zoom={14} appId='NoiW7CS2CC05ppu95hyL' appCode='28L997fKdiJiY7TVVEsEGQ' />); chai.expect(HEREMap.prototype.componentDidMount).to.have.property('callCount', 1); HEREMap.prototype.componentDidMount.restore(); }); });
import HEREMap from "../src/HEREMap"; import * as chai from "chai"; import * as sinon from "sinon"; import { mount, shallow } from "enzyme"; import * as React from "react"; describe("<HEREMap />", () => { it("should call componentDidMount when the component is mounted", () => { const didMountSpy = sinon.spy(HEREMap.prototype, "componentDidMount"); const wrapper = mount(<HEREMap center={{ lat: 0, lng: 0 }} zoom={14} appId="NoiW7CS2CC05ppu95hyL" appCode="28L997fKdiJiY7TVVEsEGQ" />); chai.expect(HEREMap.prototype.componentDidMount).to.have.property("callCount", 1); // make sure we restore the original method at the end of the test, removing the spy didMountSpy.restore(); }); });
Apply 'restore' method to the spy (instead of method directly) to fix TS error.
Apply 'restore' method to the spy (instead of method directly) to fix TS error.
TypeScript
mit
Josh-ES/react-here-maps,Josh-ES/react-here-maps
--- +++ @@ -1,21 +1,22 @@ -import HEREMap from '../src/HEREMap'; -import * as chai from 'chai'; -import * as sinon from 'sinon'; -import { mount, shallow } from 'enzyme'; -import * as React from 'react'; +import HEREMap from "../src/HEREMap"; +import * as chai from "chai"; +import * as sinon from "sinon"; +import { mount, shallow } from "enzyme"; +import * as React from "react"; -describe('<HEREMap />', () => { +describe("<HEREMap />", () => { - it('should call componentDidMount when the component is mounted', () => { - const spy = sinon.spy(HEREMap.prototype, 'componentDidMount'); + it("should call componentDidMount when the component is mounted", () => { + const didMountSpy = sinon.spy(HEREMap.prototype, "componentDidMount"); const wrapper = mount(<HEREMap center={{ lat: 0, lng: 0 }} zoom={14} - appId='NoiW7CS2CC05ppu95hyL' - appCode='28L997fKdiJiY7TVVEsEGQ' />); + appId="NoiW7CS2CC05ppu95hyL" + appCode="28L997fKdiJiY7TVVEsEGQ" />); - chai.expect(HEREMap.prototype.componentDidMount).to.have.property('callCount', 1); - HEREMap.prototype.componentDidMount.restore(); + chai.expect(HEREMap.prototype.componentDidMount).to.have.property("callCount", 1); + // make sure we restore the original method at the end of the test, removing the spy + didMountSpy.restore(); }); });
6ef495c83fa8837976e76b2055b01820e0cef20f
index.d.ts
index.d.ts
/** * Execute a command cross-platform. * * @param {string} cmd command to execute e.g. `"npm"` * @param {any[]} [args] command argument e.g. `["install", "-g", "git"]` * @param {Partial<crossSpawnPromise.CrossSpawnOptions>} [options] additional options. * @returns {Promise<Uint8Array>} a promise result with `stdout` */ declare function crossSpawnPromise(cmd: string, args?: any[], options?: Partial<crossSpawnPromise.CrossSpawnOptions>): Promise<Uint8Array>; declare namespace crossSpawnPromise { interface CrossSpawnOptions { encoding: string; stdio: string; } interface CrossSpawnError { exitStatus: number; message: string; stack: string; stderr: Uint8Array; stdout: Uint8Array | null; } } export = crossSpawnPromise;
/** * Execute a command cross-platform. * * @param {string} cmd command to execute e.g. `"npm"` * @param {any[]} [args] command argument e.g. `["install", "-g", "git"]` * @param {Partial<crossSpawnPromise.CrossSpawnOptions>} [options] additional options. * @returns {Promise<Uint8Array>} a promise result with `stdout` */ /// <reference types="node" /> declare function crossSpawnPromise(cmd: string, args?: any[], options?: Partial<crossSpawnPromise.CrossSpawnOptions>): Promise<Uint8Array>; import * as child_process from 'child_process'; declare namespace crossSpawnPromise { interface CrossSpawnOptions extends child_process.SpawnOptions { encoding: string; } interface CrossSpawnError { exitStatus: number; message: string; stack: string; stderr: Uint8Array; stdout: Uint8Array | null; } } export = crossSpawnPromise;
Use real SpawnOptions as base for cross spawn promise options
Use real SpawnOptions as base for cross spawn promise options
TypeScript
mit
zentrick/cross-spawn-promise
--- +++ @@ -6,13 +6,16 @@ * @param {Partial<crossSpawnPromise.CrossSpawnOptions>} [options] additional options. * @returns {Promise<Uint8Array>} a promise result with `stdout` */ + +/// <reference types="node" /> + declare function crossSpawnPromise(cmd: string, args?: any[], options?: Partial<crossSpawnPromise.CrossSpawnOptions>): Promise<Uint8Array>; +import * as child_process from 'child_process'; + declare namespace crossSpawnPromise { - - interface CrossSpawnOptions { + interface CrossSpawnOptions extends child_process.SpawnOptions { encoding: string; - stdio: string; } interface CrossSpawnError {
125ac71d6c5519fa2e882a9232a124d026d3f86a
packages/objects/src/index.ts
packages/objects/src/index.ts
export * from './types' export * from './clone' export * from './hasOwnProperty' export * from './invoker' export * from './isEmpty' export * from './keys' export * from './length' export * from './lensPath' export * from './lensProp' export * from './path' export * from './prop' export * from './set' export * from './values'
export * from './types' export * from './clone' export * from './invoker' export * from './isEmpty' export * from './keys' export * from './length' export * from './lensPath' export * from './lensProp' export * from './path' export * from './prop' export * from './set' export * from './values' // export last to avoid conflicts with exports native hasOwnProperty export * from './hasOwnProperty'
Move hasOwnProperty to the last export
Move hasOwnProperty to the last export hasOwnProperty was conflicting with the native hasOwnProperty in the compiled es5 file. This caused exports defined after it to not be included.
TypeScript
mit
TylorS/typed,TylorS/typed
--- +++ @@ -1,7 +1,6 @@ export * from './types' export * from './clone' -export * from './hasOwnProperty' export * from './invoker' export * from './isEmpty' export * from './keys' @@ -12,3 +11,5 @@ export * from './prop' export * from './set' export * from './values' +// export last to avoid conflicts with exports native hasOwnProperty +export * from './hasOwnProperty'
267af79fd179a2cdb05fc126adcb34781f128fc9
src/app/drawing/drawing.component.ts
src/app/drawing/drawing.component.ts
import { Component, OnInit, Inject, ViewChild } from '@angular/core'; import { SketchpadComponent } from '../sketchpad/components/sketchpad/sketchpad.component'; import { AngularFire, FirebaseRef } from 'angularfire2'; @Component({ selector: 'app-drawing', templateUrl: './drawing.component.html', styleUrls: ['./drawing.component.scss'] }) export class DrawingComponent implements OnInit { @ViewChild('sketchpad') sketchpad: SketchpadComponent; public imageName: string; private image: string; private ref: firebase.storage.Reference; constructor(private af: AngularFire, @Inject(FirebaseRef) fb) { this.ref = fb.storage().ref(); } ngOnInit() { } clicked($event) { this.saveCanvasToFirebase(this.sketchpad.canvas, 'images/' + this.imageName); } saveCanvasToFirebase(canvas: HTMLCanvasElement, path: string){ canvas.toBlob(function (blob) { const image = new Image(); this.ref.child(path).put(blob); }); } }
import { Component, OnInit, Inject, ViewChild } from '@angular/core'; import { SketchpadComponent } from '../sketchpad/components/sketchpad/sketchpad.component'; import { AngularFire, FirebaseRef } from 'angularfire2'; @Component({ selector: 'app-drawing', templateUrl: './drawing.component.html', styleUrls: ['./drawing.component.scss'] }) export class DrawingComponent implements OnInit { @ViewChild('sketchpad') sketchpad: SketchpadComponent; public imageName: string; private image: string; private ref: firebase.storage.Reference; constructor(private af: AngularFire, @Inject(FirebaseRef) fb) { console.log(fb); this.ref = fb.storage().ref(); console.log(this.ref); } ngOnInit() { } clicked($event) { this.saveCanvasToFirebase(this.sketchpad.canvas, 'images/' + this.imageName, this.ref); } saveCanvasToFirebase(canvas: HTMLCanvasElement, path: string, ref: firebase.storage.Reference) { canvas.toBlob(function (blob) { const image = new Image(); ref.child(path).put(blob); }); } }
Fix bug with uploading images
Fix bug with uploading images
TypeScript
mit
jonas99y/pythagorasvo21,jonas99y/pythagorasvo21,jonas99y/pythagorasvo21
--- +++ @@ -16,20 +16,23 @@ private ref: firebase.storage.Reference; constructor(private af: AngularFire, @Inject(FirebaseRef) fb) { + console.log(fb); this.ref = fb.storage().ref(); + console.log(this.ref); } ngOnInit() { } + clicked($event) { - this.saveCanvasToFirebase(this.sketchpad.canvas, 'images/' + this.imageName); + this.saveCanvasToFirebase(this.sketchpad.canvas, 'images/' + this.imageName, this.ref); } - saveCanvasToFirebase(canvas: HTMLCanvasElement, path: string){ + saveCanvasToFirebase(canvas: HTMLCanvasElement, path: string, ref: firebase.storage.Reference) { canvas.toBlob(function (blob) { const image = new Image(); - this.ref.child(path).put(blob); + ref.child(path).put(blob); }); } }
4b59ddc3a0bb5859b6e35af043692e0f0332b40b
integrations/plugin-debugger/src/index.ts
integrations/plugin-debugger/src/index.ts
import { HandleRequest } from '@jovotech/framework'; import { JovoDebugger, JovoDebuggerConfig } from './JovoDebugger'; declare module '@jovotech/framework/dist/types/Extensible' { interface ExtensiblePluginConfig { JovoDebugger?: JovoDebuggerConfig; } interface ExtensiblePlugins { JovoDebugger?: JovoDebugger; } } declare module '@jovotech/framework/dist/types/HandleRequest' { interface HandleRequest { debuggerRequestId: number | string; } } HandleRequest.prototype.debuggerRequestId = 0; export * from './DebuggerButton'; export * from './DebuggerConfig'; export * from './JovoDebugger';
import { HandleRequest } from '@jovotech/framework'; import { JovoDebugger, JovoDebuggerConfig } from './JovoDebugger'; declare module '@jovotech/framework/dist/types/Extensible' { interface ExtensiblePluginConfig { JovoDebugger?: JovoDebuggerConfig; } interface ExtensiblePlugins { JovoDebugger?: JovoDebugger; } } declare module '@jovotech/framework/dist/types/HandleRequest' { interface HandleRequest { debuggerRequestId: number | string; } } HandleRequest.prototype.debuggerRequestId = 0; export * from './errors/LanguageModelDirectoryNotFoundError'; export * from './errors/SocketConnectionFailedError'; export * from './errors/SocketNotConnectedError'; export * from './errors/WebhookIdNotFoundError'; export * from './DebuggerButton'; export * from './DebuggerConfig'; export * from './JovoDebugger';
Add missing exports of errors
:sparkles: Add missing exports of errors
TypeScript
apache-2.0
jovotech/jovo-framework-nodejs,jovotech/jovo-framework-nodejs
--- +++ @@ -19,6 +19,11 @@ HandleRequest.prototype.debuggerRequestId = 0; +export * from './errors/LanguageModelDirectoryNotFoundError'; +export * from './errors/SocketConnectionFailedError'; +export * from './errors/SocketNotConnectedError'; +export * from './errors/WebhookIdNotFoundError'; + export * from './DebuggerButton'; export * from './DebuggerConfig'; export * from './JovoDebugger';
06fe1cc070d4366bc72d0da75f871b1ef230ca91
src/main/ts/ephox/sugar/api/view/Width.ts
src/main/ts/ephox/sugar/api/view/Width.ts
import Css from '../properties/Css'; import Dimension from '../../impl/Dimension'; import Element from '../node/Element'; var api = Dimension('width', function (element: Element) { // IMO passing this function is better than using dom['offset' + 'width'] return element.dom().offsetWidth; }); var set = function (element: Element, h: string | number) { api.set(element, h); }; var get = function (element: Element) { return api.get(element); }; var getOuter = function (element: Element) { return api.getOuter(element); }; var setMax = function (element: Element, value: number) { // These properties affect the absolute max-height, they are not counted natively, we want to include these properties. var inclusions = [ 'margin-left', 'border-left-width', 'padding-left', 'padding-right', 'border-right-width', 'margin-right' ]; var absMax = api.max(element, value, inclusions); Css.set(element, 'max-width', absMax + 'px'); }; export default { set, get, getOuter, setMax, };
import Css from '../properties/Css'; import Dimension from '../../impl/Dimension'; import Element from '../node/Element'; import { HTMLElement } from '@ephox/dom-globals'; var api = Dimension('width', function (element: Element) { // IMO passing this function is better than using dom['offset' + 'width'] return (element.dom() as HTMLElement).offsetWidth; }); var set = function (element: Element, h: string | number) { api.set(element, h); }; var get = function (element: Element) { return api.get(element); }; var getOuter = function (element: Element) { return api.getOuter(element); }; var setMax = function (element: Element, value: number) { // These properties affect the absolute max-height, they are not counted natively, we want to include these properties. var inclusions = [ 'margin-left', 'border-left-width', 'padding-left', 'padding-right', 'border-right-width', 'margin-right' ]; var absMax = api.max(element, value, inclusions); Css.set(element, 'max-width', absMax + 'px'); }; export default { set, get, getOuter, setMax, };
Add types to enforce the function returning a number
TINY-1600: Add types to enforce the function returning a number
TypeScript
mit
tinymce/tinymce,FernCreek/tinymce,tinymce/tinymce,TeamupCom/tinymce,FernCreek/tinymce,tinymce/tinymce,FernCreek/tinymce,TeamupCom/tinymce
--- +++ @@ -1,10 +1,11 @@ import Css from '../properties/Css'; import Dimension from '../../impl/Dimension'; import Element from '../node/Element'; +import { HTMLElement } from '@ephox/dom-globals'; var api = Dimension('width', function (element: Element) { // IMO passing this function is better than using dom['offset' + 'width'] - return element.dom().offsetWidth; + return (element.dom() as HTMLElement).offsetWidth; }); var set = function (element: Element, h: string | number) {
8c0bb4e883c03d30507661e7347ad2ad48056b4e
webpack/farmware/__tests__/reducer_test.ts
webpack/farmware/__tests__/reducer_test.ts
import { famrwareReducer } from "../reducer"; import { FarmwareState } from "../interfaces"; import { Actions } from "../../constants"; import { fakeImage } from "../../__test_support__/fake_state/resources"; describe("famrwareReducer", () => { it("Removes UUIDs from state on deletion", () => { const image = fakeImage(); const oldState: FarmwareState = { currentImage: image.uuid }; const newState = famrwareReducer(oldState, { type: Actions.DESTROY_RESOURCE_OK, payload: image }); expect(oldState.currentImage).not.toEqual(newState.currentImage); expect(newState.currentImage).toBeUndefined(); }); it("adds UUID to state on SELECT_IMAGE", () => { const image = fakeImage(); const oldState: FarmwareState = { currentImage: undefined }; const newState = famrwareReducer(oldState, { type: Actions.SELECT_IMAGE, payload: image.uuid }); expect(oldState.currentImage).not.toEqual(newState.currentImage); expect(newState.currentImage).not.toBeUndefined(); expect(newState.currentImage).toBe(image.uuid); }); });
import { famrwareReducer } from "../reducer"; import { FarmwareState } from "../interfaces"; import { Actions } from "../../constants"; import { fakeImage } from "../../__test_support__/fake_state/resources"; describe("famrwareReducer", () => { it("Removes UUIDs from state on deletion", () => { const image = fakeImage(); const oldState: FarmwareState = { currentImage: image.uuid }; const newState = famrwareReducer(oldState, { type: Actions.DESTROY_RESOURCE_OK, payload: image }); expect(oldState.currentImage).not.toEqual(newState.currentImage); expect(newState.currentImage).toBeUndefined(); }); it("adds UUID to state on SELECT_IMAGE", () => { const image = fakeImage(); const oldState: FarmwareState = { currentImage: undefined }; const newState = famrwareReducer(oldState, { type: Actions.SELECT_IMAGE, payload: image.uuid }); expect(oldState.currentImage).not.toEqual(newState.currentImage); expect(newState.currentImage).not.toBeUndefined(); expect(newState.currentImage).toBe(image.uuid); }); it("sets the current image via INIT_RESOURCE", () => { const image = fakeImage(); const oldState: FarmwareState = { currentImage: undefined }; const newState = famrwareReducer(oldState, { type: Actions.INIT_RESOURCE, payload: image }); expect(oldState.currentImage).not.toEqual(newState.currentImage); expect(newState.currentImage).not.toBeUndefined(); expect(newState.currentImage).toBe(image.uuid); }); });
Add test for farmwareReducer INIT_RESOURCE
Add test for farmwareReducer INIT_RESOURCE
TypeScript
mit
gabrielburnworth/Farmbot-Web-App,gabrielburnworth/Farmbot-Web-App,RickCarlino/farmbot-web-app,RickCarlino/farmbot-web-app,FarmBot/Farmbot-Web-API,gabrielburnworth/Farmbot-Web-App,RickCarlino/farmbot-web-app,FarmBot/farmbot-web-app,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,RickCarlino/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,RickCarlino/farmbot-web-app,FarmBot/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,FarmBot/farmbot-web-app
--- +++ @@ -27,4 +27,16 @@ expect(newState.currentImage).not.toBeUndefined(); expect(newState.currentImage).toBe(image.uuid); }); + + it("sets the current image via INIT_RESOURCE", () => { + const image = fakeImage(); + const oldState: FarmwareState = { currentImage: undefined }; + const newState = famrwareReducer(oldState, { + type: Actions.INIT_RESOURCE, + payload: image + }); + expect(oldState.currentImage).not.toEqual(newState.currentImage); + expect(newState.currentImage).not.toBeUndefined(); + expect(newState.currentImage).toBe(image.uuid); + }); });
5f6243668a1f160962a80a439846fe8c49a26bfb
src/testing/support/createElement.ts
src/testing/support/createElement.ts
/** * Create HTML and SVG elements from a valid HTML string. * * NOTE The given HTML must contain only one root element, of type `Element`. */ export function createElement(html: string): Element { return document.createRange().createContextualFragment(html).firstElementChild as Element }
/** * Create HTML and SVG elements from a valid HTML string. * * NOTE The given HTML must contain only one root element, of type `Element`. */ export function createElement(html: string, isSvg = false): Element { if (isSvg) { html = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">${html}</svg>` } const elem = document.createRange().createContextualFragment(html).firstElementChild as Element if (isSvg) { return elem.firstElementChild as Element } return elem }
Add support for SVG element creation
Add support for SVG element creation
TypeScript
agpl-3.0
inad9300/Soil,inad9300/Soil
--- +++ @@ -3,6 +3,13 @@ * * NOTE The given HTML must contain only one root element, of type `Element`. */ -export function createElement(html: string): Element { - return document.createRange().createContextualFragment(html).firstElementChild as Element +export function createElement(html: string, isSvg = false): Element { + if (isSvg) { + html = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">${html}</svg>` + } + const elem = document.createRange().createContextualFragment(html).firstElementChild as Element + if (isSvg) { + return elem.firstElementChild as Element + } + return elem }
deafb704c066e75dc7c826c2a2eb47cf42022b86
src/ts/content/chat/URLWhitelist.tsx
src/ts/content/chat/URLWhitelist.tsx
/** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const whitelist = [ /twimg.com$/, /fbcdn.net$/, /imgur.com$/, /trillian.im$/ ]; function ok(text:string) { const re : RegExp = /http[s]*:\/\/([^/]*)/; let i : number; let match: RegExpExecArray = re.exec(text); if (match) { for (i = 0; i < whitelist.length; i++) { if (whitelist[i].exec(match[1])) { console.log(text + ' is whitelisted'); return true; } } } } function isImage(text:string) { return text.split('?')[0].match(/\.jpg$|\.jpeg$|\.png$|\.gif$/); } export default { ok, isImage }
/** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const whitelist = [ /twimg.com$/, /fbcdn.net$/, /imgur.com$/, /trillian.im$/, /imageshack.com$/, /postimage.org$/, /staticflickr.com$/, /tinypic.com$/, /photobucket.com$/, /cdninstagram.com$/, /deviantart.net$/, /imagebam.com$/, /dropboxusercontent.com$/, /whicdn.com$/, /smugmug.com$/, ]; function ok(text:string) { const re : RegExp = /http[s]*:\/\/([^/]*)/; let i : number; let match: RegExpExecArray = re.exec(text); if (match) { for (i = 0; i < whitelist.length; i++) { if (whitelist[i].exec(match[1])) { console.log(text + ' is whitelisted'); return true; } } } } function isImage(text:string) { return text.split('?')[0].match(/\.jpg$|\.jpeg$|\.png$|\.gif$/); } export default { ok, isImage }
Add a bunch of image sharing websites to white list
Add a bunch of image sharing websites to white list
TypeScript
mpl-2.0
jamkoo/cu-patcher-ui,saddieeiddas/cu-patcher-ui,jamkoo/cu-patcher-ui,saddieeiddas/cu-patcher-ui,stanley85/cu-patcher-ui,stanley85/cu-patcher-ui,saddieeiddas/cu-patcher-ui
--- +++ @@ -8,7 +8,18 @@ /twimg.com$/, /fbcdn.net$/, /imgur.com$/, - /trillian.im$/ + /trillian.im$/, + /imageshack.com$/, + /postimage.org$/, + /staticflickr.com$/, + /tinypic.com$/, + /photobucket.com$/, + /cdninstagram.com$/, + /deviantart.net$/, + /imagebam.com$/, + /dropboxusercontent.com$/, + /whicdn.com$/, + /smugmug.com$/, ]; function ok(text:string) {
fa4bc79cecb2488032c5e581f8b1227d00a712a3
desktop/src/renderer/components/app-settings/app-settings-plugins/app-settings-plugins.tsx
desktop/src/renderer/components/app-settings/app-settings-plugins/app-settings-plugins.tsx
import { Component, h, State } from '@stencil/core' import { CHANNEL } from '../../../../preload/index' import { getAvailablePlugins, pluginStore } from './pluginStore' import { i18n } from '../../../../i18n' @Component({ tag: 'app-settings-plugins', styleUrl: 'app-settings-plugins.css', scoped: true, }) export class AppSettingsPlugins { @State() plugins: Plugin[] = [] @State() inProgress: boolean async componentWillLoad() { return getAvailablePlugins() } private checkForUpdates = () => { this.inProgress = true window.api.invoke(CHANNEL.REFRESH_PLUGINS).finally(() => { this.inProgress = false }) } render() { return ( <div class="appSettingsPlugins"> <div class="title"> <h1>{i18n.t('settings.plugins.title')}</h1> <stencila-button onClick={this.checkForUpdates} size="xsmall" color="neutral" > {i18n.t('settings.plugins.checkUpdates')} </stencila-button> </div> {pluginStore.plugins.ids.map((pluginName) => ( <plugin-card pluginName={pluginName}></plugin-card> ))} </div> ) } }
import { Component, h, State } from '@stencil/core' import { CHANNEL } from '../../../../preload/index' import { getAvailablePlugins, pluginStore } from './pluginStore' import { i18n } from '../../../../i18n' @Component({ tag: 'app-settings-plugins', styleUrl: 'app-settings-plugins.css', scoped: true, }) export class AppSettingsPlugins { @State() plugins: Plugin[] = [] @State() inProgress: boolean async componentWillLoad() { return getAvailablePlugins() } private checkForUpdates = () => { this.inProgress = true window.api.invoke(CHANNEL.REFRESH_PLUGINS).finally(() => { this.inProgress = false }) } render() { return ( <div class="appSettingsPlugins"> <div class="title"> <h1>{i18n.t('settings.plugins.title')}</h1> <stencila-button onClick={this.checkForUpdates} size="xsmall" color="neutral" > {i18n.t('settings.plugins.checkUpdates')} </stencila-button> </div> {pluginStore.plugins.ids.map((pluginName) => ( <app-settings-plugin-card pluginName={pluginName}></app-settings-plugin-card> ))} </div> ) } }
Fix rendering of available plugins
fix(Plugins): Fix rendering of available plugins
TypeScript
apache-2.0
stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila
--- +++ @@ -39,7 +39,7 @@ </stencila-button> </div> {pluginStore.plugins.ids.map((pluginName) => ( - <plugin-card pluginName={pluginName}></plugin-card> + <app-settings-plugin-card pluginName={pluginName}></app-settings-plugin-card> ))} </div> )
7f6e56fdcf3dcead2cb7f1fd11cb41fd10084824
packages/@sanity/diff/src/calculate/diffSimple.ts
packages/@sanity/diff/src/calculate/diffSimple.ts
import {SimpleDiff, DiffOptions, NoDiff, NumberInput, BooleanInput} from '../types' export function diffSimple<A, I extends NumberInput<A> | BooleanInput<A>>( fromInput: I, toInput: I, options: DiffOptions ): SimpleDiff<A> | NoDiff { const fromValue = fromInput.value const toValue = toInput.value if (fromValue !== toValue) return { type: 'unchanged', fromValue, toValue, isChanged: false } return { type: fromInput.type, isChanged: true, fromValue: fromValue as any, toValue: toValue as any, annotation: toInput.annotation } }
import {SimpleDiff, DiffOptions, NoDiff, NumberInput, BooleanInput} from '../types' export function diffSimple<A, I extends NumberInput<A> | BooleanInput<A>>( fromInput: I, toInput: I, options: DiffOptions ): SimpleDiff<A> | NoDiff { const fromValue = fromInput.value const toValue = toInput.value if (fromValue === toValue) return { type: 'unchanged', fromValue, toValue, isChanged: false } return { type: fromInput.type, isChanged: true, fromValue: fromValue as any, toValue: toValue as any, annotation: toInput.annotation } }
Fix inverted change detection for simple diffs
[diff] Fix inverted change detection for simple diffs
TypeScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -8,7 +8,7 @@ const fromValue = fromInput.value const toValue = toInput.value - if (fromValue !== toValue) + if (fromValue === toValue) return { type: 'unchanged', fromValue,
c0bb083d1fcd3af5cea489108de5a514a166bb4f
app/shared/map-field.ts
app/shared/map-field.ts
export class MapField { label: string; namespace: string; name: string; uri: string; guidelines: string; source: string; definition: string; obligation: string; range: any; repeatable: boolean; input: string; visible: boolean; }
export class MapField { label: string; namespace: string; name: string; uri: string; guidelines: string; source: string; definition: string; obligation: string; range: any; repeatable: boolean; input: string; visible: boolean; editable: boolean; }
Add 'editable' to MapField class
Add 'editable' to MapField class
TypeScript
mit
uhlibraries-digital/brays,uhlibraries-digital/brays,uhlibraries-digital/brays
--- +++ @@ -11,4 +11,5 @@ repeatable: boolean; input: string; visible: boolean; + editable: boolean; }
83e83c472f1865c86d036e3966427e19c1b35d79
srcts/react-ui/CenteredIcon.tsx
srcts/react-ui/CenteredIcon.tsx
import * as React from "react"; import classNames from "../modules/classnames"; export interface CenteredIconProps extends React.HTMLProps<HTMLSpanElement> { iconProps?:React.HTMLProps<HTMLImageElement> } export interface CenteredIconState { } export default class CenteredIcon extends React.Component<CenteredIconProps, CenteredIconState> { private element:HTMLElement; constructor(props:CenteredIconProps) { super(props); } render() { return ( <button ref={(e:HTMLButtonElement) => this.element = e} {...this.props} className={classNames("weave-transparent-button", this.props.className || "weave-icon")} > { this.props.children || ( <i {...this.props.iconProps} /> ) } </button> ) } }
import * as React from "react"; import * as _ from "lodash"; import classNames from "../modules/classnames"; export interface CenteredIconProps extends React.HTMLProps<HTMLSpanElement> { iconProps?:React.HTMLProps<HTMLImageElement> } export interface CenteredIconState { } export default class CenteredIcon extends React.Component<CenteredIconProps, CenteredIconState> { constructor(props:CenteredIconProps) { super(props) } render() { return ( <button {...this.props} className={classNames("weave-transparent-button", this.props.className || "weave-icon")} > { this.props.children || ( <i {...this.props.iconProps} /> ) } </button> ) } }
Revert "Icon now take focus on mouse enter"
Revert "Icon now take focus on mouse enter" This reverts commit 3c3843bc0538ae76d749b973ecc41f7fa707f37c.
TypeScript
mpl-2.0
WeaveTeam/WeaveJS,WeaveTeam/WeaveJS,WeaveTeam/WeaveJS,WeaveTeam/WeaveJS
--- +++ @@ -1,4 +1,5 @@ import * as React from "react"; +import * as _ from "lodash"; import classNames from "../modules/classnames"; export interface CenteredIconProps extends React.HTMLProps<HTMLSpanElement> @@ -12,18 +13,15 @@ export default class CenteredIcon extends React.Component<CenteredIconProps, CenteredIconState> { - private element:HTMLElement; - constructor(props:CenteredIconProps) { - super(props); + super(props) } render() { return ( <button - ref={(e:HTMLButtonElement) => this.element = e} {...this.props} className={classNames("weave-transparent-button", this.props.className || "weave-icon")} >
abcae859a91690217f608cf4b0c7d489b1c27edf
client/src/app/plants/bed.component.ts
client/src/app/plants/bed.component.ts
import { Component, OnInit } from '@angular/core'; import { PlantListService } from "./plant-list.service"; import { Plant } from "./plant"; import { FilterBy } from "./filter.pipe"; import {Params, ActivatedRoute} from "@angular/router"; @Component({ selector: 'bed-component', templateUrl: 'bed.component.html', providers: [ FilterBy ] }) export class BedComponent implements OnInit { public bed : string; public plants: Plant[]; constructor(private plantListService: PlantListService, private route: ActivatedRoute) { // this.plants = this.plantListService.getPlants() //Get the bed from the params of the route this.bed = this.route.snapshot.params["gardenLocation"]; } ngOnInit(): void { //Form the URL for the plant list request for this bed let filterUrl = "?gardenLocation=" + this.bed; this.plantListService.getFlowersByFilter(filterUrl).subscribe ( plants => this.plants = plants, err => { console.log(err); } ); } }
import { Component, OnInit } from '@angular/core'; import { PlantListService } from "./plant-list.service"; import { Plant } from "./plant"; import {Params, ActivatedRoute} from "@angular/router"; @Component({ selector: 'bed-component', templateUrl: 'bed.component.html', }) export class BedComponent implements OnInit { public bed : string; public plants: Plant[]; constructor(private plantListService: PlantListService, private route: ActivatedRoute) { // this.plants = this.plantListService.getPlants() //Get the bed from the params of the route this.bed = this.route.snapshot.params["gardenLocation"]; } ngOnInit(): void { //Form the URL for the plant list request for this bed let filterUrl = "?gardenLocation=" + this.bed; this.plantListService.getFlowersByFilter(filterUrl).subscribe ( plants => this.plants = plants, err => { console.log(err); } ); } }
Remove unneeded reference to FilterBy
Remove unneeded reference to FilterBy
TypeScript
mit
UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner
--- +++ @@ -1,13 +1,11 @@ import { Component, OnInit } from '@angular/core'; import { PlantListService } from "./plant-list.service"; import { Plant } from "./plant"; -import { FilterBy } from "./filter.pipe"; import {Params, ActivatedRoute} from "@angular/router"; @Component({ selector: 'bed-component', templateUrl: 'bed.component.html', - providers: [ FilterBy ] }) export class BedComponent implements OnInit {
5c080d2585915d85e8404ed06532dbe47f5887c1
packages/docusaurus-plugin-typedoc/src/theme/theme.ts
packages/docusaurus-plugin-typedoc/src/theme/theme.ts
import MarkdownTheme from 'typedoc-plugin-markdown/dist/theme'; import { Renderer } from 'typedoc/dist/lib/output/renderer'; import { DocsaurusFrontMatterComponent } from './front-matter-component'; export default class DocusaurusTheme extends MarkdownTheme { constructor(renderer: Renderer, basePath: string) { super(renderer, basePath); renderer.addComponent('docusaurus-frontmatter', new DocsaurusFrontMatterComponent(renderer)); } }
import MarkdownTheme from 'typedoc-plugin-markdown/dist/theme'; import { PageEvent } from 'typedoc/dist/lib/output/events'; import { Renderer } from 'typedoc/dist/lib/output/renderer'; import { DocsaurusFrontMatterComponent } from './front-matter-component'; export default class DocusaurusTheme extends MarkdownTheme { constructor(renderer: Renderer, basePath: string) { super(renderer, basePath); this.listenTo(renderer, PageEvent.END, this.onDocusaurusPageEnd, 1024); super(renderer, basePath); renderer.addComponent( 'docusaurus-frontmatter', new DocsaurusFrontMatterComponent(renderer), ); } private onDocusaurusPageEnd(page: PageEvent) { page.contents = page.contents.replace(/</g, '‹').replace(/>/g, '›'); } }
Replace all angle brackets for full `mdx` support
Replace all angle brackets for full `mdx` support
TypeScript
mit
tgreyuk/typedoc-plugin-markdown,tgreyuk/typedoc-plugin-markdown
--- +++ @@ -1,4 +1,5 @@ import MarkdownTheme from 'typedoc-plugin-markdown/dist/theme'; +import { PageEvent } from 'typedoc/dist/lib/output/events'; import { Renderer } from 'typedoc/dist/lib/output/renderer'; import { DocsaurusFrontMatterComponent } from './front-matter-component'; @@ -6,6 +7,15 @@ export default class DocusaurusTheme extends MarkdownTheme { constructor(renderer: Renderer, basePath: string) { super(renderer, basePath); - renderer.addComponent('docusaurus-frontmatter', new DocsaurusFrontMatterComponent(renderer)); + this.listenTo(renderer, PageEvent.END, this.onDocusaurusPageEnd, 1024); + super(renderer, basePath); + renderer.addComponent( + 'docusaurus-frontmatter', + new DocsaurusFrontMatterComponent(renderer), + ); + } + + private onDocusaurusPageEnd(page: PageEvent) { + page.contents = page.contents.replace(/</g, '‹').replace(/>/g, '›'); } }
926dd6e83da4d45702f7940c55978568568deb86
appbuilder/appbuilder-bootstrap.ts
appbuilder/appbuilder-bootstrap.ts
require("../bootstrap"); $injector.require("projectConstants", "./appbuilder/project-constants"); $injector.require("projectFilesProvider", "./appbuilder/providers/project-files-provider"); $injector.require("pathFilteringService", "./appbuilder/services/path-filtering"); $injector.require("liveSyncServiceBase", "./services/livesync-service-base"); $injector.require("androidLiveSyncServiceLocator", "./appbuilder/services/livesync/android-livesync-service"); $injector.require("iosLiveSyncServiceLocator", "./appbuilder/services/livesync/ios-livesync-service"); $injector.require("deviceAppDataProvider", "./appbuilder/providers/device-app-data-provider"); $injector.requirePublic("companionAppsService", "./appbuilder/services/livesync/companion-apps-service"); $injector.require("nativeScriptProjectCapabilities", "./appbuilder/project/nativescript-project-capabilities"); $injector.require("cordovaProjectCapabilities", "./appbuilder/project/cordova-project-capabilities"); $injector.require("mobilePlatformsCapabilities", "./appbuilder/mobile-platforms-capabilities"); $injector.requirePublic("npmService", "./appbuilder/services/npm-service"); $injector.require("iOSLogFilter", "./appbuilder/mobile/ios/ios-log-filter");
require("../bootstrap"); $injector.require("projectConstants", "./appbuilder/project-constants"); $injector.require("projectFilesProvider", "./appbuilder/providers/project-files-provider"); $injector.require("pathFilteringService", "./appbuilder/services/path-filtering"); $injector.require("liveSyncServiceBase", "./services/livesync-service-base"); $injector.require("androidLiveSyncServiceLocator", "./appbuilder/services/livesync/android-livesync-service"); $injector.require("iosLiveSyncServiceLocator", "./appbuilder/services/livesync/ios-livesync-service"); $injector.require("deviceAppDataProvider", "./appbuilder/providers/device-app-data-provider"); $injector.requirePublic("companionAppsService", "./appbuilder/services/livesync/companion-apps-service"); $injector.require("nativeScriptProjectCapabilities", "./appbuilder/project/nativescript-project-capabilities"); $injector.require("cordovaProjectCapabilities", "./appbuilder/project/cordova-project-capabilities"); $injector.require("mobilePlatformsCapabilities", "./appbuilder/mobile-platforms-capabilities"); $injector.requirePublic("npmService", "./appbuilder/services/npm-service"); $injector.require("iOSLogFilter", "./mobile/ios/ios-log-filter");
Fix cannot find module ios-log-filter
Fix cannot find module ios-log-filter Change the path to ios-log-filter to point to the correct folder.
TypeScript
apache-2.0
telerik/mobile-cli-lib,telerik/mobile-cli-lib
--- +++ @@ -11,4 +11,4 @@ $injector.require("cordovaProjectCapabilities", "./appbuilder/project/cordova-project-capabilities"); $injector.require("mobilePlatformsCapabilities", "./appbuilder/mobile-platforms-capabilities"); $injector.requirePublic("npmService", "./appbuilder/services/npm-service"); -$injector.require("iOSLogFilter", "./appbuilder/mobile/ios/ios-log-filter"); +$injector.require("iOSLogFilter", "./mobile/ios/ios-log-filter");
62ff0a3dc2076f80c8dbeacb615e3fd513510671
examples/arduino-uno/fade.ts
examples/arduino-uno/fade.ts
import { Int, periodic } from '@amnisio/rivulet'; import { Sources, HIGH, LOW, run, createSinks } from '@amnisio/arduino-uno'; // Initialize brightness and change let brightness = 0; let change = 5; const getCurrentBrightness = (event: Int) => { // Make the change to brightness brightness = brightness + change; // If the cycle has ended, invert the change if (brightness <= LOW || brightness >= HIGH) change = -change; // Return the current brightness return brightness; } // Sample application that will fade an LED attached to the D10 pin using PWM. // Requires an LED to be connected at pin D10. // Every 30ms, the brightness of the LED attached to D10 is updated. const application = (arduino: Sources) => { const sinks = createSinks(); sinks.D10$ = periodic(30).map(getCurrentBrightness); return sinks; }; run(application);
import { periodic } from '@amnisio/rivulet'; import { Sources, HIGH, LOW, run, createSinks } from '@amnisio/arduino-uno'; // Initialize brightness and change let brightness = 0; let change = 5; const getCurrentBrightness = (event: number) => { // Make the change to brightness brightness = brightness + change; // If the cycle has ended, invert the change if (brightness <= LOW || brightness >= HIGH) change = -change; // Return the current brightness return brightness; } // Sample application that will fade an LED attached to the D10 pin using PWM. // Requires an LED to be connected at pin D10. // Every 30ms, the brightness of the LED attached to D10 is updated. const application = (arduino: Sources) => { const sinks = createSinks(); sinks.D10$ = periodic(30).map(getCurrentBrightness); return sinks; }; run(application);
Use number instead of Int
Use number instead of Int
TypeScript
mit
artfuldev/RIoT
--- +++ @@ -1,11 +1,11 @@ -import { Int, periodic } from '@amnisio/rivulet'; +import { periodic } from '@amnisio/rivulet'; import { Sources, HIGH, LOW, run, createSinks } from '@amnisio/arduino-uno'; // Initialize brightness and change let brightness = 0; let change = 5; -const getCurrentBrightness = (event: Int) => { +const getCurrentBrightness = (event: number) => { // Make the change to brightness brightness = brightness + change; // If the cycle has ended, invert the change
9b92c517fc500f3f5cbbd1fbad40cea602f201df
packages/lesswrong/lib/abTests.ts
packages/lesswrong/lib/abTests.ts
import { ABTest } from './abTestImpl'; // An A/B test which doesn't do anything (other than randomize you), for testing // the A/B test infrastructure. export const noEffectABTest = new ABTest({ name: "abTestNoEffect", description: "A placeholder A/B test which has no effect", groups: { group1: { description: "The smaller test group", weight: 1, }, group2: { description: "The larger test group", weight: 2, }, } }); export const numPostsOnHomePage = new ABTest({ name: "numPostsOnHomePage", description: "Number of Posts in Latest Posts Section of Home Page", groups: { "10": { description: "Ten posts", weight: 1, }, "13": { description: "Thirteen posts", weight: 4, }, "16": { description: "Sixteen posts", weight: 1, }, }, });
import { ABTest } from './abTestImpl'; // An A/B test which doesn't do anything (other than randomize you), for testing // the A/B test infrastructure. export const noEffectABTest = new ABTest({ name: "abTestNoEffect", description: "A placeholder A/B test which has no effect", groups: { group1: { description: "The smaller test group", weight: 1, }, group2: { description: "The larger test group", weight: 2, }, } });
Remove remnants of inactive num-posts-on-homepage A/B test
Remove remnants of inactive num-posts-on-homepage A/B test
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -16,22 +16,3 @@ }, } }); - -export const numPostsOnHomePage = new ABTest({ - name: "numPostsOnHomePage", - description: "Number of Posts in Latest Posts Section of Home Page", - groups: { - "10": { - description: "Ten posts", - weight: 1, - }, - "13": { - description: "Thirteen posts", - weight: 4, - }, - "16": { - description: "Sixteen posts", - weight: 1, - }, - }, -});
ab9caa459f236a7c921042e9044859340829ea9e
app.ts
app.ts
/// <reference path="MonitoredSocket.ts" /> import MonitoredSocket = require("./MonitoredSocket"); import http = require("http"); import fs = require("fs"); var config = require("./config"); var listenIp: string = config["serv"].ip; var listenPort: number = config["serv"].port; var responseData: string = fs.readFileSync("index.html", "utf-8"); var monitoredSocks: Array<MonitoredSocket>; function init(): void { for (var service in config["services"]) { monitoredSocks.push( new MonitoredSocket(service.endpoint, service.port) ); } } function processResponse(): string { var output: string = ""; for (var sock in monitoredSocks) { sock.connect(); output += sock.isUp; } return output; } init(); http.createServer(function (request, response) { response.write(processResponse()); response.end(); }).listen(listenPort, listenIp);
/// <reference path="MonitoredSocket.ts" /> import MonitoredSocket = require("./MonitoredSocket"); import http = require("http"); import fs = require("fs"); var config = require("./config"); var listenIp: string = config["serv"].ip; var listenPort: number = config["serv"].port; var responseData: string = fs.readFileSync("index.html", "utf-8"); var monitoredSocks: Array<MonitoredSocket> = []; function init(): void { for (var service in config["services"]) { monitoredSocks.push( new MonitoredSocket(service.endpoint, service.port) ); console.log("Monitoring: " + service.endpoint + ":" + service.port); } } function processResponse(): string { var output: string = ""; for (var sock in monitoredSocks) { sock.connect(); output += sock.isUp; } return output; } init(); http.createServer(function (request, response) { response.write(processResponse()); response.end(); }).listen(listenPort, listenIp); console.log("Now listening on " + listenIp + ":" + listenPort);
Fix push to undefined + up logging
Fix push to undefined + up logging
TypeScript
mit
OzuYatamutsu/is-my-server-up,OzuYatamutsu/is-my-server-up,OzuYatamutsu/is-my-server-up
--- +++ @@ -8,13 +8,15 @@ var listenPort: number = config["serv"].port; var responseData: string = fs.readFileSync("index.html", "utf-8"); -var monitoredSocks: Array<MonitoredSocket>; +var monitoredSocks: Array<MonitoredSocket> = []; function init(): void { for (var service in config["services"]) { monitoredSocks.push( new MonitoredSocket(service.endpoint, service.port) ); + + console.log("Monitoring: " + service.endpoint + ":" + service.port); } } @@ -34,3 +36,5 @@ response.write(processResponse()); response.end(); }).listen(listenPort, listenIp); + +console.log("Now listening on " + listenIp + ":" + listenPort);
fc0f6bea522c58cf1c42325b2377a754572277d9
addons/controls/src/register.tsx
addons/controls/src/register.tsx
import React from 'react'; import addons, { types } from '@storybook/addons'; import { AddonPanel } from '@storybook/components'; import { API } from '@storybook/api'; import { ControlsPanel } from './components/ControlsPanel'; import { ADDON_ID } from './constants'; addons.register(ADDON_ID, (api: API) => { addons.addPanel(ADDON_ID, { title: 'Controls', type: types.PANEL, render: ({ key, active }) => { if (!active || !api.getCurrentStoryData()) { return null; } return ( <AddonPanel key={key} active={active}> <ControlsPanel /> </AddonPanel> ); }, }); });
import React from 'react'; import addons, { types } from '@storybook/addons'; import { AddonPanel } from '@storybook/components'; import { API } from '@storybook/api'; import { ControlsPanel } from './components/ControlsPanel'; import { ADDON_ID, PARAM_KEY } from './constants'; addons.register(ADDON_ID, (api: API) => { addons.addPanel(ADDON_ID, { title: 'Controls', type: types.PANEL, paramKey: PARAM_KEY, render: ({ key, active }) => { if (!active || !api.getCurrentStoryData()) { return null; } return ( <AddonPanel key={key} active={active}> <ControlsPanel /> </AddonPanel> ); }, }); });
Fix paramKey handling for tab auto-configurability
Addon-controls: Fix paramKey handling for tab auto-configurability
TypeScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -3,12 +3,13 @@ import { AddonPanel } from '@storybook/components'; import { API } from '@storybook/api'; import { ControlsPanel } from './components/ControlsPanel'; -import { ADDON_ID } from './constants'; +import { ADDON_ID, PARAM_KEY } from './constants'; addons.register(ADDON_ID, (api: API) => { addons.addPanel(ADDON_ID, { title: 'Controls', type: types.PANEL, + paramKey: PARAM_KEY, render: ({ key, active }) => { if (!active || !api.getCurrentStoryData()) { return null;
c16422676ee1d4b7abe4fa41ff357f0bbe263b47
src/Artsy/Router/Utils/findCurrentRoute.tsx
src/Artsy/Router/Utils/findCurrentRoute.tsx
import { Match, RouteConfig } from "found" export const findCurrentRoute = ({ routes, routeIndices, }: Match & { route?: RouteConfig }) => { let remainingRouteIndicies = [...routeIndices] let route: RouteConfig = routes[remainingRouteIndicies.shift()] while (remainingRouteIndicies.length > 0) { route = route.children[remainingRouteIndicies.shift()] } return route }
import { Match, RouteConfig } from "found" export const findCurrentRoute = ({ route: baseRoute, routes, routeIndices, }: Match & { route?: RouteConfig }) => { if (!routeIndices || routeIndices.length === 0) { return baseRoute } let remainingRouteIndicies = [...routeIndices] let route: RouteConfig = routes[remainingRouteIndicies.shift()] while (remainingRouteIndicies.length > 0) { route = route.children[remainingRouteIndicies.shift()] } return route }
Add fallback logic if routeIndicies aren't present
Add fallback logic if routeIndicies aren't present
TypeScript
mit
artsy/reaction-force,artsy/reaction-force,artsy/reaction,artsy/reaction,artsy/reaction
--- +++ @@ -1,9 +1,13 @@ import { Match, RouteConfig } from "found" export const findCurrentRoute = ({ + route: baseRoute, routes, routeIndices, }: Match & { route?: RouteConfig }) => { + if (!routeIndices || routeIndices.length === 0) { + return baseRoute + } let remainingRouteIndicies = [...routeIndices] let route: RouteConfig = routes[remainingRouteIndicies.shift()]
7fac5aa010769750c040ae8ced46bb9fb0ab418e
src/geometries/ConeBufferGeometry.d.ts
src/geometries/ConeBufferGeometry.d.ts
import { CylinderBufferGeometry } from './CylinderBufferGeometry'; export class ConeBufferGeometry extends CylinderBufferGeometry { /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. * @param [radialSegment=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number, height?: number, radialSegment?: number, heightSegment?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number ); /** * @default 'ConeBufferGeometry' */ type: string; }
import { CylinderBufferGeometry } from './CylinderBufferGeometry'; export class ConeBufferGeometry extends CylinderBufferGeometry { /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. * @param [radialSegments=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] * @param [thetaLength=Math.PI * 2] */ constructor( radius?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number ); /** * @default 'ConeBufferGeometry' */ type: string; }
Fix typo in ConeBufferGeometry (again)
Fix typo in ConeBufferGeometry (again)
TypeScript
mit
gero3/three.js,greggman/three.js,gero3/three.js,makc/three.js.fork,greggman/three.js,aardgoose/three.js,jpweeks/three.js,kaisalmen/three.js,mrdoob/three.js,06wj/three.js,fyoudine/three.js,WestLangley/three.js,fyoudine/three.js,Liuer/three.js,donmccurdy/three.js,makc/three.js.fork,looeee/three.js,Liuer/three.js,06wj/three.js,mrdoob/three.js,WestLangley/three.js,kaisalmen/three.js,aardgoose/three.js,jpweeks/three.js,donmccurdy/three.js,looeee/three.js
--- +++ @@ -5,7 +5,7 @@ /** * @param [radius=1] — Radius of the cone base. * @param [height=1] — Height of the cone. - * @param [radialSegment=8] — Number of segmented faces around the circumference of the cone. + * @param [radialSegments=8] — Number of segmented faces around the circumference of the cone. * @param [heightSegments=1] — Number of rows of faces along the height of the cone. * @param [openEnded=false] — A Boolean indicating whether the base of the cone is open or capped. * @param [thetaStart=0] @@ -14,8 +14,8 @@ constructor( radius?: number, height?: number, - radialSegment?: number, - heightSegment?: number, + radialSegments?: number, + heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number
9f5737eb931b4682b78a556231932ff6755f5141
js/src/common/resolvers/DefaultResolver.ts
js/src/common/resolvers/DefaultResolver.ts
import Mithril from 'mithril'; /** * Generates a route resolver for a given component. * In addition to regular route resolver functionality: * - It provide the current route name as an attr * - It sets a key on the component so a rerender will be triggered on route change. */ export default class DefaultResolver { component: Mithril.Component; routeName: string; constructor(component, routeName) { this.component = component; this.routeName = routeName; } /** * When a route change results in a changed key, a full page * rerender occurs. This method can be overriden in subclasses * to prevent rerenders on some route changes. */ makeKey() { return this.routeName + JSON.stringify(m.route.param()); } onmatch(args, requestedPath, route) { return this.component; } render(vnode) { return [{ ...vnode, routeName: this.routeName, key: this.makeKey() }]; } }
import Mithril from 'mithril'; /** * Generates a route resolver for a given component. * In addition to regular route resolver functionality: * - It provide the current route name as an attr * - It sets a key on the component so a rerender will be triggered on route change. */ export default class DefaultResolver { component: Mithril.Component; routeName: string; constructor(component, routeName) { this.component = component; this.routeName = routeName; } /** * When a route change results in a changed key, a full page * rerender occurs. This method can be overriden in subclasses * to prevent rerenders on some route changes. */ makeKey() { return this.routeName + JSON.stringify(m.route.param()); } makeAttrs(vnode) { return { ...vnode.attrs, routeName: this.routeName, }; } onmatch(args, requestedPath, route) { return this.component; } render(vnode) { return [{ ...vnode, attrs: this.makeAttrs(vnode), key: this.makeKey() }]; } }
Fix routeName attr not being passed into pages
Fix routeName attr not being passed into pages
TypeScript
mit
flarum/core,flarum/core,flarum/core
--- +++ @@ -24,11 +24,18 @@ return this.routeName + JSON.stringify(m.route.param()); } + makeAttrs(vnode) { + return { + ...vnode.attrs, + routeName: this.routeName, + }; + } + onmatch(args, requestedPath, route) { return this.component; } render(vnode) { - return [{ ...vnode, routeName: this.routeName, key: this.makeKey() }]; + return [{ ...vnode, attrs: this.makeAttrs(vnode), key: this.makeKey() }]; } }
68305b299db4201e10406d52e458621e64254bce
src/extension.ts
src/extension.ts
import * as vscode from 'vscode'; import * as client from './client'; export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(client.launch(context)); } export function deactivate() { }
import * as vscode from 'vscode'; import * as client from './client'; export function activate(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.languages.setLanguageConfiguration('reason', { indentationRules: { decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/, increaseIndentPattern: /^.*\{[^}"']*$/, }, onEnterRules: [ { beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, afterText: /^\s*\*\/$/, action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: ' * ' } }, { beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, action: { indentAction: vscode.IndentAction.None, appendText: ' * ' } }, { beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, action: { indentAction: vscode.IndentAction.None, appendText: '* ' } }, { beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, action: { indentAction: vscode.IndentAction.None, removeText: 1 } }, { beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/, action: { indentAction: vscode.IndentAction.None, removeText: 1 } } ], wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, })); context.subscriptions.push(client.launch(context)); } export function deactivate() { }
Add more language config settings for indent, etc.
Add more language config settings for indent, etc.
TypeScript
apache-2.0
freebroccolo/vscode-reasonml,freebroccolo/vscode-reasonml
--- +++ @@ -2,6 +2,37 @@ import * as client from './client'; export function activate(context: vscode.ExtensionContext) { + context.subscriptions.push( + vscode.languages.setLanguageConfiguration('reason', { + indentationRules: { + decreaseIndentPattern: /^(.*\*\/)?\s*\}.*$/, + increaseIndentPattern: /^.*\{[^}"']*$/, + }, + onEnterRules: [ + { + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + afterText: /^\s*\*\/$/, + action: { indentAction: vscode.IndentAction.IndentOutdent, appendText: ' * ' } + }, + { + beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/, + action: { indentAction: vscode.IndentAction.None, appendText: ' * ' } + }, + { + beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/, + action: { indentAction: vscode.IndentAction.None, appendText: '* ' } + }, + { + beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/, + action: { indentAction: vscode.IndentAction.None, removeText: 1 } + }, + { + beforeText: /^(\t|(\ \ ))*\ \*[^/]*\*\/\s*$/, + action: { indentAction: vscode.IndentAction.None, removeText: 1 } + } + ], + wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g, + })); context.subscriptions.push(client.launch(context)); }
fe996b6f28015c8e5e4de88efc349f79f14e8327
src/lib/Components/Gene/Biography.tsx
src/lib/Components/Gene/Biography.tsx
import * as React from "react" import * as Relay from "react-relay/classic" import * as removeMarkdown from "remove-markdown" import { Dimensions, StyleSheet, View, ViewProperties } from "react-native" import SerifText from "../Text/Serif" const sideMargin = Dimensions.get("window").width > 700 ? 50 : 0 interface Props extends ViewProperties, RelayProps {} class Biography extends React.Component<Props, any> { render() { const gene = this.props.gene if (!gene.description) { return null } return ( <View style={{ marginLeft: sideMargin, marginRight: sideMargin }}> {this.blurb(gene)} </View> ) } blurb(gene) { if (gene.description) { return ( <SerifText style={styles.blurb} numberOfLines={0}> {removeMarkdown(gene.description)} </SerifText> ) } } } const styles = StyleSheet.create({ blurb: { fontSize: 16, lineHeight: 20, marginBottom: 20, }, bio: { fontSize: 16, lineHeight: 20, marginBottom: 40, }, }) export default Relay.createContainer(Biography, { fragments: { gene: () => Relay.QL` fragment on Gene { description } `, }, }) interface RelayProps { gene: { description: string | null } }
import * as React from "react" import * as Relay from "react-relay/classic" import removeMarkdown from "remove-markdown" import { Dimensions, StyleSheet, View, ViewProperties } from "react-native" import SerifText from "../Text/Serif" const sideMargin = Dimensions.get("window").width > 700 ? 50 : 0 interface Props extends ViewProperties, RelayProps {} class Biography extends React.Component<Props, any> { render() { const gene = this.props.gene if (!gene.description) { return null } return ( <View style={{ marginLeft: sideMargin, marginRight: sideMargin }}> {this.blurb(gene)} </View> ) } blurb(gene) { if (gene.description) { return ( <SerifText style={styles.blurb} numberOfLines={0}> {removeMarkdown(gene.description)} </SerifText> ) } } } const styles = StyleSheet.create({ blurb: { fontSize: 16, lineHeight: 20, marginBottom: 20, }, bio: { fontSize: 16, lineHeight: 20, marginBottom: 40, }, }) export default Relay.createContainer(Biography, { fragments: { gene: () => Relay.QL` fragment on Gene { description } `, }, }) interface RelayProps { gene: { description: string | null } }
Fix default import of remove-markdown.
[Gene] Fix default import of remove-markdown.
TypeScript
mit
artsy/eigen,artsy/eigen,artsy/emission,artsy/emission,artsy/emission,artsy/emission,artsy/emission,artsy/emission,artsy/emission,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen
--- +++ @@ -1,6 +1,6 @@ import * as React from "react" import * as Relay from "react-relay/classic" -import * as removeMarkdown from "remove-markdown" +import removeMarkdown from "remove-markdown" import { Dimensions, StyleSheet, View, ViewProperties } from "react-native"
56b7f01038040008ccc1355733d6f5bfac2f2f7e
packages/web-api/src/response/AdminEmojiListResponse.ts
packages/web-api/src/response/AdminEmojiListResponse.ts
/* eslint-disable */ ///////////////////////////////////////////////////////////////////////////////////////// // // // !!! DO NOT EDIT THIS FILE !!! // // // // This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // // Please refer to the script code to learn how to update the source data. // // // ///////////////////////////////////////////////////////////////////////////////////////// import { WebAPICallResult } from '../WebClient'; export type AdminEmojiListResponse = WebAPICallResult & { ok?: boolean; emoji?: AdminEmojiListResponseEmoji; response_metadata?: ResponseMetadata; error?: string; needed?: string; provided?: string; }; export interface AdminEmojiListResponseEmoji { emoji?: EmojiClass; emoji_?: EmojiClass; } export interface EmojiClass { emoji?: string; emoji_?: string; } export interface ResponseMetadata { next_cursor?: string; }
/* eslint-disable */ ///////////////////////////////////////////////////////////////////////////////////////// // // // !!! DO NOT EDIT THIS FILE !!! // // // // This file is auto-generated by scripts/generate-web-api-types.sh in the repository. // // Please refer to the script code to learn how to update the source data. // // // ///////////////////////////////////////////////////////////////////////////////////////// import { WebAPICallResult } from '../WebClient'; export type AdminEmojiListResponse = WebAPICallResult & { ok?: boolean; emoji?: { [key: string]: Emoji }; response_metadata?: ResponseMetadata; error?: string; needed?: string; provided?: string; }; export interface Emoji { url?: string; date_created?: number; uploaded_by?: string; } export interface ResponseMetadata { next_cursor?: string; }
Update the auto-generated web-api response types
Update the auto-generated web-api response types
TypeScript
mit
slackapi/node-slack-sdk,slackapi/node-slack-sdk,slackapi/node-slack-sdk,slackapi/node-slack-sdk
--- +++ @@ -11,21 +11,17 @@ import { WebAPICallResult } from '../WebClient'; export type AdminEmojiListResponse = WebAPICallResult & { ok?: boolean; - emoji?: AdminEmojiListResponseEmoji; + emoji?: { [key: string]: Emoji }; response_metadata?: ResponseMetadata; error?: string; needed?: string; provided?: string; }; -export interface AdminEmojiListResponseEmoji { - emoji?: EmojiClass; - emoji_?: EmojiClass; -} - -export interface EmojiClass { - emoji?: string; - emoji_?: string; +export interface Emoji { + url?: string; + date_created?: number; + uploaded_by?: string; } export interface ResponseMetadata {
d5b2a77aa152e62156c31596d37de9af3ab37580
src/materials/MeshMatcapMaterial.d.ts
src/materials/MeshMatcapMaterial.d.ts
import { Color } from './../math/Color'; import { Texture } from './../textures/Texture'; import { Vector2 } from './../math/Vector2'; import { MaterialParameters, Material } from './Material'; import { NormalMapTypes } from '../constants'; export interface MeshMatcapMaterialParameters extends MaterialParameters { color?: Color | string | number; matMap?: Texture; map?: Texture; bumpMap?: Texture; bumpScale?: number; normalMap?: Texture; normalMapType?: NormalMapTypes; normalScale?: Vector2; displacementMap?: Texture; displacementScale?: number; displacementBias?: number; alphaMap?: Texture; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; } export class MeshMatcapMaterial extends Material { constructor( parameters?: MeshMatcapMaterialParameters ); color: Color; matMap: Texture | null; map: Texture | null; bumpMap: Texture | null; bumpScale: number; normalMap: Texture | null; normalMapType: NormalMapTypes; normalScale: Vector2; displacementMap: Texture | null; displacementScale: number; displacementBias: number; alphaMap: Texture | null; skinning: boolean; morphTargets: boolean; morphNormals: boolean; setValues( parameters: MeshMatcapMaterialParameters ): void; }
import { Color } from './../math/Color'; import { Texture } from './../textures/Texture'; import { Vector2 } from './../math/Vector2'; import { MaterialParameters, Material } from './Material'; import { NormalMapTypes } from '../constants'; export interface MeshMatcapMaterialParameters extends MaterialParameters { color?: Color | string | number; matcap?: Texture; map?: Texture; bumpMap?: Texture; bumpScale?: number; normalMap?: Texture; normalMapType?: NormalMapTypes; normalScale?: Vector2; displacementMap?: Texture; displacementScale?: number; displacementBias?: number; alphaMap?: Texture; skinning?: boolean; morphTargets?: boolean; morphNormals?: boolean; } export class MeshMatcapMaterial extends Material { constructor( parameters?: MeshMatcapMaterialParameters ); color: Color; matcap: Texture | null; map: Texture | null; bumpMap: Texture | null; bumpScale: number; normalMap: Texture | null; normalMapType: NormalMapTypes; normalScale: Vector2; displacementMap: Texture | null; displacementScale: number; displacementBias: number; alphaMap: Texture | null; skinning: boolean; morphTargets: boolean; morphNormals: boolean; setValues( parameters: MeshMatcapMaterialParameters ): void; }
Fix matcap attribute of MeshMatcapMaterial
TS: Fix matcap attribute of MeshMatcapMaterial
TypeScript
mit
TristanVALCKE/three.js,stanford-gfx/three.js,WestLangley/three.js,06wj/three.js,WestLangley/three.js,looeee/three.js,QingchaoHu/three.js,SpinVR/three.js,mrdoob/three.js,jee7/three.js,sherousee/three.js,Samsy/three.js,fraguada/three.js,fyoudine/three.js,06wj/three.js,jee7/three.js,Itee/three.js,jpweeks/three.js,SpinVR/three.js,TristanVALCKE/three.js,TristanVALCKE/three.js,Samsy/three.js,makc/three.js.fork,Samsy/three.js,Liuer/three.js,cadenasgmbh/three.js,Itee/three.js,greggman/three.js,kaisalmen/three.js,aardgoose/three.js,fraguada/three.js,greggman/three.js,gero3/three.js,TristanVALCKE/three.js,looeee/three.js,stanford-gfx/three.js,sttz/three.js,makc/three.js.fork,QingchaoHu/three.js,Samsy/three.js,zhoushijie163/three.js,fernandojsg/three.js,donmccurdy/three.js,fernandojsg/three.js,Samsy/three.js,fraguada/three.js,Liuer/three.js,zhoushijie163/three.js,jee7/three.js,TristanVALCKE/three.js,fraguada/three.js,TristanVALCKE/three.js,sherousee/three.js,Samsy/three.js,fraguada/three.js,jpweeks/three.js,fraguada/three.js,mrdoob/three.js,sherousee/three.js,fernandojsg/three.js,aardgoose/three.js,fyoudine/three.js,sttz/three.js,cadenasgmbh/three.js,kaisalmen/three.js,gero3/three.js,donmccurdy/three.js
--- +++ @@ -7,7 +7,7 @@ export interface MeshMatcapMaterialParameters extends MaterialParameters { color?: Color | string | number; - matMap?: Texture; + matcap?: Texture; map?: Texture; bumpMap?: Texture; bumpScale?: number; @@ -28,7 +28,7 @@ constructor( parameters?: MeshMatcapMaterialParameters ); color: Color; - matMap: Texture | null; + matcap: Texture | null; map: Texture | null; bumpMap: Texture | null; bumpScale: number;
4611cf546fcf3401c017d9bb27d6952a32d012d0
src/app/inventory/store/item-index.ts
src/app/inventory/store/item-index.ts
import { DimItem } from '../item-types'; let _idTracker: { [id: string]: number } = {}; export function resetItemIndexGenerator() { _idTracker = {}; } /** Set an ID for the item that should be unique across all items */ export function createItemIndex(item: DimItem): string { // Try to make a unique, but stable ID. This isn't always possible, such as in the case of consumables. let index = item.id; if (item.id === '0') { _idTracker[index] ||= 0; _idTracker[index]++; index = `${index}-t${_idTracker[index]}`; } return index; }
import { DimItem } from '../item-types'; let _idTracker: { [id: string]: number } = {}; export function resetItemIndexGenerator() { _idTracker = {}; } /** Set an ID for the item that should be unique across all items */ export function createItemIndex(item: DimItem): string { // Try to make a unique, but stable ID. This isn't always possible, such as in the case of consumables. if (item.id === '0') { _idTracker[item.hash] ||= 0; _idTracker[item.hash]++; return `${item.hash}-t${_idTracker[item.hash]}`; } return item.id; }
Fix item index generation logic
Fix item index generation logic
TypeScript
mit
DestinyItemManager/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM
--- +++ @@ -9,12 +9,11 @@ /** Set an ID for the item that should be unique across all items */ export function createItemIndex(item: DimItem): string { // Try to make a unique, but stable ID. This isn't always possible, such as in the case of consumables. - let index = item.id; if (item.id === '0') { - _idTracker[index] ||= 0; - _idTracker[index]++; - index = `${index}-t${_idTracker[index]}`; + _idTracker[item.hash] ||= 0; + _idTracker[item.hash]++; + return `${item.hash}-t${_idTracker[item.hash]}`; } - return index; + return item.id; }
0dd93322e88d0be0d9cda9fa1746a81b991c24c6
src/rules/eoflineRule.ts
src/rules/eoflineRule.ts
/* * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export class Rule extends Lint.Rules.AbstractRule { public static FAILURE_STRING = "file should end with a newline"; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { var eofToken = sourceFile.endOfFileToken; var eofTokenFullText = eofToken.getFullText(); if (eofTokenFullText.length === 0 || eofTokenFullText.charAt(eofTokenFullText.length - 1) !== "\n") { var start = eofToken.getStart(); var failure = new Lint.RuleFailure(sourceFile, start, start, Rule.FAILURE_STRING, this.getOptions().ruleName); return [failure]; } return []; } }
/* * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export class Rule extends Lint.Rules.AbstractRule { public static FAILURE_STRING = "file should end with a newline"; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { if (sourceFile.text === "") { // if the file is empty, it "ends with a newline", so don't return a failure return []; } var eofToken = sourceFile.endOfFileToken; var eofTokenFullText = eofToken.getFullText(); if (eofTokenFullText.length === 0 || eofTokenFullText.charAt(eofTokenFullText.length - 1) !== "\n") { var start = eofToken.getStart(); var failure = new Lint.RuleFailure(sourceFile, start, start, Rule.FAILURE_STRING, this.getOptions().ruleName); return [failure]; } return []; } }
Allow eofline rule to have an empty file
Allow eofline rule to have an empty file
TypeScript
apache-2.0
pspeter3/tslint,RyanCavanaugh/tslint,andy-ms/tslint,Nemo157/tslint,vmmitev/tslint,lukeapage/tslint,Kuniwak/tslint,aciccarello/tslint,berickson1/tslint,Pajn/tslint,spirosikmd/tslint,spirosikmd/tslint,weswigham/tslint,Kuniwak/tslint,berickson1/tslint,prendradjaja/tslint,weswigham/tslint,s-panferov/tslint,ScottSWu/tslint,liviuignat/tslint,prendradjaja/tslint,JoshuaKGoldberg/tslint,YuichiNukiyama/tslint,IllusionMH/tslint,vmmitev/tslint,IllusionMH/tslint,pocke/tslint,marekszala/tslint,ScottSWu/tslint,Nemo157/tslint,berickson1/tslint,nchen63/tslint,lukeapage/tslint,nchen63/tslint,pspeter3/tslint,palantir/tslint,vmmitev/tslint,andy-hanson/tslint,mprobst/tslint,aciccarello/tslint,YuichiNukiyama/tslint,mprobst/tslint,marekszala/tslint,RyanCavanaugh/tslint,YuichiNukiyama/tslint,RyanCavanaugh/tslint,IllusionMH/tslint,nikklassen/tslint,bolatovumar/tslint,JoshuaKGoldberg/tslint,s-panferov/tslint,spirosikmd/tslint,andy-hanson/tslint,liviuignat/tslint,mprobst/tslint,s-panferov/tslint,andy-hanson/tslint,prendradjaja/tslint,bolatovumar/tslint,JoshuaKGoldberg/tslint,andy-ms/tslint,palantir/tslint,liviuignat/tslint,gtanner/tslint,andy-ms/tslint,GabiGrin/tslint,pspeter3/tslint,Nemo157/tslint,weswigham/tslint,gtanner/tslint,bolatovumar/tslint,Kuniwak/tslint,GabiGrin/tslint,pocke/tslint,palantir/tslint,ScottSWu/tslint,pocke/tslint,marekszala/tslint,Pajn/tslint,gtanner/tslint,aciccarello/tslint,nchen63/tslint,nikklassen/tslint,Pajn/tslint,nikklassen/tslint,GabiGrin/tslint
--- +++ @@ -18,6 +18,10 @@ public static FAILURE_STRING = "file should end with a newline"; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + if (sourceFile.text === "") { + // if the file is empty, it "ends with a newline", so don't return a failure + return []; + } var eofToken = sourceFile.endOfFileToken; var eofTokenFullText = eofToken.getFullText(); if (eofTokenFullText.length === 0 || eofTokenFullText.charAt(eofTokenFullText.length - 1) !== "\n") {
0f99b872a2d0df6dccebad1de1434114ecd3ac57
app/src/components/core/metaschema/metaSchema.service.ts
app/src/components/core/metaschema/metaSchema.service.ts
module app.core.metaschema { import IHttpPromise = angular.IHttpPromise; import IPromise = angular.IPromise; import IQService = angular.IQService; import IDeferred = angular.IDeferred; import DataschemaService = app.core.dataschema.DataschemaService; export class MetaschemaService { static $inject = ['$http', '$q']; private metaschema:IPromise<Metaschema>; constructor($http:ng.IHttpService, $q:IQService) { var deffered:IDeferred<Metaschema> = $q.defer(); $http.get('/resource/metaschema.json').success((json:any):void => { deffered.resolve(Metaschema.fromJSON(json)); }); this.metaschema = deffered.promise; } /** * Gets a promise of the Metaschema. * * @returns {IPromise<Metaschema>} */ getMetaschema():IPromise<Metaschema> { return this.metaschema; } } angular.module('app.core').service('MetaschemaService', MetaschemaService); }
module app.core.metaschema { import IHttpPromise = angular.IHttpPromise; import IPromise = angular.IPromise; import IQService = angular.IQService; import IDeferred = angular.IDeferred; import DataschemaService = app.core.dataschema.DataschemaService; export class MetaschemaService { static $inject = ['$http', '$q']; private metaschema:IPromise<Metaschema>; constructor($http:ng.IHttpService, $q:IQService) { var deffered:IDeferred<Metaschema> = $q.defer(); $http.get('resource/metaschema.json').success((json:any):void => { deffered.resolve(Metaschema.fromJSON(json)); }); this.metaschema = deffered.promise; } /** * Gets a promise of the Metaschema. * * @returns {IPromise<Metaschema>} */ getMetaschema():IPromise<Metaschema> { return this.metaschema; } } angular.module('app.core').service('MetaschemaService', MetaschemaService); }
Fix for the resource not loading on the Integration Server
Fix for the resource not loading on the Integration Server
TypeScript
mit
FelixThieleTUM/JsonFormsEditor,eclipsesource/JsonFormsEditor,eclipsesource/JsonFormsEditor,pancho111203/JsonFormsEditor,pancho111203/JsonFormsEditor,FelixThieleTUM/JsonFormsEditor,eclipsesource/JsonFormsEditor,FelixThieleTUM/JsonFormsEditor,FelixThieleTUM/JsonFormsEditor,eclipsesource/JsonFormsEditor,pancho111203/JsonFormsEditor,pancho111203/JsonFormsEditor
--- +++ @@ -15,7 +15,7 @@ constructor($http:ng.IHttpService, $q:IQService) { var deffered:IDeferred<Metaschema> = $q.defer(); - $http.get('/resource/metaschema.json').success((json:any):void => { + $http.get('resource/metaschema.json').success((json:any):void => { deffered.resolve(Metaschema.fromJSON(json)); });
09b55877abb6ed1a90e9918509d0b3e5ecf59c2f
test/core/logger.spec.ts
test/core/logger.spec.ts
import { logger, debugStream, winstonStream } from '../../src/core/logger'; describe('Core:Logger', () => { describe('debugStream', () => { it('Should has a write property', () => { expect(debugStream.stream.write).toBeDefined(); }); it('Should not throw any error if calling the write method', () => { expect(debugStream.stream.write()).toBeUndefined(); }); }); describe('winstonStream', () => { it('Should has a write property', () => { expect(winstonStream.stream.write).toBeDefined(); }); it('Should not throw any error if calling the write method', () => { expect(winstonStream.stream.write()).toBeUndefined(); }); }); describe('logger', () => { it('Should have a debug method', () => { expect(logger.debug).toBeDefined(); }); it('Should have a log method', () => { expect(logger.log).toBeDefined(); }); it('Should have a info method', () => { expect(logger.info).toBeDefined(); }); it('Should have a warn method', () => { expect(logger.warn).toBeDefined(); }); it('Should have a error method', () => { expect(logger.error).toBeDefined(); }); }); });
import { Logger, debugStream, winstonStream } from '../../src/core/logger'; const log = Logger('test'); describe('Core:Logger', () => { describe('debugStream', () => { it('Should has a write property', () => { expect(debugStream.stream.write).toBeDefined(); }); it('Should not throw any error if calling the write method', () => { expect(debugStream.stream.write()).toBeUndefined(); }); }); describe('winstonStream', () => { it('Should has a write property', () => { expect(winstonStream.stream.write).toBeDefined(); }); it('Should not throw any error if calling the write method', () => { expect(winstonStream.stream.write()).toBeUndefined(); }); }); describe('log', () => { it('Should have a debug method', () => { expect(log.debug).toBeDefined(); }); it('Should have a verbose method', () => { expect(log.verbose).toBeDefined(); }); it('Should have a info method', () => { expect(log.info).toBeDefined(); }); it('Should have a warn method', () => { expect(log.warn).toBeDefined(); }); it('Should have a error method', () => { expect(log.error).toBeDefined(); }); }); });
Update tests for the new logger functions
test(core): Update tests for the new logger functions
TypeScript
mit
w3tecch/express-graphql-typescript-boilerplate,w3tecch/node-ts-boilerplate,w3tecch/node-ts-boilerplate,w3tecch/express-graphql-typescript-boilerplate
--- +++ @@ -1,4 +1,6 @@ -import { logger, debugStream, winstonStream } from '../../src/core/logger'; +import { Logger, debugStream, winstonStream } from '../../src/core/logger'; + +const log = Logger('test'); describe('Core:Logger', () => { describe('debugStream', () => { @@ -17,21 +19,21 @@ expect(winstonStream.stream.write()).toBeUndefined(); }); }); - describe('logger', () => { + describe('log', () => { it('Should have a debug method', () => { - expect(logger.debug).toBeDefined(); + expect(log.debug).toBeDefined(); }); - it('Should have a log method', () => { - expect(logger.log).toBeDefined(); + it('Should have a verbose method', () => { + expect(log.verbose).toBeDefined(); }); it('Should have a info method', () => { - expect(logger.info).toBeDefined(); + expect(log.info).toBeDefined(); }); it('Should have a warn method', () => { - expect(logger.warn).toBeDefined(); + expect(log.warn).toBeDefined(); }); it('Should have a error method', () => { - expect(logger.error).toBeDefined(); + expect(log.error).toBeDefined(); }); }); });
ad0dc287acc700e2eddd16b42139c131475835b5
src/packages/database/pool/pool.ts
src/packages/database/pool/pool.ts
/* * This file is part of CoCalc: Copyright © 2021 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { pghost as host, pguser as user, pgdatabase as database, } from "@cocalc/backend/data"; import dbPassword from "./password"; export * from "./util"; import /*getCachedPool, */{ Length } from "./cached"; import { Pool } from "pg"; let pool: Pool | undefined = undefined; export default function getPool(cacheLength?: Length): Pool { // temporarily disabling all caching, since there is an issue. // if (cacheLength != null) { // return getCachedPool(cacheLength); // } cacheLength = cacheLength; if (pool == null) { pool = new Pool({ password: dbPassword(), user, host, database }); } return pool; }
/* * This file is part of CoCalc: Copyright © 2021 Sagemath, Inc. * License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details */ import { pghost as host, pguser as user, pgdatabase as database, } from "@cocalc/backend/data"; import dbPassword from "./password"; export * from "./util"; import getCachedPool, { Length } from "./cached"; import { Pool } from "pg"; let pool: Pool | undefined = undefined; export default function getPool(cacheLength?: Length): Pool { if (cacheLength != null) { return getCachedPool(cacheLength); } if (pool == null) { pool = new Pool({ password: dbPassword(), user, host, database }); } return pool; }
Revert "temporarily disable certain database caching used by next app"
Revert "temporarily disable certain database caching used by next app" This reverts commit dfe98248abcc04413e3d2ab1e2c662f35c6a4bba.
TypeScript
agpl-3.0
sagemathinc/smc,sagemathinc/smc,sagemathinc/smc,sagemathinc/smc
--- +++ @@ -10,17 +10,15 @@ } from "@cocalc/backend/data"; import dbPassword from "./password"; export * from "./util"; -import /*getCachedPool, */{ Length } from "./cached"; +import getCachedPool, { Length } from "./cached"; import { Pool } from "pg"; let pool: Pool | undefined = undefined; export default function getPool(cacheLength?: Length): Pool { - // temporarily disabling all caching, since there is an issue. - // if (cacheLength != null) { - // return getCachedPool(cacheLength); - // } - cacheLength = cacheLength; + if (cacheLength != null) { + return getCachedPool(cacheLength); + } if (pool == null) { pool = new Pool({ password: dbPassword(), user, host, database }); }
d24c0b40961b585800b499edd0748fea27ae3f99
packages/backend-api/src/processing/index.ts
packages/backend-api/src/processing/index.ts
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { USER_GROUP_YOUTUBE } from '@conversationai/moderator-backend-core/src'; import { youtubeHooks } from '../integrations/youtube/hooks'; import { registerHooks } from '../pipeline/hooks'; registerHooks(USER_GROUP_YOUTUBE, youtubeHooks); export * from './tasks'; export * from './dashboard'; export * from './api'; export * from './worker';
/* Copyright 2017 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { USER_GROUP_YOUTUBE } from '@conversationai/moderator-backend-core'; import { youtubeHooks } from '../integrations/youtube/hooks'; import { registerHooks } from '../pipeline/hooks'; registerHooks(USER_GROUP_YOUTUBE, youtubeHooks); export * from './tasks'; export * from './dashboard'; export * from './api'; export * from './worker';
Fix build breakage on demo server.
backend: Fix build breakage on demo server.
TypeScript
apache-2.0
conversationai/conversationai-moderator,conversationai/conversationai-moderator,conversationai/conversationai-moderator,conversationai/conversationai-moderator
--- +++ @@ -14,7 +14,7 @@ limitations under the License. */ -import { USER_GROUP_YOUTUBE } from '@conversationai/moderator-backend-core/src'; +import { USER_GROUP_YOUTUBE } from '@conversationai/moderator-backend-core'; import { youtubeHooks } from '../integrations/youtube/hooks'; import { registerHooks } from '../pipeline/hooks';
d7e60a2185259a6d46d2e9f055b8909d1ba52e26
src/app/components/login/login.component.ts
src/app/components/login/login.component.ts
import {Component, OnInit} from '@angular/core'; import {AwsService} from '../../services/aws-service'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.css'] }) export class LoginComponent implements OnInit { accessKeyId: string; secretAccessKey: string; useLocalStack = this.awsService.useLocalStack; localStackEndpoint = this.awsService.localStackEndpoint; returnUrl: string; authenticating: boolean; errorMessage: undefined; constructor(private route: ActivatedRoute, private router: Router, private awsService: AwsService) { // DO NOTHING } ngOnInit() { this.awsService.logout(); this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; } login() { this.errorMessage = undefined; this.authenticating = true; this.awsService.login(this.accessKeyId, this.secretAccessKey, this.useLocalStack, this.localStackEndpoint) .then(() => { this.authenticating = false; this.router.navigate([this.returnUrl]) }) .catch(err => { this.authenticating = false; this.errorMessage = err.message; }); } }
import {Component, OnInit} from '@angular/core'; import {AwsService} from '../../services/aws-service'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.css'] }) export class LoginComponent implements OnInit { accessKeyId: string; secretAccessKey: string; useLocalStack = this.awsService.useLocalStack; localStackEndpoint = this.awsService.localStackEndpoint; returnUrl: string; authenticating: boolean; errorMessage: undefined; constructor(private route: ActivatedRoute, private router: Router, private awsService: AwsService) { // DO NOTHING } ngOnInit() { this.awsService.logout(); this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/'; } login() { this.errorMessage = undefined; this.authenticating = true; this.awsService.login(this.accessKeyId, this.secretAccessKey, this.useLocalStack, this.localStackEndpoint) .then(() => { this.authenticating = false; this.router.navigateByUrl(this.returnUrl); }) .catch(err => { this.authenticating = false; this.errorMessage = err.message; }); } }
Fix bug that failure loading a report when login via redirect url which includes aws configurations
:skull: Fix bug that failure loading a report when login via redirect url which includes aws configurations
TypeScript
mit
tadashi-aikawa/gemini-viewer,tadashi-aikawa/gemini-viewer,tadashi-aikawa/gemini-viewer
--- +++ @@ -33,7 +33,7 @@ this.awsService.login(this.accessKeyId, this.secretAccessKey, this.useLocalStack, this.localStackEndpoint) .then(() => { this.authenticating = false; - this.router.navigate([this.returnUrl]) + this.router.navigateByUrl(this.returnUrl); }) .catch(err => { this.authenticating = false;
df8b784158b0564e0ed24686cda9bfb7bac87215
components/table/FilterDropdownMenuWrapper.tsx
components/table/FilterDropdownMenuWrapper.tsx
import * as React from 'react'; export interface FilterDropdownMenuWrapperProps { onClick?: React.MouseEventHandler<any>; children?: any; className?: string; } export default (props: FilterDropdownMenuWrapperProps) => ( <div className={props.className} onClick={props.onClick}> {props.children} </div> );
import * as React from 'react'; export interface FilterDropdownMenuWrapperProps { children?: any; className?: string; } export default (props: FilterDropdownMenuWrapperProps) => ( <div className={props.className} onClick={e => e.stopPropagation()}> {props.children} </div> );
Fix Table filters trigger sort
:bug: Fix Table filters trigger sort close #13891 close #13933 close #13790
TypeScript
mit
zheeeng/ant-design,elevensky/ant-design,elevensky/ant-design,icaife/ant-design,icaife/ant-design,elevensky/ant-design,icaife/ant-design,elevensky/ant-design,ant-design/ant-design,ant-design/ant-design,icaife/ant-design,ant-design/ant-design,zheeeng/ant-design,ant-design/ant-design,zheeeng/ant-design,zheeeng/ant-design
--- +++ @@ -1,13 +1,12 @@ import * as React from 'react'; export interface FilterDropdownMenuWrapperProps { - onClick?: React.MouseEventHandler<any>; children?: any; className?: string; } export default (props: FilterDropdownMenuWrapperProps) => ( - <div className={props.className} onClick={props.onClick}> + <div className={props.className} onClick={e => e.stopPropagation()}> {props.children} </div> );
fe02c75338a51bf7961075c6776e3e29683b9358
tools/env/prod.ts
tools/env/prod.ts
import {EnvConfig} from './env-config.interface'; const ProdConfig: EnvConfig = { ENV: 'PROD', API: 'https://d4el2racxe.execute-api.us-east-1.amazonaws.com/mock', AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', COGNITO_CLIENT_ID: '3mj2tpe89ihqo412m9ckml6jk' }; export = ProdConfig;
import {EnvConfig} from './env-config.interface'; const ProdConfig: EnvConfig = { ENV: 'PROD', API: 'https://d4el2racxe.execute-api.us-east-1.amazonaws.com/mock', AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv' }; export = ProdConfig;
Update the Cognito App ID for Prod Config
Update the Cognito App ID for Prod Config
TypeScript
mit
formigio/angular-frontend,formigio/angular-frontend,formigio/angular-frontend
--- +++ @@ -6,7 +6,7 @@ AWS_REGION: 'us-east-1', COGNITO_USERPOOL: 'us-east-1_0UqEwkU0H', COGNITO_IDENTITYPOOL: 'us-east-1:38c1785e-4101-4eb4-b489-6fe8608406d0', - COGNITO_CLIENT_ID: '3mj2tpe89ihqo412m9ckml6jk' + COGNITO_CLIENT_ID: '1nupbfn12bgmra4ueie0dqagnv' }; export = ProdConfig;
983bbfb026a1eb56362fadf6a60a19815bdc22ff
spec/viewer/LoadingService.spec.ts
spec/viewer/LoadingService.spec.ts
/// <reference path="../../typings/browser.d.ts" /> import {LoadingService} from "../../src/Viewer"; describe("LoadingService", () => { var loadingService: LoadingService; beforeEach(() => { loadingService = new LoadingService(); }); it("should emit loading status", (done) => { loadingService.loading$.subscribe((loading: boolean) => { expect(loading).toBe(false); done(); }); loadingService.startLoading("task"); }); it("should emit not loading status", (done) => { loadingService.startLoading("test"); loadingService.loading$.subscribe((loading: boolean) => { expect(loading).toBe(false); done(); }); loadingService.stopLoading("task"); }); });
/// <reference path="../../typings/browser.d.ts" /> import {LoadingService} from "../../src/Viewer"; describe("LoadingService", () => { var loadingService: LoadingService; beforeEach(() => { loadingService = new LoadingService(); }); it("should be initialized to not loading", (done) => { loadingService.loading$ .subscribe((loading: boolean) => { expect(loading).toBe(false); done(); }); }); });
Remove timing based loading service test.
Remove timing based loading service test.
TypeScript
mit
mapillary/mapillary-js,mapillary/mapillary-js
--- +++ @@ -9,23 +9,11 @@ loadingService = new LoadingService(); }); - it("should emit loading status", (done) => { - loadingService.loading$.subscribe((loading: boolean) => { - expect(loading).toBe(false); - done(); - }); - - loadingService.startLoading("task"); - }); - - it("should emit not loading status", (done) => { - loadingService.startLoading("test"); - - loadingService.loading$.subscribe((loading: boolean) => { - expect(loading).toBe(false); - done(); - }); - - loadingService.stopLoading("task"); + it("should be initialized to not loading", (done) => { + loadingService.loading$ + .subscribe((loading: boolean) => { + expect(loading).toBe(false); + done(); + }); }); });
f986d6129c8c50b193aacf9a23de1f11be40bb34
src/app/core/models/run-record.model.ts
src/app/core/models/run-record.model.ts
import { RunDuration } from '../run-duration'; import { MongooseRunStatus } from '../mongoose-run-status'; export interface MongooseRunRecord { status: MongooseRunStatus; startTime: String; Nodes: String[]; Duration: RunDuration; comment: String; }
import { RunDuration } from '../run-duration'; import { MongooseRunStatus } from '../mongoose-run-status'; export class MongooseRunRecord { constructor(status: MongooseRunStatus, startTime: String, Nodes: String[], duration: RunDuration, comment: String) { } }
Replace type of MongooseRunRecord from interface to class.
Replace type of MongooseRunRecord from interface to class.
TypeScript
mit
emc-mongoose/console,emc-mongoose/console,emc-mongoose/console
--- +++ @@ -1,10 +1,8 @@ import { RunDuration } from '../run-duration'; import { MongooseRunStatus } from '../mongoose-run-status'; -export interface MongooseRunRecord { - status: MongooseRunStatus; - startTime: String; - Nodes: String[]; - Duration: RunDuration; - comment: String; +export class MongooseRunRecord { + + constructor(status: MongooseRunStatus, startTime: String, Nodes: String[], duration: RunDuration, comment: String) { } + }
516c18cc093535ddf354ee638c91a9ecab0d5342
src/browser/components/error/servererror.tsx
src/browser/components/error/servererror.tsx
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. import * as React from 'react'; let shell: Electron.Shell = (window as any).require('electron').remote.shell; export namespace ServerError { export interface Props { launchFromPath: () => void; } } export function ServerError(props: ServerError.Props) { return ( <div className='jpe-ServerError-body'> <div className='jpe-ServerError-content'> <div className='jpe-ServerError-icon'></div> <h1 className='jpe-ServerError-header'>Jupyter Server Not Found</h1> <p className='jpe-ServerError-subhead'>We were unable to launch a Jupyter server, which is a prerequisite for JupyterLab Native. If Jupyter v4.3.0 or greater is already installed, but it is not in your PATH, specify its location below. Otherwise, try installing or updating Jupyter.</p> <div className='jpe-ServerError-btn-container'> <button className='jpe-ServerError-btn' onClick={props.launchFromPath}>CHOOSE PATH</button> <button className='jpe-ServerError-btn' onClick={() => { shell.openExternal('https://www.jupyter.org/install.html'); }}>INSTALL JUPYTER</button> </div> </div> </div> ); }
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. import * as React from 'react'; let shell: Electron.Shell = (window as any).require('electron').remote.shell; export namespace ServerError { export interface Props { launchFromPath: () => void; } } export function ServerError(props: ServerError.Props) { return ( <div className='jpe-ServerError-body'> <div className='jpe-ServerError-content'> <div className='jpe-ServerError-icon'></div> <h1 className='jpe-ServerError-header'>Jupyter Server Not Found</h1> <p className='jpe-ServerError-subhead'>We were unable to launch a Jupyter server, which is a prerequisite for JupyterLab Native. If Jupyter is already installed, but it is not in your PATH, specify its location below. Otherwise, try installing or updating Jupyter. The Jupyter notebook version should be 4.3.0 or greater.</p> <div className='jpe-ServerError-btn-container'> <button className='jpe-ServerError-btn' onClick={props.launchFromPath}>CHOOSE PATH</button> <button className='jpe-ServerError-btn' onClick={() => { shell.openExternal('https://www.jupyter.org/install.html'); }}>INSTALL JUPYTER</button> </div> </div> </div> ); }
Add note about Jupyter notebook version
Add note about Jupyter notebook version
TypeScript
bsd-3-clause
nproctor/jupyterlab_app,nproctor/jupyterlab_app,nproctor/jupyterlab_app
--- +++ @@ -20,7 +20,7 @@ <div className='jpe-ServerError-content'> <div className='jpe-ServerError-icon'></div> <h1 className='jpe-ServerError-header'>Jupyter Server Not Found</h1> - <p className='jpe-ServerError-subhead'>We were unable to launch a Jupyter server, which is a prerequisite for JupyterLab Native. If Jupyter v4.3.0 or greater is already installed, but it is not in your PATH, specify its location below. Otherwise, try installing or updating Jupyter.</p> + <p className='jpe-ServerError-subhead'>We were unable to launch a Jupyter server, which is a prerequisite for JupyterLab Native. If Jupyter is already installed, but it is not in your PATH, specify its location below. Otherwise, try installing or updating Jupyter. The Jupyter notebook version should be 4.3.0 or greater.</p> <div className='jpe-ServerError-btn-container'> <button className='jpe-ServerError-btn' onClick={props.launchFromPath}>CHOOSE PATH</button> <button className='jpe-ServerError-btn' onClick={() => {
6667189339b084d7f49b743a020dba701702c1d0
JSlider.ts
JSlider.ts
/** * Created by sigurdbergsvela on 15.01.14. */ ///<reference path="defs/jquery.d.ts"/> class JSlider { private _options = { }; private sliderWrapper : JQuery; private slidesWrapper : JQuery; private slides : JQuery; /** * Creates a new slider out of an HTMLElement * * The htmlElement is expected to be the wrapper of the slider. * The structur is expected to be * <div> <!--The slider wrapper--> * <ul> <!--The slides--> * <li></li> <!--A Single slide--> * <li></li> <!--A Single slide--> * <li></li> <!--A Single slide--> * </ul> * </div> * * The ul element will be gived display:block, and all the LI elements will * be given a width and height of 100%; * * options * .delay : How long between each slide, -1 for no automated sliding */ constructor(sliderWrapper : HTMLDivElement, options : Object = {}) { this._options = options['delay'] || 100; this.sliderWrapper = jQuery(sliderWrapper); this.slidesWrapper = this.sliderWrapper.children("ul"); this.slides = this.slidesWrapper.children("li"); } public start() : void { } }
/** * Created by sigurdbergsvela on 15.01.14. */ ///<reference path="defs/jquery.d.ts"/> class JSlider { private _options = { }; private sliderWrapper : JQuery; private slidesWrapper : JQuery; private slides : JQuery; /** * Creates a new slider out of an HTMLElement * * The htmlElement is expected to be the wrapper of the slider. * The structur is expected to be * <div> <!--The slider wrapper--> * <ul> <!--The slides--> * <li></li> <!--A Single slide--> * <li></li> <!--A Single slide--> * <li></li> <!--A Single slide--> * </ul> * </div> * * The ul element will be gived display:block, and all the LI elements will * be given a width and height of 100%; * * options * .delay : How long between each slide, -1 for no automated sliding */ constructor(sliderWrapper : HTMLDivElement, options : Object = {}) { this._options['delay'] = options['delay'] || 100; this.sliderWrapper = jQuery(sliderWrapper); this.slidesWrapper = this.sliderWrapper.children("ul"); this.slides = this.slidesWrapper.children("li"); } public start() : void { } }
Fix default for 'delay' option
Fix default for 'delay' option
TypeScript
lgpl-2.1
sigurdsvela/JSlider
--- +++ @@ -31,7 +31,7 @@ * .delay : How long between each slide, -1 for no automated sliding */ constructor(sliderWrapper : HTMLDivElement, options : Object = {}) { - this._options = options['delay'] || 100; + this._options['delay'] = options['delay'] || 100; this.sliderWrapper = jQuery(sliderWrapper); this.slidesWrapper = this.sliderWrapper.children("ul"); this.slides = this.slidesWrapper.children("li");
aa986c84d5053d6f9d0883c00a66dcfe2b82024c
src/app/app-nav-views.ts
src/app/app-nav-views.ts
export const views: Object[] = [ { name: 'Dashboard', icon: 'home', link: [''] }, { name: 'Lazy', icon: 'file_download', link: ['lazy'] }, { name: 'Sync', icon: 'done', link: ['sync'] }, { name: 'Bad Link', icon: 'error', link: ['wronglink'] } ];
export const views: Object[] = [ { name: 'Dashboard', icon: 'home', link: [''] }, { name: 'Sme UP', icon: 'home', link: ['smeup'] }, { name: 'Lazy', icon: 'file_download', link: ['lazy'] }, { name: 'Sync', icon: 'done', link: ['sync'] }, { name: 'Bad Link', icon: 'error', link: ['wronglink'] } ];
Add Sme UP to views
Add Sme UP to views
TypeScript
mit
fioletti-smeup/ng-smeup,fioletti-smeup/ng-smeup,fioletti-smeup/ng-smeup
--- +++ @@ -3,6 +3,11 @@ name: 'Dashboard', icon: 'home', link: [''] + }, + { + name: 'Sme UP', + icon: 'home', + link: ['smeup'] }, { name: 'Lazy',
544fdf23bf013ef7202b085a9796a1fbd9523b0e
typescript/tssearch/src/searchoption.ts
typescript/tssearch/src/searchoption.ts
/* * searchoption.js * * encapsulates a search option */ "use strict"; interface SettingsFunc { (): void; } export class SearchOption { shortarg: string; longarg: string; desc: string; func: SettingsFunc; public sortarg: string; constructor(shortarg: string, longarg: string, desc: string, func: SettingsFunc) { this.shortarg = shortarg; this.longarg = longarg; this.desc = desc; this.func = func; this.sortarg = this.getSortarg(); } private getSortarg(): string { if (this.shortarg) return this.shortarg.toLowerCase() + 'a' + this.longarg.toLowerCase(); return this.longarg.toLowerCase(); } }
/* * searchoption.js * * encapsulates a search option */ "use strict"; export class SearchOption { shortarg: string; longarg: string; desc: string; public sortarg: string; constructor(shortarg: string, longarg: string, desc: string) { this.shortarg = shortarg; this.longarg = longarg; this.desc = desc; this.sortarg = this.getSortarg(); } private getSortarg(): string { if (this.shortarg) return this.shortarg.toLowerCase() + 'a' + this.longarg.toLowerCase(); return this.longarg.toLowerCase(); } }
Remove func property from SearchOption
Remove func property from SearchOption
TypeScript
mit
clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch,clarkcb/xsearch
--- +++ @@ -6,22 +6,16 @@ "use strict"; -interface SettingsFunc { - (): void; -} - export class SearchOption { shortarg: string; longarg: string; desc: string; - func: SettingsFunc; public sortarg: string; - constructor(shortarg: string, longarg: string, desc: string, func: SettingsFunc) { + constructor(shortarg: string, longarg: string, desc: string) { this.shortarg = shortarg; this.longarg = longarg; this.desc = desc; - this.func = func; this.sortarg = this.getSortarg(); }
b0648fff1eac4b470f077b13738a6a84618f4a2e
app/src/ui/clone-repository/github-clone.tsx
app/src/ui/clone-repository/github-clone.tsx
import * as React from 'react' import { getDefaultDir } from '../lib/default-dir' import { DialogContent } from '../dialog' import { TextBox } from '../lib/text-box' import { Row } from '../lib/row' import { Button } from '../lib/button' interface ICloneGithubRepositoryProps { // readonly onError: (error: Error | null) => void readonly onPathChanged: (path: string) => void // readonly onUrlChanged: (url: string) => void } interface ICloneGithubRepositoryState { readonly url: string readonly path: string readonly repositoryName: string } export class CloneGithubRepository extends React.Component< ICloneGithubRepositoryProps, ICloneGithubRepositoryState > { public constructor(props: ICloneGithubRepositoryProps) { super(props) this.state = { url: '', path: getDefaultDir(), repositoryName: '', } } public render() { return ( <DialogContent> <Row> <TextBox placeholder="Filter repos" value={this.state.repositoryName} onValueChanged={this.onFilter} autoFocus={true} /> </Row> <Row> <TextBox value={this.state.path} label={__DARWIN__ ? 'Local Path' : 'Local path'} placeholder="repository path" onValueChanged={this.onPathChanged} /> {/* <Button onClick={this.pickAndSetDirectory}>Choose…</Button> */} </Row> </DialogContent> ) } private onFilter = (s: string) => { this.setState({ repositoryName: s }) } // private onSelection = (placeholder: string) => { // this.setState({ url: placeholder }) // this.props.onUrlChanged(placeholder) // } private onPathChanged = (path: string) => { this.setState({ path }) this.props.onPathChanged(path) } }
Add component for cloning GitHub repos
Add component for cloning GitHub repos
TypeScript
mit
say25/desktop,desktop/desktop,shiftkey/desktop,shiftkey/desktop,shiftkey/desktop,gengjiawen/desktop,hjobrien/desktop,kactus-io/kactus,gengjiawen/desktop,say25/desktop,j-f1/forked-desktop,j-f1/forked-desktop,hjobrien/desktop,kactus-io/kactus,artivilla/desktop,kactus-io/kactus,say25/desktop,artivilla/desktop,desktop/desktop,say25/desktop,j-f1/forked-desktop,artivilla/desktop,j-f1/forked-desktop,artivilla/desktop,desktop/desktop,hjobrien/desktop,kactus-io/kactus,shiftkey/desktop,hjobrien/desktop,gengjiawen/desktop,gengjiawen/desktop,desktop/desktop
--- +++ @@ -0,0 +1,72 @@ +import * as React from 'react' +import { getDefaultDir } from '../lib/default-dir' +import { DialogContent } from '../dialog' +import { TextBox } from '../lib/text-box' +import { Row } from '../lib/row' +import { Button } from '../lib/button' + +interface ICloneGithubRepositoryProps { + // readonly onError: (error: Error | null) => void + readonly onPathChanged: (path: string) => void + // readonly onUrlChanged: (url: string) => void +} + +interface ICloneGithubRepositoryState { + readonly url: string + readonly path: string + readonly repositoryName: string +} + +export class CloneGithubRepository extends React.Component< + ICloneGithubRepositoryProps, + ICloneGithubRepositoryState +> { + public constructor(props: ICloneGithubRepositoryProps) { + super(props) + + this.state = { + url: '', + path: getDefaultDir(), + repositoryName: '', + } + } + + public render() { + return ( + <DialogContent> + <Row> + <TextBox + placeholder="Filter repos" + value={this.state.repositoryName} + onValueChanged={this.onFilter} + autoFocus={true} + /> + </Row> + + <Row> + <TextBox + value={this.state.path} + label={__DARWIN__ ? 'Local Path' : 'Local path'} + placeholder="repository path" + onValueChanged={this.onPathChanged} + /> + {/* <Button onClick={this.pickAndSetDirectory}>Choose…</Button> */} + </Row> + </DialogContent> + ) + } + + private onFilter = (s: string) => { + this.setState({ repositoryName: s }) + } + + // private onSelection = (placeholder: string) => { + // this.setState({ url: placeholder }) + // this.props.onUrlChanged(placeholder) + // } + + private onPathChanged = (path: string) => { + this.setState({ path }) + this.props.onPathChanged(path) + } +}
47c4e867f0f3c1a56a2e8ff92c77dd65c9f15609
src/components/todo.ts
src/components/todo.ts
import Component from 'inferno-component' import h from 'inferno-hyperscript' interface Props { title: string, completed: boolean, toggle(), remove() } interface State {} export default class Todo extends Component<Props, State> { render() { return h('div', [ h('input', { type: 'checkbox', checked: this.props.completed, onChange: this.props.toggle }), h('span', this.props.title), h('button', { onClick: this.props.remove }) ]) } }
import Component from 'inferno-component' import h from 'inferno-hyperscript' interface Props { title: string, completed: boolean, toggle: () => void, remove: () => void } interface State {} export default class Todo extends Component<Props, State> { render() { return h('div', [ h('input', { type: 'checkbox', checked: this.props.completed, onChange: this.props.toggle }), h('span', this.props.title), h('button', { onClick: this.props.remove }) ]) } }
Tweak Todo Component Props type
Tweak Todo Component Props type
TypeScript
mit
y0za/typescript-inferno-todo,y0za/typescript-inferno-todo,y0za/typescript-inferno-todo
--- +++ @@ -4,8 +4,8 @@ interface Props { title: string, completed: boolean, - toggle(), - remove() + toggle: () => void, + remove: () => void } interface State {}
a8c6fb992c909a634afb1dd688efcf1bd19b4acc
src/view.ts
src/view.ts
import {StatusBarItem} from 'vscode'; export interface IView { /** * Refresh the view. */ refresh(text: string): void; } export class StatusBarView implements IView { private _statusBarItem: StatusBarItem; constructor(statusBarItem: StatusBarItem) { this._statusBarItem = statusBarItem; }; refresh(text: string) { this._statusBarItem.text = '$(git-commit) ' + text; this._statusBarItem.tooltip = 'git blame'; // this._statusBarItem.command = 'extension.blame'; this._statusBarItem.show(); } }
import {StatusBarItem} from 'vscode'; export interface IView { /** * Refresh the view. */ refresh(text: string): void; } export class StatusBarView implements IView { private _statusBarItem: StatusBarItem; constructor(statusBarItem: StatusBarItem) { this._statusBarItem = statusBarItem; this._statusBarItem.command = "extension.blame" }; refresh(text: string) { this._statusBarItem.text = '$(git-commit) ' + text; this._statusBarItem.tooltip = 'git blame'; // this._statusBarItem.command = 'extension.blame'; this._statusBarItem.show(); } }
Make the blame informations popup when clicking on statusBar.
Make the blame informations popup when clicking on statusBar.
TypeScript
mit
waderyan/vscode-gitblame
--- +++ @@ -16,6 +16,7 @@ constructor(statusBarItem: StatusBarItem) { this._statusBarItem = statusBarItem; + this._statusBarItem.command = "extension.blame" }; refresh(text: string) {
1ee647e63243ce4076ab43b5a42f1f2548e5d7db
src/images/actions.tsx
src/images/actions.tsx
import * as Axios from "axios"; import { Thunk } from "../redux/interfaces"; import { Point } from "../farm_designer/interfaces"; import { API } from "../api"; import { success } from "../ui"; const QUERY = { meta: { created_by: "plant-detection" } }; const URL = API.current.pointSearchPath; export function resetWeedDetection(): Thunk { return async function (dispatch, getState) { try { let { data } = await Axios.post<Point[]>(URL, QUERY); let ids = data.map(x => x.id); if (ids.length) { await Axios.delete(API.current.pointsPath + ids.join(",")); dispatch({ type: "DELETE_POINT_OK", payload: ids }); success(`Deleted ${ids.length} weeds`); } else { success("Nothing to delete."); } } catch (e) { throw e; } }; };
import * as Axios from "axios"; import { Thunk } from "../redux/interfaces"; import { Point } from "../farm_designer/interfaces"; import { API } from "../api"; import { success, error } from "../ui"; import { t } from "i18next"; const QUERY = { meta: { created_by: "plant-detection" } }; const URL = API.current.pointSearchPath; export function resetWeedDetection(): Thunk { return async function (dispatch, getState) { try { let { data } = await Axios.post<Point[]>(URL, QUERY); let ids = data.map(x => x.id); // If you delete too many points, you will violate the URL length // limitation of 2,083. Chunking helps fix that. let chunks = _.chunk(ids, 300).map(function (chunk) { return Axios.delete(API.current.pointsPath + ids.join(",")); }); Promise.all(chunks) .then(function () { dispatch({ type: "DELETE_POINT_OK", payload: ids }); success(t("Deleted {{num}} weeds", { num: ids.length })); }) .catch(function (e) { console.dir(e); error(t("Some weeds failed to delete. Please try again.")); }); } catch (e) { throw e; } }; };
Break weed deletion into chunks of 300 to prevent long URLs
Break weed deletion into chunks of 300 to prevent long URLs
TypeScript
mit
RickCarlino/farmbot-web-frontend,FarmBot/farmbot-web-frontend,MrChristofferson/farmbot-web-frontend,FarmBot/farmbot-web-frontend,RickCarlino/farmbot-web-frontend,MrChristofferson/farmbot-web-frontend
--- +++ @@ -2,28 +2,36 @@ import { Thunk } from "../redux/interfaces"; import { Point } from "../farm_designer/interfaces"; import { API } from "../api"; -import { success } from "../ui"; +import { success, error } from "../ui"; +import { t } from "i18next"; const QUERY = { meta: { created_by: "plant-detection" } }; const URL = API.current.pointSearchPath; export function resetWeedDetection(): Thunk { - return async function (dispatch, getState) { - try { - let { data } = await Axios.post<Point[]>(URL, QUERY); - let ids = data.map(x => x.id); - if (ids.length) { - await Axios.delete(API.current.pointsPath + ids.join(",")); - dispatch({ - type: "DELETE_POINT_OK", - payload: ids - }); - success(`Deleted ${ids.length} weeds`); - } else { - success("Nothing to delete."); - } - } catch (e) { - throw e; - } - }; + return async function (dispatch, getState) { + try { + let { data } = await Axios.post<Point[]>(URL, QUERY); + let ids = data.map(x => x.id); + // If you delete too many points, you will violate the URL length + // limitation of 2,083. Chunking helps fix that. + let chunks = _.chunk(ids, 300).map(function (chunk) { + return Axios.delete(API.current.pointsPath + ids.join(",")); + }); + Promise.all(chunks) + .then(function () { + dispatch({ + type: "DELETE_POINT_OK", + payload: ids + }); + success(t("Deleted {{num}} weeds", { num: ids.length })); + }) + .catch(function (e) { + console.dir(e); + error(t("Some weeds failed to delete. Please try again.")); + }); + } catch (e) { + throw e; + } + }; };
d186d8e843ef8c78129edce389e6b2fb8d6d9c80
angular/src/account/account.component.ts
angular/src/account/account.component.ts
import { Component, ViewContainerRef, OnInit, ViewEncapsulation, Injector } from '@angular/core'; import { LoginService } from './login/login.service'; import { AppComponentBase } from '@shared/app-component-base'; @Component({ templateUrl: './account.component.html', styleUrls: [ './account.component.less' ], encapsulation: ViewEncapsulation.None }) export class AccountComponent extends AppComponentBase implements OnInit { versionText: string; currentYear: number; private viewContainerRef: ViewContainerRef; public constructor( injector: Injector, private _loginService: LoginService ) { super(injector); this.currentYear = new Date().getFullYear(); this.versionText = this.appSession.application.version + ' [' + this.appSession.application.releaseDate.format('YYYYDDMM') + ']'; } showTenantChange(): boolean { return abp.multiTenancy.isEnabled; } ngOnInit(): void { $('body').attr('class', 'login-page'); } }
import { Component, ViewContainerRef, OnInit, ViewEncapsulation, Injector } from '@angular/core'; import { LoginService } from './login/login.service'; import { AppComponentBase } from '@shared/app-component-base'; @Component({ templateUrl: './account.component.html', styleUrls: [ './account.component.less' ], encapsulation: ViewEncapsulation.None }) export class AccountComponent extends AppComponentBase implements OnInit { versionText: string; currentYear: number; private viewContainerRef: ViewContainerRef; public constructor( injector: Injector, private _loginService: LoginService ) { super(injector); this.currentYear = new Date().getFullYear(); this.versionText = this.appSession.application.version + ' [' + this.appSession.application.releaseDate.format('YYYYDDMM') + ']'; } showTenantChange(): boolean { return abp.multiTenancy.isEnabled; } ngOnInit(): void { $('body').addClass('login-page'); } }
Add a class instead of override the whole attribute
Add a class instead of override the whole attribute
TypeScript
mit
aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template,aspnetboilerplate/module-zero-core-template
--- +++ @@ -31,6 +31,6 @@ } ngOnInit(): void { - $('body').attr('class', 'login-page'); + $('body').addClass('login-page'); } }
a4bacb926537a8b9edc576eda9678122f9858d20
src/index.ts
src/index.ts
/// <reference path="./asana.d.ts" /> import Asana = require("asana"); export function getAsanaClient(): Asana.Client { return Asana.Client.create(); }
/// <reference path="./asana.d.ts" /> import Asana = require("asana"); /** * Example function that uses the asana npm package (for testing gulp). * TODO: Delete once I start implementing the tester. * * @returns {Asana.Client} */ export function getAsanaClient(): Asana.Client { return Asana.Client.create(); }
Add comment to test function
Add comment to test function
TypeScript
mit
Asana/api-explorer,Asana/api-explorer
--- +++ @@ -1,6 +1,12 @@ /// <reference path="./asana.d.ts" /> import Asana = require("asana"); +/** + * Example function that uses the asana npm package (for testing gulp). + * TODO: Delete once I start implementing the tester. + * + * @returns {Asana.Client} + */ export function getAsanaClient(): Asana.Client { return Asana.Client.create(); }
f84eaa861e55b5e258016c9c88e2b7bd2c03ec25
src/lazy-views/loading.tsx
src/lazy-views/loading.tsx
import * as React from 'react' import {Spinner} from '../material/spinner' import style from './loading.css' export function Loading() { return ( <div className={style.container}> <Spinner /> </div> ) }
import * as React from 'react' import {LoadingComponentProps} from 'react-loadable' import {Spinner} from '../material/spinner' import style from './loading.css' import {Ouch} from '../error-boundary/ouch' export function Loading({error, pastDelay}: LoadingComponentProps) { if (error) { return <Ouch error="Failed to load route." /> } if (pastDelay) { return ( <div className={style.container}> <Spinner /> </div> ) } return null }
Fix improper use of react-loadable component
Fix improper use of react-loadable component
TypeScript
mit
Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc
--- +++ @@ -1,11 +1,19 @@ import * as React from 'react' +import {LoadingComponentProps} from 'react-loadable' import {Spinner} from '../material/spinner' import style from './loading.css' +import {Ouch} from '../error-boundary/ouch' -export function Loading() { - return ( - <div className={style.container}> - <Spinner /> - </div> - ) +export function Loading({error, pastDelay}: LoadingComponentProps) { + if (error) { + return <Ouch error="Failed to load route." /> + } + if (pastDelay) { + return ( + <div className={style.container}> + <Spinner /> + </div> + ) + } + return null }
6c01fb92c84f2558bb4cc70207d1918a79a5634d
src/app/classes/string/string-helper.spec.ts
src/app/classes/string/string-helper.spec.ts
import { Whitespace } from '../whitespace/whitespace'; export class StringHelper { readonly whitespace = new Whitespace(); /** * Assert supplied strings are equal. Shows line by line difference */ assertEquals(one: string, other: string): void { const oneLines = this.lines(one); const otherLines = this.lines(other); expect(oneLines.length).toEqual(otherLines.length); for (let i = 0; i < oneLines.length; i++) { expect(this.whitespace.show(oneLines[i])).toEqual(this.whitespace.show(otherLines[i])); } } private lines(value: string): string[] { return value.split('\n'); } }
import { Whitespace } from '../whitespace/whitespace'; export class StringHelper { readonly whitespace = new Whitespace(); /** * Assert supplied strings are equal. Shows line by line difference */ assertEquals(one: string, other: string): void { const oneLines = this.lines(one); const otherLines = this.lines(other); expect(oneLines.length).toEqual(otherLines.length); for (let i = 0; i < oneLines.length; i++) { expect('[line ' + i + ']' + this.whitespace.show(oneLines[i])).toEqual('[line ' + i + ']' + this.whitespace.show(otherLines[i])); } } private lines(value: string): string[] { return value.split('\n'); } }
Add line numbers to string helper output
Add line numbers to string helper output
TypeScript
mit
bvkatwijk/code-tools,bvkatwijk/code-tools,bvkatwijk/code-tools
--- +++ @@ -13,7 +13,7 @@ expect(oneLines.length).toEqual(otherLines.length); for (let i = 0; i < oneLines.length; i++) { - expect(this.whitespace.show(oneLines[i])).toEqual(this.whitespace.show(otherLines[i])); + expect('[line ' + i + ']' + this.whitespace.show(oneLines[i])).toEqual('[line ' + i + ']' + this.whitespace.show(otherLines[i])); } }
f48a6085733d23eaf0933126a1ace928af007ae7
src/App.test.tsx
src/App.test.tsx
import { createRoot } from 'react-dom/client' import { App } from './App' describe('App', () => { test('renders', () => { const container = document.createElement('div') const root = createRoot(container) root.render(<App />) root.unmount() container.remove() }) })
import { render, screen } from '@testing-library/react' import { App } from './App' const renderApp = () => render(<App />) describe('App', () => { test('renders a link to the repository', () => { renderApp() const link: HTMLAnchorElement = screen.getByRole('link', { name: 'Go to GitHub repository page' }) expect(link).toBeDefined() expect(link.href).toEqual( 'https://github.com/joelgeorgev/react-checkbox-tree' ) }) })
Test for presence of repository link
Test for presence of repository link
TypeScript
mit
joelgeorgev/react-checkbox-tree,joelgeorgev/react-checkbox-tree
--- +++ @@ -1,15 +1,20 @@ -import { createRoot } from 'react-dom/client' +import { render, screen } from '@testing-library/react' import { App } from './App' +const renderApp = () => render(<App />) + describe('App', () => { - test('renders', () => { - const container = document.createElement('div') - const root = createRoot(container) + test('renders a link to the repository', () => { + renderApp() - root.render(<App />) + const link: HTMLAnchorElement = screen.getByRole('link', { + name: 'Go to GitHub repository page' + }) - root.unmount() - container.remove() + expect(link).toBeDefined() + expect(link.href).toEqual( + 'https://github.com/joelgeorgev/react-checkbox-tree' + ) }) })
40cd722eaf97da5b8e45381269c7504ad9f37fe7
packages/common/exceptions/http.exception.ts
packages/common/exceptions/http.exception.ts
export class HttpException extends Error { public readonly message: any; /** * Base Nest application exception, which is handled by the default Exceptions Handler. * If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client. * * When `response` is an object: * - object will be stringified and returned to the user as a JSON response, * * When `response` is a string: * - Nest will create a response with two properties: * ``` * message: response, * statusCode: X * ``` */ constructor( private readonly response: string | object, private readonly status: number, ) { super(); this.message = response; } public getResponse(): string | object { return this.response; } public getStatus(): number { return this.status; } private getError(target) { if(typeof target === 'string') { return target; } return JSON.stringify(target); } public toString(): string { const message = this.getError(this.message); return `Error: ${message}`; } }
export class HttpException extends Error { public readonly message: any; /** * Base Nest application exception, which is handled by the default Exceptions Handler. * If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client. * * When `response` is an object: * - object will be stringified and returned to the user as a JSON response, * * When `response` is a string: * - Nest will create a response with two properties: * ``` * message: response, * statusCode: X * ``` */ constructor( private readonly response: string | object, private readonly status: number, ) { super(); this.message = response; } public getResponse(): string | object { return this.response; } public getStatus(): number { return this.status; } private getErrorString(target) { if(typeof target === 'string') { return target; } return JSON.stringify(target); } public toString(): string { const message = this.getErrorString(this.message); return `Error: ${message}`; } }
Change name to not collide with duplicate definition in RpcException
Change name to not collide with duplicate definition in RpcException
TypeScript
mit
kamilmysliwiec/nest,kamilmysliwiec/nest
--- +++ @@ -31,7 +31,7 @@ return this.status; } - private getError(target) { + private getErrorString(target) { if(typeof target === 'string') { return target; } @@ -40,7 +40,7 @@ } public toString(): string { - const message = this.getError(this.message); + const message = this.getErrorString(this.message); return `Error: ${message}`; }
bf319915d4f78dc5a9f526bf37a0ee8875260bcb
src/cli/index.ts
src/cli/index.ts
import sade from 'sade'; import * as pkg from '../../package.json'; const prog = sade('svelte').version(pkg.version); prog .command('compile <input>') .option('-o, --output', 'Output (if absent, prints to stdout)') .option('-f, --format', 'Type of output (amd, cjs, es, iife, umd)') .option('-g, --globals', 'Comma-separate list of `module ID:Global` pairs') .option('-n, --name', 'Name for IIFE/UMD export (inferred from filename by default)') .option('-m, --sourcemap', 'Generate sourcemap (`-m inline` for inline map)') .option('-d, --dev', 'Add dev mode warnings and errors') .option('--amdId', 'ID for AMD module (default is anonymous)') .option('--generate', 'Change generate format between `dom` and `ssr`') .option('--no-css', `Don't include CSS (useful with SSR)`) .option('--immutable', 'Support immutable data structures') .option('--shared', 'Don\'t include shared helpers') .example('compile App.html > App.js') .example('compile src -o dest') .example('compile -f umd MyComponent.html > MyComponent.js') .action((input, opts) => { import('./compile').then(({ compile }) => { compile(input, opts); }); }) .parse(process.argv);
import sade from 'sade'; import * as pkg from '../../package.json'; const prog = sade('svelte').version(pkg.version); prog .command('compile <input>') .option('-o, --output', 'Output (if absent, prints to stdout)') .option('-f, --format', 'Type of output (amd, cjs, es, iife, umd)') .option('-g, --globals', 'Comma-separate list of `module ID:Global` pairs') .option('-n, --name', 'Name for IIFE/UMD export (inferred from filename by default)') .option('-m, --sourcemap', 'Generate sourcemap (`-m inline` for inline map)') .option('-d, --dev', 'Add dev mode warnings and errors') .option('--amdId', 'ID for AMD module (default is anonymous)') .option('--generate', 'Change generate format between `dom` and `ssr`') .option('--no-css', `Don't include CSS (useful with SSR)`) .option('--immutable', 'Support immutable data structures') .option('--shared', 'Don\'t include shared helpers') .option('--customElement', 'Generate a custom element') .example('compile App.html > App.js') .example('compile src -o dest') .example('compile -f umd MyComponent.html > MyComponent.js') .action((input, opts) => { import('./compile').then(({ compile }) => { compile(input, opts); }); }) .parse(process.argv);
Update cli spec to include --customElement option
Update cli spec to include --customElement option
TypeScript
mit
sveltejs/svelte,sveltejs/svelte
--- +++ @@ -17,6 +17,7 @@ .option('--no-css', `Don't include CSS (useful with SSR)`) .option('--immutable', 'Support immutable data structures') .option('--shared', 'Don\'t include shared helpers') + .option('--customElement', 'Generate a custom element') .example('compile App.html > App.js') .example('compile src -o dest')
8c6e6416d44bf72421eacd1293f8eed78f805c23
client-ts/slime.ts
client-ts/slime.ts
import games from "../generated-ts/games"; import AutoPeer from "./AutoPeer"; import { Applet } from "./AppletShims"; window.onload = () => { const autoPeer = AutoPeer.Create("vxv7ldsv1h71ra4i"); const connect = document.getElementById("connect") as HTMLButtonElement; const gamesEl = document.getElementById("games"); const gameNames = Object.keys(games); gameNames.forEach(name => { const button = document.createElement("button"); button.textContent = name; button.onclick = () => startGame(name); gamesEl.appendChild(button); }); startGame(gameNames[0]); function startGame(name: string) { Array.from(gamesEl.querySelectorAll("button")).forEach((b: HTMLButtonElement) => b.disabled = (b.textContent === name)); const disconnection = autoPeer.disconnect(); const oldCanvas = document.querySelector("canvas"); const newCanvas = document.createElement("canvas"); Array.from(oldCanvas.attributes).forEach(attr => newCanvas.setAttribute(attr.name, attr.value)); oldCanvas.parentNode.replaceChild(newCanvas, oldCanvas); const game: Applet = new games[name](); connect.onclick = async () => { await disconnection; autoPeer.connect(game); }; game.start(); } };
import games from "../generated-ts/games"; import AutoPeer from "./AutoPeer"; import { Applet } from "./AppletShims"; window.onload = () => { const autoPeer = AutoPeer.Create("vxv7ldsv1h71ra4i"); const connect = document.getElementById("connect") as HTMLButtonElement; const gamesEl = document.getElementById("games"); const gameNames = Object.keys(games); gameNames.forEach(name => { const button = document.createElement("button"); button.textContent = name; button.onclick = () => startGame(name); gamesEl.appendChild(button); }); startGame(gameNames[0]); function startGame(name: string) { Array.from(gamesEl.querySelectorAll("button")).forEach((b: HTMLButtonElement) => b.disabled = (b.textContent === name)); const disconnection = autoPeer.disconnect(); const oldCanvas = document.querySelector("canvas"); const newCanvas = document.createElement("canvas"); Array.from(oldCanvas.attributes).forEach(attr => newCanvas.setAttribute(attr.name, attr.value)); oldCanvas.parentNode.replaceChild(newCanvas, oldCanvas); const game: Applet = new games[name](); connect.onclick = async () => { await disconnection; autoPeer.connect(game); }; game.start(); document.title = name; } };
Update document title when game starts.
Update document title when game starts.
TypeScript
mit
mmkal/slimejs,mmkal/slimejs,mmkal/slimejs,mmkal/slimejs
--- +++ @@ -32,5 +32,6 @@ autoPeer.connect(game); }; game.start(); + document.title = name; } };
8353347b054c2b4c8df0af3f1ff8638869724d85
test/rollup/rollup.test.ts
test/rollup/rollup.test.ts
import test from "ava" import execa from "execa" import * as path from "path" import { rollup } from "rollup" import config from "./rollup.config" test("can be bundled using rollup", async t => { const [appBundle, workerBundle] = await Promise.all([ rollup({ input: path.resolve(__dirname, "app.js"), ...config }), rollup({ input: path.resolve(__dirname, "worker.js"), ...config }) ]) await Promise.all([ appBundle.write({ dir: path.resolve(__dirname, "dist"), format: "iife" }), workerBundle.write({ dir: path.resolve(__dirname, "dist"), format: "iife" }) ]) const result = await execa.command("puppet-run --serve ./dist/worker.js:/worker.js ./dist/app.js", { cwd: __dirname, stderr: process.stderr }) t.is(result.exitCode, 0) })
import test from "ava" import execa from "execa" import * as path from "path" import { rollup } from "rollup" import config from "./rollup.config" test("can be bundled using rollup", async t => { const [appBundle, workerBundle] = await Promise.all([ rollup({ input: path.resolve(__dirname, "app.js"), ...config }), rollup({ input: path.resolve(__dirname, "worker.js"), ...config }) ]) await Promise.all([ appBundle.write({ dir: path.resolve(__dirname, "dist"), format: "iife" }), workerBundle.write({ dir: path.resolve(__dirname, "dist"), format: "iife" }) ]) if (process.platform === "win32") { // Quick-fix for weird Windows issue in CI return t.pass() } const result = await execa.command("puppet-run --serve ./dist/worker.js:/worker.js ./dist/app.js", { cwd: __dirname, stderr: process.stderr }) t.is(result.exitCode, 0) })
Add quick-fix for windows CI issue
Add quick-fix for windows CI issue
TypeScript
mit
andywer/threads.js,andywer/threads.js,andywer/thread.js
--- +++ @@ -27,6 +27,11 @@ }) ]) + if (process.platform === "win32") { + // Quick-fix for weird Windows issue in CI + return t.pass() + } + const result = await execa.command("puppet-run --serve ./dist/worker.js:/worker.js ./dist/app.js", { cwd: __dirname, stderr: process.stderr
76df38c6df3bc93bec180507ffa89ec090f734f7
src/context.ts
src/context.ts
import {run} from "enonic-fp/context"; import {chain, IOEither} from "fp-ts/IOEither"; import {RunContext} from "enonic-types/context"; export function chainRun(runContext: RunContext) : <E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B> { return <E, A, B>(f: (a: A) => IOEither<E, B>) => chain((a: A) => run(runContext)(f(a))) } export const runAsSuperUser = run({ user: { login: "su", idProvider: 'system' } }); export const runInDraftContext = run({ branch: 'draft' }); export const chainRunAsSuperUser = chainRun({ user: { login: "su", idProvider: 'system' } }); export const chainRunInDraftContext = chainRun({ branch: 'draft' });
import {run} from "enonic-fp/context"; import {chain, IOEither} from "fp-ts/IOEither"; import {RunContext} from "enonic-types/context"; export function chainRun(runContext: RunContext) : <E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B> { return <E, A, B>(f: (a: A) => IOEither<E, B>) => chain<E, A, B>((a: A) => run(runContext)(f(a))) } export const runAsSuperUser = run({ user: { login: "su", idProvider: 'system' } }); export const runInDraftContext = run({ branch: 'draft' }); export const chainRunAsSuperUser = chainRun({ user: { login: "su", idProvider: 'system' } }); export const chainRunInDraftContext = chainRun({ branch: 'draft' });
Add more generics for Context.chainRun
Add more generics for Context.chainRun
TypeScript
mit
ItemConsulting/wizardry
--- +++ @@ -5,7 +5,7 @@ export function chainRun(runContext: RunContext) : <E, A, B>(f: (a: A) => IOEither<E, B>) => (ma: IOEither<E, A>) => IOEither<E, B> { - return <E, A, B>(f: (a: A) => IOEither<E, B>) => chain((a: A) => run(runContext)(f(a))) + return <E, A, B>(f: (a: A) => IOEither<E, B>) => chain<E, A, B>((a: A) => run(runContext)(f(a))) } export const runAsSuperUser = run({
9552c9fd5b61b7bdda0dfd1a05e56c16b6669924
src/components/index.ts
src/components/index.ts
import { Stream } from 'xstream'; import { DOMSource } from '@cycle/dom/xstream-typings'; import { VNode } from '@cycle/dom'; import { Style } from './../styles'; export interface UIComponent { (sources: UIComponentSources): UIComponentSinks; } export interface UIComponentSources { dom: DOMSource; style$: Stream<Style>; classes$: Stream<string>; } export interface UIComponentSinks { dom: Stream<VNode>; }
import { Stream } from 'xstream'; import { DOMSource } from '@cycle/dom/xstream-typings'; import { VNode } from '@cycle/dom'; import { Style } from './../styles'; export interface UIComponent { (sources: UIComponentSources): UIComponentSinks; } export interface UIComponentSources { dom: DOMSource; style$?: Stream<Style>; classes$?: Stream<string>; } export interface UIComponentSinks { dom: Stream<VNode>; }
Make style$ and class$ of UIComponent optional
Make style$ and class$ of UIComponent optional
TypeScript
mit
cyclic-ui/cyclic-ui,cyclic-ui/cyclic-ui
--- +++ @@ -9,8 +9,8 @@ export interface UIComponentSources { dom: DOMSource; - style$: Stream<Style>; - classes$: Stream<string>; + style$?: Stream<Style>; + classes$?: Stream<string>; } export interface UIComponentSinks {
108cdf149865d45656fed156cf3049b02b030341
src/Styleguide/Components/MarketInsights.tsx
src/Styleguide/Components/MarketInsights.tsx
import React from "react" import { Responsive } from "../Utils/Responsive" import { Box, BorderBox } from "../Elements/Box" import { Flex } from "../Elements/Flex" import { Sans } from "@artsy/palette" const wrapper = xs => props => xs ? <Flex flexDirection="column" mb={3} {...props} /> : <Box {...props} /> export interface MarketInsight { primaryLabel: string secondaryLabel: string } export interface MarketInsightsProps { insights: MarketInsight[] } export class MarketInsights extends React.Component<MarketInsightsProps> { render() { return ( <BorderBox flexDirection="column"> <Responsive> {({ xs }) => { const TextWrap = wrapper(xs) return this.props.insights.map(insight => { return ( <TextWrap> <Sans size="2" weight="medium" display="inline" mr={3}> {insight.primaryLabel} </Sans> <Sans size="2" display="inline" color="black60"> {insight.secondaryLabel} </Sans> </TextWrap> ) }) }} </Responsive> </BorderBox> ) } }
import React from "react" import { Responsive } from "../Utils/Responsive" import { Box, BorderBox } from "../Elements/Box" import { Flex } from "../Elements/Flex" import { Sans } from "@artsy/palette" const wrapper = xs => props => xs ? <Flex flexDirection="column" mb={3} {...props} /> : <Box {...props} /> export interface MarketInsight { primaryLabel: string secondaryLabel: string } export interface MarketInsightsProps { insights: MarketInsight[] } export class MarketInsights extends React.Component<MarketInsightsProps> { render() { return ( <BorderBox flexDirection="column"> <Responsive> {({ xs }) => { const TextWrap = wrapper(xs) return this.props.insights.map(insight => { return ( <TextWrap key={insight.primaryLabel}> <Sans size="2" weight="medium" display="inline" mr={3}> {insight.primaryLabel} </Sans> <Sans size="2" display="inline" color="black60"> {insight.secondaryLabel} </Sans> </TextWrap> ) }) }} </Responsive> </BorderBox> ) } }
Add key for iterated elements
Add key for iterated elements
TypeScript
mit
xtina-starr/reaction,xtina-starr/reaction,artsy/reaction,xtina-starr/reaction,artsy/reaction-force,artsy/reaction,artsy/reaction,xtina-starr/reaction,artsy/reaction-force
--- +++ @@ -25,7 +25,7 @@ const TextWrap = wrapper(xs) return this.props.insights.map(insight => { return ( - <TextWrap> + <TextWrap key={insight.primaryLabel}> <Sans size="2" weight="medium" display="inline" mr={3}> {insight.primaryLabel} </Sans>
710179823c3c2056dd80e2c9cf610607c2acfeff
src/helpers/regex.ts
src/helpers/regex.ts
import escapeStringRegexp = require('escape-string-regexp'); import { Command } from '../chat-service/command'; export function createCommandRegex(commands: string[], rootCommand = false): RegExp { let beginning = ''; let end = ''; if (rootCommand) { beginning = '^'; end = '$'; } return new RegExp(`${beginning}(${commands.map((element) => { return escapeStringRegexp(Command.commandPrefix) + element + '\\b'; }).join('|')})${end}`, 'i'); }
import escapeStringRegexp = require('escape-string-regexp'); import { Command } from '../chat-service/command'; export function createCommandRegex(commands: string[], rootCommand = false): RegExp { const beginning = rootCommand ? '^' : ''; const end = rootCommand ? '$' : ''; return new RegExp(`${beginning}(${commands.map((element) => { return escapeStringRegexp(Command.commandPrefix) + element + '\\b'; }).join('|')})${end}`, 'i'); }
Use shorthand expression for variable assignment in createCommandRegex
Use shorthand expression for variable assignment in createCommandRegex
TypeScript
mit
Ionaru/MarketBot
--- +++ @@ -3,12 +3,8 @@ import { Command } from '../chat-service/command'; export function createCommandRegex(commands: string[], rootCommand = false): RegExp { - let beginning = ''; - let end = ''; - if (rootCommand) { - beginning = '^'; - end = '$'; - } + const beginning = rootCommand ? '^' : ''; + const end = rootCommand ? '$' : ''; return new RegExp(`${beginning}(${commands.map((element) => { return escapeStringRegexp(Command.commandPrefix) + element + '\\b';
327b16ac2e038892a1bc1fa4ecf619f0f69f77d0
src/utils/Generic.ts
src/utils/Generic.ts
/** * Copyright (c) 2016 The xterm.js authors. All rights reserved. * @license MIT */ /** * Return if the given array contains the given element * @param {Array} array The array to search for the given element. * @param {Object} el The element to look for into the array */ export function contains(arr: any[], el: any): boolean { return arr.indexOf(el) >= 0; }
/** * Copyright (c) 2016 The xterm.js authors. All rights reserved. * @license MIT */ /** * Return if the given array contains the given element * @param {Array} array The array to search for the given element. * @param {Object} el The element to look for into the array */ export function contains(arr: any[], el: any): boolean { return arr.indexOf(el) >= 0; } /** * Returns a string repeated a given number of times * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat * @param {Number} count The number of times to repeat the string * @param {String} string The string that is to be repeated */ export function repeat(count: number, str: string): string { if (count < 0) throw new RangeError('repeat count must be non-negative'); if (count === Infinity) throw new RangeError('repeat count must be less than infinity'); count = Math.floor(count); if (str.length === 0 || count === 0) return ''; // Ensuring count is a 31-bit integer allows us to heavily optimize the // main part. But anyway, most current (August 2014) browsers can't handle // strings 1 << 28 chars or longer, so: if (str.length * count >= 1 << 28) { throw new RangeError('repeat count must not overflow maximum string size'); } let rpt = ''; for (let i = 0; i < count; i++) { rpt += str; } return rpt; }
Add repeat polyfill for repeating a string
Add repeat polyfill for repeating a string
TypeScript
mit
sourcelair/xterm.js,akalipetis/xterm.js,xtermjs/xterm.js,xtermjs/xterm.js,Tyriar/xterm.js,sourcelair/xterm.js,Tyriar/xterm.js,Tyriar/xterm.js,sourcelair/xterm.js,akalipetis/xterm.js,xtermjs/xterm.js,akalipetis/xterm.js,sourcelair/xterm.js,xtermjs/xterm.js,xtermjs/xterm.js,akalipetis/xterm.js,Tyriar/xterm.js,Tyriar/xterm.js
--- +++ @@ -11,3 +11,31 @@ export function contains(arr: any[], el: any): boolean { return arr.indexOf(el) >= 0; } + +/** + * Returns a string repeated a given number of times + * Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat + * @param {Number} count The number of times to repeat the string + * @param {String} string The string that is to be repeated + */ +export function repeat(count: number, str: string): string { + if (count < 0) throw new RangeError('repeat count must be non-negative'); + if (count === Infinity) throw new RangeError('repeat count must be less than infinity'); + + count = Math.floor(count); + if (str.length === 0 || count === 0) return ''; + + // Ensuring count is a 31-bit integer allows us to heavily optimize the + // main part. But anyway, most current (August 2014) browsers can't handle + // strings 1 << 28 chars or longer, so: + if (str.length * count >= 1 << 28) { + throw new RangeError('repeat count must not overflow maximum string size'); + } + + let rpt = ''; + for (let i = 0; i < count; i++) { + rpt += str; + } + + return rpt; +}