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
613580140357144d052af492c071ec441bc9d6db
packages/core/src/webpack/rules/css-rule.ts
packages/core/src/webpack/rules/css-rule.ts
import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import { RuleSetRule } from 'webpack'; import { notBoolean } from '../../utils/not-boolean.js'; import { getCssLoaderOptions } from '../loader-options/css-loader-options.js'; import { getPostcssLoaderOptions } from '../loader-options/post-css-loader-options.js'; import { getSassLoaderOptions } from '../loader-options/sass-loader-options.js'; export const getCssRule = ( options: { hotReload: boolean, emit: boolean, sourceMap: boolean, detailedIdentName: boolean, context: string, }, ): RuleSetRule => ({ test: /\.(css|s[ac]ss)$/i, use: [ options.hotReload && { loader: 'style-loader' }, options.hotReload || { loader: MiniCssExtractPlugin.loader, options: { emit: options.emit }, }, { loader: 'css-loader', options: getCssLoaderOptions({ sourceMap: options.sourceMap, detailedIdentName: options.detailedIdentName, context: options.context, }), }, { loader: 'postcss-loader', options: getPostcssLoaderOptions(), }, // Compiles Sass to CSS { loader: 'sass-loader', options: getSassLoaderOptions(), }, ].filter(notBoolean), });
import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import { RuleSetRule } from 'webpack'; import { notBoolean } from '../../utils/not-boolean.js'; import { getCssLoaderOptions } from '../loader-options/css-loader-options.js'; import { getPostcssLoaderOptions } from '../loader-options/post-css-loader-options.js'; import { getSassLoaderOptions } from '../loader-options/sass-loader-options.js'; export const getCssRule = ( options: { hotReload: boolean, emit: boolean, sourceMap: boolean, detailedIdentName: boolean, context: string, }, ): RuleSetRule => ({ test: /\.(css|s[ac]ss)$/i, use: [ options.hotReload && { loader: 'style-loader' }, options.hotReload || { loader: MiniCssExtractPlugin.loader, options: { emit: options.emit, publicPath: 'auto' }, }, { loader: 'css-loader', options: getCssLoaderOptions({ sourceMap: options.sourceMap, detailedIdentName: options.detailedIdentName, context: options.context, }), }, { loader: 'postcss-loader', options: getPostcssLoaderOptions(), }, // Compiles Sass to CSS { loader: 'sass-loader', options: getSassLoaderOptions(), }, ].filter(notBoolean), });
Make public path auto to resolve appropriate css relative paths
Make public path auto to resolve appropriate css relative paths
TypeScript
mit
Atyantik/react-pwa,Atyantik/react-pwa
--- +++ @@ -19,7 +19,7 @@ options.hotReload && { loader: 'style-loader' }, options.hotReload || { loader: MiniCssExtractPlugin.loader, - options: { emit: options.emit }, + options: { emit: options.emit, publicPath: 'auto' }, }, { loader: 'css-loader',
025f167c45b8541d382c66473ba903a54949bfe1
AzureFunctions.Client/app/models/constants.ts
AzureFunctions.Client/app/models/constants.ts
export class Constants { public static runtimeVersion = "~0.4"; public static nodeVersion = "5.9.1"; public static latest = "latest"; public static runtimeVersionAppSettingName = "FUNCTIONS_EXTENSION_VERSION"; public static nodeVersionAppSettingName = "WEBSITE_NODE_DEFAULT_VERSION"; }
export class Constants { public static runtimeVersion = "~0.5"; public static nodeVersion = "6.4.0"; public static latest = "latest"; public static runtimeVersionAppSettingName = "FUNCTIONS_EXTENSION_VERSION"; public static nodeVersionAppSettingName = "WEBSITE_NODE_DEFAULT_VERSION"; }
Update runtime and node versions
Update runtime and node versions
TypeScript
apache-2.0
agruning/azure-functions-ux,projectkudu/WebJobsPortal,agruning/azure-functions-ux,chunye/azure-functions-ux,projectkudu/AzureFunctions,agruning/azure-functions-ux,chunye/azure-functions-ux,chunye/azure-functions-ux,projectkudu/AzureFunctions,projectkudu/WebJobsPortal,projectkudu/WebJobsPortal,agruning/azure-functions-ux,projectkudu/WebJobsPortal,chunye/azure-functions-ux,projectkudu/AzureFunctions,agruning/azure-functions-ux,projectkudu/AzureFunctions,chunye/azure-functions-ux
--- +++ @@ -1,6 +1,6 @@ export class Constants { - public static runtimeVersion = "~0.4"; - public static nodeVersion = "5.9.1"; + public static runtimeVersion = "~0.5"; + public static nodeVersion = "6.4.0"; public static latest = "latest"; public static runtimeVersionAppSettingName = "FUNCTIONS_EXTENSION_VERSION"; public static nodeVersionAppSettingName = "WEBSITE_NODE_DEFAULT_VERSION";
21866bcae3a6af6c14f68803303ee7916d5f60bf
pages/_document.tsx
pages/_document.tsx
import Document, { Head, Html, Main, NextScript } from 'next/document'; const GaTag = ({ trackingId }: { trackingId: string | undefined }) => { if (!trackingId) return null; return ( <> <script async src={`https://www.googletagmanager.com/gtag/js?id=${trackingId}`}></script> <script dangerouslySetInnerHTML={{ __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${trackingId}'); `, }} ></script> </> ); }; class MyDocument extends Document { render() { return ( <Html> <Head> <GaTag trackingId={process.env.GA_TRACKING_ID} /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument;
import Document, { Head, Html, Main, NextScript } from 'next/document'; const GaTag = ({ trackingId }: { trackingId: string | undefined }) => { if (!trackingId) return null; return ( <> <script async src={`https://www.googletagmanager.com/gtag/js?id=${trackingId}`}></script> <script dangerouslySetInnerHTML={{ __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '${trackingId}'); `, }} ></script> </> ); }; class MyDocument extends Document { render() { return ( <Html lang="en"> <Head> <GaTag trackingId={process.env.GA_TRACKING_ID} /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument;
Add lang to html tag
Add lang to html tag
TypeScript
mit
Alxandr/alxandr.me,Alxandr/alxandr.me,Alxandr/alxandr.me
--- +++ @@ -24,7 +24,7 @@ class MyDocument extends Document { render() { return ( - <Html> + <Html lang="en"> <Head> <GaTag trackingId={process.env.GA_TRACKING_ID} /> </Head>
d8bde3d313194684b8dda6553200febdfe7663f3
ng2-timetable/app/schedule/schedule.component.ts
ng2-timetable/app/schedule/schedule.component.ts
import {Component} from 'angular2/core'; import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; import {MATERIAL_DIRECTIVES, MATERIAL_PROVIDERS} from 'ng2-material/all'; import {EventsListComponent} from './events-list.component'; import {EventDetailComponent} from './event-detail.component'; import {EventFormComponent} from './event-form.component'; @Component({ template: ` <md-content class="md-padding" layout="row" layout-wrap layout-align="end start"> <a [routerLink]="['EventForm']"> <button md-raised-button class="md-raised md-primary">Новий захід</button> </a> </md-content> <router-outlet></router-outlet>`, directives: [ROUTER_DIRECTIVES, MATERIAL_DIRECTIVES], providers: [MATERIAL_PROVIDERS] }) @RouteConfig([ {path:'/events', name: 'Events', component: EventsListComponent, useAsDefault: true}, {path:'/events/new', name: 'EventForm', component: EventFormComponent}, {path:'/events/:id', name: 'EventDetail', component: EventDetailComponent}, ]) export class ScheduleComponent { }
import {Component} from 'angular2/core'; import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; import {MATERIAL_DIRECTIVES, MATERIAL_PROVIDERS} from 'ng2-material/all'; import {LessonListComponent} from './lesson-list.component'; import {EventsListComponent} from './events-list.component'; import {EventDetailComponent} from './event-detail.component'; import {EventFormComponent} from './event-form.component'; @Component({ template: ` <md-content class="md-padding" layout="row" layout-wrap layout-align="end start"> <a [routerLink]="['EventForm']"> <button md-raised-button class="md-raised md-primary">Новий захід</button> </a> </md-content> <router-outlet></router-outlet>`, directives: [ROUTER_DIRECTIVES, MATERIAL_DIRECTIVES], providers: [MATERIAL_PROVIDERS] }) @RouteConfig([ {path:'/lessons', name: 'Lessons', component: LessonListComponent, useAsDefault: true}, {path:'/events', name: 'Events', component: EventsListComponent}, {path:'/events/new', name: 'EventForm', component: EventFormComponent}, {path:'/events/:id', name: 'EventDetail', component: EventDetailComponent}, ]) export class ScheduleComponent { }
Add LessonListComponent to route config
Add LessonListComponent to route config
TypeScript
mit
bluebirrrrd/nau-timetable,bluebirrrrd/nau-timetable,bluebirrrrd/nau-timetable,bluebirrrrd/nau-timetable,bluebirrd/nau-timetable,bluebirrd/nau-timetable,bluebirrd/nau-timetable,bluebirrd/nau-timetable
--- +++ @@ -2,6 +2,7 @@ import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'; import {MATERIAL_DIRECTIVES, MATERIAL_PROVIDERS} from 'ng2-material/all'; +import {LessonListComponent} from './lesson-list.component'; import {EventsListComponent} from './events-list.component'; import {EventDetailComponent} from './event-detail.component'; import {EventFormComponent} from './event-form.component'; @@ -19,7 +20,8 @@ }) @RouteConfig([ - {path:'/events', name: 'Events', component: EventsListComponent, useAsDefault: true}, + {path:'/lessons', name: 'Lessons', component: LessonListComponent, useAsDefault: true}, + {path:'/events', name: 'Events', component: EventsListComponent}, {path:'/events/new', name: 'EventForm', component: EventFormComponent}, {path:'/events/:id', name: 'EventDetail', component: EventDetailComponent}, ])
ddf4e20d0e4d4201631fa83f04a9fe1528bf4f44
app/src/ui/toolbar/tab-bar.tsx
app/src/ui/toolbar/tab-bar.tsx
import * as React from 'react' export const enum TabBarTab { Changes = 0, History, } interface ITabBarProps { /** The currently selected tab. */ selectedTab: TabBarTab /** A function which is called when a tab is clicked on. */ onTabClicked: (tab: TabBarTab) => void /** Whether there are uncommitted changes. */ hasChanges: boolean } /** The tab bar component. */ export default class TabBar extends React.Component<ITabBarProps, void> { public render() { return ( <div className='segmented-control'> <TabBarItem title='Changes' selected={this.props.selectedTab === TabBarTab.Changes} onClick={() => this.props.onTabClicked(TabBarTab.Changes)} showIndicator={this.props.hasChanges}/> <TabBarItem title='History' selected={this.props.selectedTab === TabBarTab.History} onClick={() => this.props.onTabClicked(TabBarTab.History)} showIndicator={false}/> </div> ) } } interface ITabBarItemProps { title: string selected: boolean onClick: () => void showIndicator: boolean } function TabBarItem({ title, selected, onClick, showIndicator }: ITabBarItemProps) { const className = selected ? 'selected' : '' return ( <span className={'segmented-control-item ' + className} onClick={onClick}> <span>{title}</span> {showIndicator ? <span className='indicator'/> : null} </span> ) }
import * as React from 'react' export const enum TabBarTab { Changes = 0, History, } interface ITabBarProps { /** The currently selected tab. */ selectedTab: TabBarTab /** A function which is called when a tab is clicked on. */ onTabClicked: (tab: TabBarTab) => void /** Whether there are uncommitted changes. */ hasChanges: boolean } /** The tab bar component. */ export default class TabBar extends React.Component<ITabBarProps, void> { public render() { return ( <div className='segmented-control'> <TabBarItem title='Changes' selected={this.props.selectedTab === TabBarTab.Changes} onClick={() => this.props.onTabClicked(TabBarTab.Changes)}> {this.props.hasChanges ? <span className='indicator'/> : null} </TabBarItem> <TabBarItem title='History' selected={this.props.selectedTab === TabBarTab.History} onClick={() => this.props.onTabClicked(TabBarTab.History)}/> </div> ) } } interface ITabBarItemProps { title: string selected: boolean onClick: () => void children?: JSX.Element[] } function TabBarItem({ title, selected, onClick, children }: ITabBarItemProps) { const className = selected ? 'selected' : '' return ( <span className={'segmented-control-item ' + className} onClick={onClick}> <span>{title}</span> {children} </span> ) }
Move the indicator into children.
Move the indicator into children.
TypeScript
mit
j-f1/forked-desktop,hjobrien/desktop,say25/desktop,gengjiawen/desktop,artivilla/desktop,j-f1/forked-desktop,shiftkey/desktop,desktop/desktop,BugTesterTest/desktops,artivilla/desktop,desktop/desktop,j-f1/forked-desktop,kactus-io/kactus,say25/desktop,artivilla/desktop,j-f1/forked-desktop,artivilla/desktop,say25/desktop,shiftkey/desktop,kactus-io/kactus,BugTesterTest/desktops,hjobrien/desktop,BugTesterTest/desktops,kactus-io/kactus,desktop/desktop,desktop/desktop,hjobrien/desktop,BugTesterTest/desktops,say25/desktop,hjobrien/desktop,shiftkey/desktop,kactus-io/kactus,gengjiawen/desktop,gengjiawen/desktop,shiftkey/desktop,gengjiawen/desktop
--- +++ @@ -23,12 +23,12 @@ <div className='segmented-control'> <TabBarItem title='Changes' selected={this.props.selectedTab === TabBarTab.Changes} - onClick={() => this.props.onTabClicked(TabBarTab.Changes)} - showIndicator={this.props.hasChanges}/> + onClick={() => this.props.onTabClicked(TabBarTab.Changes)}> + {this.props.hasChanges ? <span className='indicator'/> : null} + </TabBarItem> <TabBarItem title='History' selected={this.props.selectedTab === TabBarTab.History} - onClick={() => this.props.onTabClicked(TabBarTab.History)} - showIndicator={false}/> + onClick={() => this.props.onTabClicked(TabBarTab.History)}/> </div> ) } @@ -38,16 +38,16 @@ title: string selected: boolean onClick: () => void - showIndicator: boolean + children?: JSX.Element[] } -function TabBarItem({ title, selected, onClick, showIndicator }: ITabBarItemProps) { +function TabBarItem({ title, selected, onClick, children }: ITabBarItemProps) { const className = selected ? 'selected' : '' return ( <span className={'segmented-control-item ' + className} onClick={onClick}> <span>{title}</span> - {showIndicator ? <span className='indicator'/> : null} + {children} </span> ) }
76b5a24ecb80653e85177fda2215d49e4914bec9
projects/hslayers/src/components/toolbar/public-api.ts
projects/hslayers/src/components/toolbar/public-api.ts
export * from './toolbar.component'; export * from './toolbar.module'; export * from './toolbar-panel-base.component';
export * from './toolbar.component'; export * from './toolbar.module'; export * from './toolbar-panel-base.component'; export * from './toolbar-panel-container.service';
Add toolbar panel container service to exports
fix: Add toolbar panel container service to exports
TypeScript
mit
hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng
--- +++ @@ -1,3 +1,4 @@ export * from './toolbar.component'; export * from './toolbar.module'; export * from './toolbar-panel-base.component'; +export * from './toolbar-panel-container.service';
8c4038f9eca3e6aa6fcd858346bbebd4bf54ba3a
test/utils.ts
test/utils.ts
export function delay (timeout) { return new Promise<void>(resolve => { setTimeout(resolve, timeout) }) } // for some reason editor.action.triggerSuggest needs more delay at the beginning when the process is not yet warmed up // let's start from high delays and then slowly go to lower delays let delaySteps = [2000, 1200, 700, 400, 300, 200] export const getCurrentDelay = () => (delaySteps.length > 1) ? delaySteps.shift() : delaySteps[0]
export function delay (timeout) { return new Promise<void>(resolve => { setTimeout(resolve, timeout) }) } // for some reason editor.action.triggerSuggest needs more delay at the beginning when the process is not yet warmed up // let's start from high delays and then slowly go to lower delays let delaySteps = [2000, 1200, 700, 400, 300, 250] export const getCurrentDelay = () => (delaySteps.length > 1) ? delaySteps.shift() : delaySteps[0]
Change in default test delay
Change in default test delay There is still some randomness in executing the tests. Bigger delays seem to mitigate that problem. I can wait another second or two if that helps.
TypeScript
mit
ipatalas/vscode-postfix-ts,ipatalas/vscode-postfix-ts
--- +++ @@ -6,6 +6,6 @@ // for some reason editor.action.triggerSuggest needs more delay at the beginning when the process is not yet warmed up // let's start from high delays and then slowly go to lower delays -let delaySteps = [2000, 1200, 700, 400, 300, 200] +let delaySteps = [2000, 1200, 700, 400, 300, 250] export const getCurrentDelay = () => (delaySteps.length > 1) ? delaySteps.shift() : delaySteps[0]
2dd78a9836ef88ae4e97274d0b706653c3bea658
lib/commands/prop/prop-command-base.ts
lib/commands/prop/prop-command-base.ts
///<reference path="../../.d.ts"/> "use strict"; export class ProjectPropertyCommandBase { protected projectSchema: any; public $project: Project.IProject; constructor(private $staticConfig: IStaticConfig, private $injector: IInjector) { this.$staticConfig.triggerJsonSchemaValidation = false; this.$project = this.$injector.resolve("project"); if (this.$project.projectData) { this.projectSchema = this.$project.getProjectSchema().wait(); } } public get completionData(): string[] { let parseResult = /prop[ ]+([^ ]+) ([^ ]*)/.exec(process.argv.join(" ")); if (parseResult) { let propName = parseResult[2]; if (this.projectSchema[propName]) { let range = this.projectSchema[propName].range; if (range) { if (!_.isArray(range)) { range = _.map(range, (value:{ input: string }, key:string) => { return value.input || key; }); } return range; } } else { return _.keys(this.projectSchema); } } return null; } }
///<reference path="../../.d.ts"/> "use strict"; export class ProjectPropertyCommandBase { protected projectSchema: any; public $project: Project.IProject; constructor(private $staticConfig: IStaticConfig, private $injector: IInjector) { this.$staticConfig.triggerJsonSchemaValidation = false; this.$project = this.$injector.resolve("project"); if (this.$project.projectData) { this.projectSchema = this.$project.getProjectSchema().wait(); } } public get completionData(): string[] { let parseResult = /prop[ ]+([^ ]+) ([^ ]*)/.exec(process.argv.join(" ")); if (parseResult) { let propName = parseResult[2]; if (this.projectSchema[propName]) { let range = this.projectSchema[propName].range; if (range) { if (!_.isArray(range)) { range = _.map(range, (value:{ input: string }, key:string) => { return value.input || key; }); } return range; } } else { let properties = _.keys(this.projectSchema); return properties.concat(properties.map(k => k.toLowerCase())); } } return null; } }
Allow autocompletion of lowercased properties
Allow autocompletion of lowercased properties In case user is using only lowercased values for properties, autocompletion is not working. For example `appbuilder prop print core` is not autocompleted to coreplugins. In fact the command will work with lowercased values, so enable using them. Add lowercased values to the ones used for autocompletion. With this change the above will work, but scenarios like `appbuilder prop print cOre` will not be autocompleted anyway.
TypeScript
apache-2.0
Icenium/icenium-cli,Icenium/icenium-cli
--- +++ @@ -29,7 +29,8 @@ return range; } } else { - return _.keys(this.projectSchema); + let properties = _.keys(this.projectSchema); + return properties.concat(properties.map(k => k.toLowerCase())); } }
98a31a04ad907976aeba96108c7c844890fcfcd1
lib/msal-core/src/telemetry/UiEvent.ts
lib/msal-core/src/telemetry/UiEvent.ts
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import TelemetryEvent from "./TelemetryEvent"; import { prependEventNamePrefix } from "./TelemetryUtils"; export const EVENT_KEYS = { USER_CANCELLED: prependEventNamePrefix("user_cancelled"), ACCESS_DENIED: prependEventNamePrefix("access_denied") }; export default class UiEvent extends TelemetryEvent { constructor(correlationId: string) { super(prependEventNamePrefix("ui_event"), correlationId); } public set userCancelled(userCancelled: boolean) { this.event[EVENT_KEYS.USER_CANCELLED] = userCancelled; } public set accessDenied(accessDenied: boolean) { this.event[EVENT_KEYS.ACCESS_DENIED] = accessDenied; } }
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import TelemetryEvent from "./TelemetryEvent"; import { prependEventNamePrefix } from "./TelemetryUtils"; export const EVENT_KEYS = { USER_CANCELLED: prependEventNamePrefix("user_cancelled"), ACCESS_DENIED: prependEventNamePrefix("access_denied") }; export default class UiEvent extends TelemetryEvent { constructor(correlationId: string) { super(prependEventNamePrefix("ui_event"), correlationId, "UiEvent"); } public set userCancelled(userCancelled: boolean) { this.event[EVENT_KEYS.USER_CANCELLED] = userCancelled; } public set accessDenied(accessDenied: boolean) { this.event[EVENT_KEYS.ACCESS_DENIED] = accessDenied; } }
Fix uievent to fix typedoc
Fix uievent to fix typedoc
TypeScript
mit
AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js
--- +++ @@ -13,7 +13,7 @@ export default class UiEvent extends TelemetryEvent { constructor(correlationId: string) { - super(prependEventNamePrefix("ui_event"), correlationId); + super(prependEventNamePrefix("ui_event"), correlationId, "UiEvent"); } public set userCancelled(userCancelled: boolean) {
24c6f586ddc359b6fb3af6c63231618cbf3600ad
src/vs/workbench/contrib/comments/browser/comments.contribution.ts
src/vs/workbench/contrib/comments/browser/comments.contribution.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { Registry } from 'vs/platform/registry/common/platform'; import 'vs/workbench/contrib/comments/browser/commentsEditorContribution'; import { ICommentService, CommentService } from 'vs/workbench/contrib/comments/browser/commentService'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; export interface ICommentsConfiguration { openPanel: 'neverOpen' | 'openOnSessionStart' | 'openOnSessionStartWithComments'; } Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({ id: 'comments', order: 20, title: nls.localize('commentsConfigurationTitle', "Comments"), type: 'object', properties: { 'comments.openPanel': { enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'], default: 'openOnSessionStartWithComments', description: nls.localize('openComments', "Controls when the comments panel should open.") } } }); registerSingleton(ICommentService, CommentService);
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as nls from 'vs/nls'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { Registry } from 'vs/platform/registry/common/platform'; import 'vs/workbench/contrib/comments/browser/commentsEditorContribution'; import { ICommentService, CommentService } from 'vs/workbench/contrib/comments/browser/commentService'; import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry'; export interface ICommentsConfiguration { openPanel: 'neverOpen' | 'openOnSessionStart' | 'openOnSessionStartWithComments'; } Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({ id: 'comments', order: 20, title: nls.localize('commentsConfigurationTitle', "Comments"), type: 'object', properties: { 'comments.openPanel': { enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'], default: 'openOnSessionStartWithComments', description: nls.localize('openComments', "Controls when the comments panel should open."), requireTrust: false } } }); registerSingleton(ICommentService, CommentService);
Add requireTrust to comments.openPanel setting
Add requireTrust to comments.openPanel setting
TypeScript
mit
Microsoft/vscode,microsoft/vscode,microsoft/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,Microsoft/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,microsoft/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,eamodio/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,microsoft/vscode,eamodio/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,Microsoft/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,Microsoft/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,microsoft/vscode,Microsoft/vscode,Microsoft/vscode,microsoft/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,Microsoft/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,Microsoft/vscode
--- +++ @@ -23,7 +23,8 @@ 'comments.openPanel': { enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'], default: 'openOnSessionStartWithComments', - description: nls.localize('openComments', "Controls when the comments panel should open.") + description: nls.localize('openComments', "Controls when the comments panel should open."), + requireTrust: false } } });
3e63676cb098ba08b1ba4fc650e0593eeeccc3fb
test/ts/webpack.config.ts
test/ts/webpack.config.ts
const path = require('path'); module.exports = { entry: "./src/spec.ts", output: { path: path.resolve(__dirname, 'build'), filename: 'integration-tests.js' }, devtool: 'inline-source-map', module: { rules: [ { test: /\.js$/, include: /src/, loader: "babel-loader", exclude: /node_modules/ }, { test: /\.ts$/, include: /src/, exclude: /node_modules/, loader: "ts-loader" } ] }, resolve: { extensions: [".ts", ".js"] } };
const path = require('path'); module.exports = { entry: "./src/spec.ts", output: { path: path.resolve(__dirname, 'build'), filename: 'integration-tests.js' }, devtool: 'inline-source-map', module: { rules: [ { test: /\.js$/, include: /src/, loader: "babel-loader", exclude: /node_modules/ }, { test: /\.ts$/, include: [/src/, /_proto/], exclude: /node_modules/, loader: "ts-loader" } ] }, resolve: { extensions: [".ts", ".js"] } };
Fix compilation of TS _proto generated services
Fix compilation of TS _proto generated services
TypeScript
apache-2.0
improbable-eng/grpc-web,MarcusLongmuir/grpc-web,improbable-eng/grpc-web,MarcusLongmuir/grpc-web,MarcusLongmuir/grpc-web,improbable-eng/grpc-web,MarcusLongmuir/grpc-web,improbable-eng/grpc-web,improbable-eng/grpc-web,MarcusLongmuir/grpc-web
--- +++ @@ -16,7 +16,7 @@ }, { test: /\.ts$/, - include: /src/, + include: [/src/, /_proto/], exclude: /node_modules/, loader: "ts-loader" }
e6eec5a029e130d93803196c2edc0b55a220c8f7
src/marketplace-checklist/sidebar-extension.ts
src/marketplace-checklist/sidebar-extension.ts
import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService'; import { getMenuForProject, getMenuForSupport } from './utils'; export default function registerSidebarExtension() { SidebarExtensionService.register('project', getMenuForProject); SidebarExtensionService.register('support', getMenuForSupport); }
import { SidebarExtensionService } from '@waldur/navigation/sidebar/SidebarExtensionService'; import { getMenuForProject, getMenuForSupport } from './utils'; SidebarExtensionService.register('project', getMenuForProject); SidebarExtensionService.register('support', getMenuForSupport);
Fix marketplace checklist sidebar extension registration.
Fix marketplace checklist sidebar extension registration.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -2,7 +2,5 @@ import { getMenuForProject, getMenuForSupport } from './utils'; -export default function registerSidebarExtension() { - SidebarExtensionService.register('project', getMenuForProject); - SidebarExtensionService.register('support', getMenuForSupport); -} +SidebarExtensionService.register('project', getMenuForProject); +SidebarExtensionService.register('support', getMenuForSupport);
691c4a1005dcb0fd06858bd8fdbf86b89fe67229
src/main/ts/ephox/mcagar/api/ThemeSelectors.ts
src/main/ts/ephox/mcagar/api/ThemeSelectors.ts
import { isModern } from "./TinyVersions"; interface ThemeSelectors { toolBarSelector: string; menuBarSelector: string; dialogCloseSelector: string; dialogSubmitSelector: string; } const ModernThemeSelectors: ThemeSelectors = { toolBarSelector:'.mce-toolbar-grp', menuBarSelector: '.mce-menubar', dialogCloseSelector: 'div[role="button"]:contains(Cancel)', dialogSubmitSelector:'div[role="button"].mce-primary' }; const SilverThemeSelectors: ThemeSelectors = { toolBarSelector:'.tox-toolbar', menuBarSelector: '.tox-menubar', dialogCloseSelector: '.tox-button:contains("Cancel")', dialogSubmitSelector: '.tox-button:contains("Ok")' }; const getThemeSelectors = (): ThemeSelectors => { return isModern() ? ModernThemeSelectors : SilverThemeSelectors; } export { getThemeSelectors }
import { isModern } from "./TinyVersions"; interface ThemeSelectors { toolBarSelector: string; menuBarSelector: string; dialogCloseSelector: string; dialogSubmitSelector: string; } const ModernThemeSelectors: ThemeSelectors = { toolBarSelector:'.mce-toolbar-grp', menuBarSelector: '.mce-menubar', dialogCloseSelector: 'div[role="button"]:contains(Cancel)', dialogSubmitSelector:'div[role="button"].mce-primary' }; const SilverThemeSelectors: ThemeSelectors = { toolBarSelector:'.tox-toolbar', menuBarSelector: '.tox-menubar', dialogCloseSelector: '.tox-button:contains("Cancel")', dialogSubmitSelector: '.tox-button:contains("Save")' }; const getThemeSelectors = (): ThemeSelectors => { return isModern() ? ModernThemeSelectors : SilverThemeSelectors; }; export { getThemeSelectors }
Swap to using "Save" instead of "Ok" for dialog confirmation selectors
TINY-2281: Swap to using "Save" instead of "Ok" for dialog confirmation selectors
TypeScript
lgpl-2.1
TeamupCom/tinymce,FernCreek/tinymce,FernCreek/tinymce,tinymce/tinymce,TeamupCom/tinymce,tinymce/tinymce,FernCreek/tinymce,tinymce/tinymce
--- +++ @@ -18,12 +18,12 @@ toolBarSelector:'.tox-toolbar', menuBarSelector: '.tox-menubar', dialogCloseSelector: '.tox-button:contains("Cancel")', - dialogSubmitSelector: '.tox-button:contains("Ok")' + dialogSubmitSelector: '.tox-button:contains("Save")' }; const getThemeSelectors = (): ThemeSelectors => { return isModern() ? ModernThemeSelectors : SilverThemeSelectors; -} +}; export { getThemeSelectors
9bd63f93359492701a6e9e81a418d619397d8d9b
resources/assets/lib/portal.tsx
resources/assets/lib/portal.tsx
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import { ReactNode } from 'react'; import { createPortal } from 'react-dom'; export const Portal = ({children}: { children: ReactNode }) => createPortal(children, document.body);
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import { PureComponent, ReactNode } from 'react'; import { createPortal } from 'react-dom'; interface Props { children: ReactNode; } export class Portal extends PureComponent<Props> { private readonly container: HTMLElement; private readonly uuid: string; constructor(props: Props) { super(props); this.uuid = osu.uuid(); this.container = document.createElement('div'); } addPortal = () => document.body.appendChild(this.container); componentDidMount() { this.addPortal(); $(document).on(`turbolinks:before-cache.${this.uuid}`, () => { this.removePortal(); }); } componentWillUnmount = () => $(document).off(`turbolinks:before-cache.${this.uuid}`); removePortal = () => document.body.removeChild(this.container); render = () => createPortal(this.props.children, this.container); }
Convert Portal to a class component and perform cleanup when navigating
Convert Portal to a class component and perform cleanup when navigating
TypeScript
agpl-3.0
nekodex/osu-web,notbakaneko/osu-web,omkelderman/osu-web,ppy/osu-web,omkelderman/osu-web,LiquidPL/osu-web,nekodex/osu-web,nanaya/osu-web,nanaya/osu-web,LiquidPL/osu-web,nekodex/osu-web,notbakaneko/osu-web,nanaya/osu-web,nanaya/osu-web,ppy/osu-web,LiquidPL/osu-web,notbakaneko/osu-web,nanaya/osu-web,ppy/osu-web,ppy/osu-web,nekodex/osu-web,notbakaneko/osu-web,nekodex/osu-web,omkelderman/osu-web,LiquidPL/osu-web,notbakaneko/osu-web,ppy/osu-web,omkelderman/osu-web,LiquidPL/osu-web
--- +++ @@ -1,7 +1,37 @@ // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. -import { ReactNode } from 'react'; +import { PureComponent, ReactNode } from 'react'; import { createPortal } from 'react-dom'; -export const Portal = ({children}: { children: ReactNode }) => createPortal(children, document.body); +interface Props { + children: ReactNode; +} + +export class Portal extends PureComponent<Props> { + private readonly container: HTMLElement; + private readonly uuid: string; + + constructor(props: Props) { + super(props); + + this.uuid = osu.uuid(); + this.container = document.createElement('div'); + } + + addPortal = () => document.body.appendChild(this.container); + + componentDidMount() { + this.addPortal(); + + $(document).on(`turbolinks:before-cache.${this.uuid}`, () => { + this.removePortal(); + }); + } + + componentWillUnmount = () => $(document).off(`turbolinks:before-cache.${this.uuid}`); + + removePortal = () => document.body.removeChild(this.container); + + render = () => createPortal(this.props.children, this.container); +}
a9b147e148a729e2e5930c655075711ec3c33e22
src/controller/CopyFileNameController.ts
src/controller/CopyFileNameController.ts
import { copy } from 'copy-paste-win32fix'; import * as path from 'path'; import { promisify } from 'util'; import { window } from 'vscode'; import { BaseCopyController } from './BaseCopyController'; const copyAsync = promisify(copy); const GENERIC_ERROR_MESSAGE = 'Could not perform copy file name to clipboard'; export class CopyFileNameController extends BaseCopyController { // Possible errors and their suggested solutions private readonly possibleErrorsMap: { [errorMessage: string]: string} = { 'spawn xclip ENOENT': 'Please install xclip package (`apt-get install xclip`)' }; public async execute(): Promise<void> { const sourcePath = this.sourcePath; if (!sourcePath) { throw new Error(); } const fileName = path.basename(sourcePath); return copyAsync(fileName) .catch((error: Error) => { this.handleError(error.message); }); } private handleError(errorMessage: string): void { // Can happen on unsupported platforms (e.g Linux machine without the xclip package installed). // Attempting to provide a solution according to the error received const errorSolution = this.possibleErrorsMap[errorMessage]; const warningMessageSuffix = errorSolution || errorMessage; window.showWarningMessage(`${GENERIC_ERROR_MESSAGE}: ${warningMessageSuffix}`); } }
import { copy } from 'copy-paste-win32fix'; import * as path from 'path'; import { promisify } from 'util'; import { BaseCopyController } from './BaseCopyController'; const copyAsync = promisify(copy); const GENERIC_ERROR_MESSAGE = 'Could not perform copy file name to clipboard'; export class CopyFileNameController extends BaseCopyController { // Possible errors and their suggested solutions private readonly possibleErrorsMap: { [errorMessage: string]: string} = { 'spawn xclip ENOENT': 'Please install xclip package (`apt-get install xclip`)' }; public async execute(): Promise<void> { const sourcePath = this.sourcePath; if (!sourcePath) { throw new Error(); } const fileName = path.basename(sourcePath); return copyAsync(fileName) .catch((error: Error) => { this.handleError(error.message); }); } private handleError(errorMessage: string): void { // Can happen on unsupported platforms (e.g Linux machine without the xclip package installed). // Attempting to provide a solution according to the error received const errorSolution = this.possibleErrorsMap[errorMessage]; const errorMessageSuffix = errorSolution || errorMessage; throw new Error(`${GENERIC_ERROR_MESSAGE}: ${errorMessageSuffix}`); } }
Throw error to be handled in extention.ts
Throw error to be handled in extention.ts
TypeScript
mit
sleistner/vscode-fileutils,sleistner/vscode-fileutils
--- +++ @@ -1,7 +1,6 @@ import { copy } from 'copy-paste-win32fix'; import * as path from 'path'; import { promisify } from 'util'; -import { window } from 'vscode'; import { BaseCopyController } from './BaseCopyController'; const copyAsync = promisify(copy); @@ -31,8 +30,8 @@ // Can happen on unsupported platforms (e.g Linux machine without the xclip package installed). // Attempting to provide a solution according to the error received const errorSolution = this.possibleErrorsMap[errorMessage]; - const warningMessageSuffix = errorSolution || errorMessage; + const errorMessageSuffix = errorSolution || errorMessage; - window.showWarningMessage(`${GENERIC_ERROR_MESSAGE}: ${warningMessageSuffix}`); + throw new Error(`${GENERIC_ERROR_MESSAGE}: ${errorMessageSuffix}`); } }
5667d5afa8c82c274c3166dbef030887757547a0
src/app/_shared/pipes/duration.pipe.ts
src/app/_shared/pipes/duration.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; import * as moment from 'moment'; @Pipe({ name: 'duration' }) export class DurationPipe implements PipeTransform { transform(value: any, args?: any): any { if (!value) { return; } let format = 'mm:ss'; if (args) { format = 'HH:mm:ss'; } return moment.utc(value).format(format); } }
import { Pipe, PipeTransform } from '@angular/core'; import * as moment from 'moment'; @Pipe({ name: 'duration' }) export class DurationPipe implements PipeTransform { transform(value: any, args?: any): any { if (!value && value !== 0) { return; } let format = 'mm:ss'; if (args) { format = 'HH:mm:ss'; } return moment.utc(value).format(format); } }
Fix when value === 0
Fix when value === 0
TypeScript
mit
radiium/turntable,radiium/turntable,radiium/turntable
--- +++ @@ -5,7 +5,7 @@ export class DurationPipe implements PipeTransform { transform(value: any, args?: any): any { - if (!value) { + if (!value && value !== 0) { return; } let format = 'mm:ss';
19f061f4c8c5caaa57bbb229985b2247f1c83449
app/components/dashboard/server/DashboardApi.ts
app/components/dashboard/server/DashboardApi.ts
class DashboardApi { @Decorators.method static getDashboardPageData(callback?) { var user = ACL.getUserOrThrow(this); var today = new Date(); today.setHours(0, 0, 0); var todayLeaders = Meteor.users.find( { "study.lastDateXP": { $gte: today.getTime() } }, { sort: { "study.lastDateXP": -1 }, limit: 10, fields: { "profile.name": 1, "study.lastDateXP": 1, "services.facebook.id": 1 } }) .fetch() .map(tl => ({ name: tl.profile.name, xp: tl.study.lastDateXP, avatarUrl: "http://graph.facebook.com/" + user.services.facebook.id + "/picture" })); var allTimeLeaders = Meteor.users.find( { }, { sort: { "study.xp": -1 }, limit: 10, fields: { "profile.name": 1, "study.xp": 1, "services.facebook.id": 1 } }) .fetch() .map(tl => ({ name: tl.profile.name, xp: tl.study.xp, avatarUrl: "http://graph.facebook.com/" + user.services.facebook.id + "/picture" })); return { course: Courses.findOne(user.selectedCourseId), todayLeaders: todayLeaders, allTimeLeaders: allTimeLeaders }; } } this.DashboardApi = DashboardApi;
class DashboardApi { @Decorators.method static getDashboardPageData(callback?) { var user = ACL.getUserOrThrow(this); var today = new Date(); today.setHours(0, 0, 0); var todayLeaders = Meteor.users.find( { "study.lastDateXP": { $gte: today.getTime() } }, { sort: { "study.lastDateXP": -1 }, limit: 10, fields: { "profile.name": 1, "study.lastDateXP": 1, "services.facebook.id": 1 } }) .fetch() .map(tl => ({ name: tl.profile.name, xp: tl.study.lastDateXP, avatarUrl: "http://graph.facebook.com/" + tl.services.facebook.id + "/picture" })); var allTimeLeaders = Meteor.users.find( { }, { sort: { "study.xp": -1 }, limit: 10, fields: { "profile.name": 1, "study.xp": 1, "services.facebook.id": 1 } }) .fetch() .map(tl => ({ name: tl.profile.name, xp: tl.study.xp, avatarUrl: "http://graph.facebook.com/" + tl.services.facebook.id + "/picture" })); return { course: Courses.findOne(user.selectedCourseId), todayLeaders: todayLeaders, allTimeLeaders: allTimeLeaders }; } } this.DashboardApi = DashboardApi;
Fix problem with avatars on Leaderboard
Fix problem with avatars on Leaderboard
TypeScript
mit
andrei-markeev/finnlingo,andrei-markeev/finnlingo,andrei-markeev/finnlingo
--- +++ @@ -11,7 +11,7 @@ .map(tl => ({ name: tl.profile.name, xp: tl.study.lastDateXP, - avatarUrl: "http://graph.facebook.com/" + user.services.facebook.id + "/picture" + avatarUrl: "http://graph.facebook.com/" + tl.services.facebook.id + "/picture" })); var allTimeLeaders = Meteor.users.find( { }, @@ -20,7 +20,7 @@ .map(tl => ({ name: tl.profile.name, xp: tl.study.xp, - avatarUrl: "http://graph.facebook.com/" + user.services.facebook.id + "/picture" + avatarUrl: "http://graph.facebook.com/" + tl.services.facebook.id + "/picture" })); return { course: Courses.findOne(user.selectedCourseId),
bfd0a8931c094cb11d96fb90ef3d8e139f388a26
src/lib/statistics.ts
src/lib/statistics.ts
const _ss = require('simple-statistics'); import { Person } from './models'; const FENCE_FACTOR = 1.5; const QUARTILES = [0.25, 0.5, 0.75]; export class Statistics { static calculateBoxPlotData(sample: number[]): number[] { let [lowerQuartile, median, upperQuartile] = QUARTILES.map(p => _ss.quantileSorted(sample, p)); let interQuartileRange = upperQuartile - lowerQuartile; let lowerInnerFence = Math.round(lowerQuartile - (interQuartileRange * FENCE_FACTOR)); let upperInnerFence = Math.round(upperQuartile + (interQuartileRange * FENCE_FACTOR)); return [lowerInnerFence, lowerQuartile, median, upperQuartile, upperInnerFence]; } static identifyOutliers(people: Person[], boxPlotData: number[][], cohorts: string[]): number[][] { let outliers = []; for (let { salary, cohort, name } of people) { let index = cohorts.indexOf(cohort); let [lowerBound, , , , upperBound] = boxPlotData[index]; if (salary < lowerBound || salary > upperBound) { outliers.push({ x: index, y: salary, name }); } } return outliers; } }
const _ss = require('simple-statistics'); import { Person } from './models'; const FENCE_FACTOR = 1.5; const QUARTILES = [0.25, 0.5, 0.75]; export class Statistics { static calculateBoxPlotData(sample: number[]): number[] { let [lowerQuartile, median, upperQuartile] = QUARTILES.map(p => _ss.quantileSorted(sample, p)); let interQuartileRange = upperQuartile - lowerQuartile; let lowerInnerFence = Math.round(lowerQuartile - (interQuartileRange * FENCE_FACTOR)); let upperInnerFence = Math.round(upperQuartile + (interQuartileRange * FENCE_FACTOR)); return [lowerInnerFence, lowerQuartile, median, upperQuartile, upperInnerFence]; } static identifyOutliers(people: Person[], boxPlotData: number[][], cohorts: string[]): any[] { return people .filter(({ salary, cohort }) => { let index = cohorts.indexOf(cohort); let [lowerBound, , , , upperBound] = boxPlotData[index]; return salary < lowerBound || salary > upperBound; }) .map(({ salary, cohort, name }) => ({ x: cohorts.indexOf(cohort), y: salary, name })); } }
Refactor identifyOutliers to functional style.
Refactor identifyOutliers to functional style.
TypeScript
isc
textbook/salary-stats,beatrichartz/salary-stats,textbook/salary-stats,beatrichartz/salary-stats,textbook/salary-stats,textbook/salary-stats,beatrichartz/salary-stats
--- +++ @@ -16,18 +16,13 @@ return [lowerInnerFence, lowerQuartile, median, upperQuartile, upperInnerFence]; } - static identifyOutliers(people: Person[], boxPlotData: number[][], cohorts: string[]): number[][] { - let outliers = []; - - for (let { salary, cohort, name } of people) { - let index = cohorts.indexOf(cohort); - let [lowerBound, , , , upperBound] = boxPlotData[index]; - - if (salary < lowerBound || salary > upperBound) { - outliers.push({ x: index, y: salary, name }); - } - } - - return outliers; + static identifyOutliers(people: Person[], boxPlotData: number[][], cohorts: string[]): any[] { + return people + .filter(({ salary, cohort }) => { + let index = cohorts.indexOf(cohort); + let [lowerBound, , , , upperBound] = boxPlotData[index]; + return salary < lowerBound || salary > upperBound; + }) + .map(({ salary, cohort, name }) => ({ x: cohorts.indexOf(cohort), y: salary, name })); } }
5d5601c99fa7f198b7fe6ccd4e2f46541bbc850b
src/client/web/components/Title.tsx
src/client/web/components/Title.tsx
import * as React from 'react' interface TitleProps { text: string filterText: string onFilterTextClick(): void } const titleStyle: React.CSSProperties = { padding: '0 0 0.5em', font: '1.2em sans-serif', flex: 0, } const anchorStyle: React.CSSProperties = { textDecoration: 'underline', float: 'right', } const Title = (props: TitleProps) => ( <div style={titleStyle}> {props.text} <a style={anchorStyle} onClick={props.onFilterTextClick}> {props.filterText} </a> </div> ) export default Title
import * as React from 'react' interface TitleProps { text: string filterText: string onFilterTextClick(): void } const titleStyle: React.CSSProperties = { padding: '0 0 0.5em', font: '1.2em sans-serif', flex: 0, } const anchorStyle: React.CSSProperties = { textDecoration: 'underline', float: 'right', cursor: 'pointer', } const Title = (props: TitleProps) => ( <div style={titleStyle}> {props.text} <a style={anchorStyle} onClick={props.onFilterTextClick} role="button" > {props.filterText} </a> </div> ) export default Title
Make filter button a bit more obvious
Make filter button a bit more obvious Signed-off-by: Andy Shu <d9a5ae79e0620530e640970c782273ccd89702f2@gmail.com>
TypeScript
agpl-3.0
wikimigrate/wikimigrate,wikimigrate/wikimigrate,wikimigrate/wikimigrate,wikimigrate/wikimigrate
--- +++ @@ -15,12 +15,17 @@ const anchorStyle: React.CSSProperties = { textDecoration: 'underline', float: 'right', + cursor: 'pointer', } const Title = (props: TitleProps) => ( <div style={titleStyle}> {props.text} - <a style={anchorStyle} onClick={props.onFilterTextClick}> + <a + style={anchorStyle} + onClick={props.onFilterTextClick} + role="button" + > {props.filterText} </a> </div>
6f944614d0292357da7a7909832a18ebdaf31554
src/extension/flutter/flutter_types.ts
src/extension/flutter/flutter_types.ts
export interface Device { id: string; name: string; platform: string; emulator: boolean; } export interface DaemonConnected { version: string; pid: number; } export interface AppStart extends AppEvent { deviceId: string; directory: string; supportsRestart?: boolean; } export interface AppEvent { appId: string; } export interface AppDebugPort extends AppEvent { wsUri: string; baseUri?: string; } export interface AppProgress extends AppEvent { message?: string; finished?: boolean; id: number; progressId: string; } export interface DaemonLogMessage { level: "info" | "warning" | "error"; message: string; stackTrace?: string; } export interface AppLog { error: boolean; log: string; } export interface DaemonLog { error: boolean; log: string; } export interface ShowMessage { level: "info" | "warning" | "error"; title: string; message: string; }
export type PlatformType = "android" | "ios" | "linux" | "macos" | "fuchsia" | "windows" | "web" | string; export type Category = "mobile" | "web" | "desktop" | string; export interface Device { category: Category | undefined | null; emulator: boolean; ephemeral: boolean | undefined; id: string; name: string; platform: string; platformType: PlatformType | undefined | null; type: "device"; } export interface Emulator { id: string; name: string; category: Category | undefined | null; platformType: PlatformType | undefined | null; type: "emulator"; } export interface EmulatorCreator { type: "emulator-creator"; } export interface DaemonConnected { version: string; pid: number; } export interface AppStart extends AppEvent { deviceId: string; directory: string; supportsRestart?: boolean; } export interface AppEvent { appId: string; } export interface AppDebugPort extends AppEvent { wsUri: string; baseUri?: string; } export interface AppProgress extends AppEvent { message?: string; finished?: boolean; id: number; progressId: string; } export interface DaemonLogMessage { level: "info" | "warning" | "error"; message: string; stackTrace?: string; } export interface AppLog { error: boolean; log: string; } export interface DaemonLog { error: boolean; log: string; } export interface ShowMessage { level: "info" | "warning" | "error"; title: string; message: string; } export interface SupportedPlatformsResponse { platforms: PlatformType[]; }
Add new types for Flutter platform checks
Add new types for Flutter platform checks
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -1,8 +1,27 @@ +export type PlatformType = "android" | "ios" | "linux" | "macos" | "fuchsia" | "windows" | "web" | string; +export type Category = "mobile" | "web" | "desktop" | string; + export interface Device { + category: Category | undefined | null; + emulator: boolean; + ephemeral: boolean | undefined; id: string; name: string; platform: string; - emulator: boolean; + platformType: PlatformType | undefined | null; + type: "device"; +} + +export interface Emulator { + id: string; + name: string; + category: Category | undefined | null; + platformType: PlatformType | undefined | null; + type: "emulator"; +} + +export interface EmulatorCreator { + type: "emulator-creator"; } export interface DaemonConnected { @@ -53,3 +72,7 @@ title: string; message: string; } + +export interface SupportedPlatformsResponse { + platforms: PlatformType[]; +}
afba8988e26fc6978687ee915d218162b105eef7
spec/laws/must.spec.ts
spec/laws/must.spec.ts
///<reference path="../../typings/main.d.ts" /> import expect = require('expect.js'); import { MustLaw } from 'courtroom/courtroom/laws/must'; describe('MustLaw', () => { describe('constructor', () => { it('should have correct name', () => { let mustFunction = function func () { return false; }; let law = new MustLaw(mustFunction); expect(law.getName()).to.be('must'); }); }); describe('verdict', () => { it('should call into function', () => { let functionCalled = false; let mustFunction = function func () { functionCalled = true; return false; }; let law = new MustLaw(mustFunction); law.verdict('a'); expect(functionCalled).to.be(true); }); }); });
///<reference path="../../typings/main.d.ts" /> import expect = require('expect.js'); import { MustLaw } from 'courtroom/courtroom/laws/must'; describe('MustLaw', () => { describe('constructor', () => { it('should have correct name', () => { let mustFunction = function func () { return false; }; let law = new MustLaw(mustFunction); expect(law.getName()).to.be('must'); }); }); describe('verdict', () => { it('should call into function', () => { let functionCalled = false; let mustFunction = function func () { functionCalled = true; return false; }; let law = new MustLaw(mustFunction); law.verdict('a'); expect(functionCalled).to.be(true); }); it('should call into function with given string [test case 1]', () => { let givenString = 'i am a string'; let functionCalled = false; let mustFunction = function func (str: string) { if (str === givenString) { functionCalled = true; } return false; }; let law = new MustLaw(mustFunction); law.verdict(givenString); expect(functionCalled).to.be(true); }); }); });
Test case 1 for string value
Test case 1 for string value
TypeScript
mit
Jameskmonger/courtroom,Jameskmonger/courtroom
--- +++ @@ -33,6 +33,24 @@ expect(functionCalled).to.be(true); }); + it('should call into function with given string [test case 1]', () => { + let givenString = 'i am a string'; + + let functionCalled = false; + let mustFunction = function func (str: string) { + if (str === givenString) { + functionCalled = true; + } + + return false; + }; + + let law = new MustLaw(mustFunction); + law.verdict(givenString); + + expect(functionCalled).to.be(true); + }); + }); });
f8435966e1f2e906a57764930eb70a8075d7ecc2
example/app/main.ts
example/app/main.ts
import {bootstrap} from '@angular/platform-browser-dynamic'; import {LocationStrategy, HashLocationStrategy} from '@angular/common'; import {APP_ROUTER_PROVIDERS} from './app.routes'; import {AppComponent} from './app.component'; bootstrap(AppComponent, [ APP_ROUTER_PROVIDERS, //{ provide: LocationStrategy, useClass: HashLocationStrategy } ]).catch(err => console.error(err));
import {enableProdMode} from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import {LocationStrategy, HashLocationStrategy} from '@angular/common'; import {APP_ROUTER_PROVIDERS} from './app.routes'; import {AppComponent} from './app.component'; //enableProdMode(); bootstrap(AppComponent, [ APP_ROUTER_PROVIDERS, //{ provide: LocationStrategy, useClass: HashLocationStrategy } ]).catch(err => console.error(err));
Prepare running example app in production mode
Prepare running example app in production mode
TypeScript
mit
zamboney/ng2-page-scroll,Nolanus/ng2-page-scroll,Nolanus/ng2-page-scroll,Nolanus/ng2-page-scroll,zamboney/ng2-page-scroll
--- +++ @@ -1,3 +1,4 @@ +import {enableProdMode} from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import {LocationStrategy, HashLocationStrategy} from '@angular/common'; @@ -5,6 +6,7 @@ import {AppComponent} from './app.component'; +//enableProdMode(); bootstrap(AppComponent, [ APP_ROUTER_PROVIDERS, //{ provide: LocationStrategy, useClass: HashLocationStrategy }
f87dafb7fe5cd9f88428a5af9835c4bf024a438f
src/app/js/ui-event.ts
src/app/js/ui-event.ts
class UiEvent { private addFeedButton = document.querySelector("#add-feed-button"); private pinButton = document.querySelector("#pin-button"); constructor(){ this.addFeedButton.addEventListener("click", e => ModalManager.displayModal("#add-feed-modal")); // Pin button this.pinButton.addEventListener("click", e => { const body = document.querySelector("body"); const classToCheck = "pinned"; if(body.classList.contains(classToCheck)) { body.classList.remove(classToCheck); } else { body.classList.add(classToCheck); } }); } }
class UiEvent { private body = document.querySelector("body"); private addFeedButton = document.querySelector("#add-feed-button"); private pinButton = document.querySelector("#pin-button"); constructor() { this.addFeedButton.addEventListener("click", e => ModalManager.displayModal("#add-feed-modal")); this.pinButton.addEventListener("click", e => this.body.classList.toggle("pinned")); } }
Replace class cheking by toggle function
Replace class cheking by toggle function
TypeScript
mit
Xstoudi/alduin,Xstoudi/alduin,Xstoudi/alduin
--- +++ @@ -1,19 +1,13 @@ class UiEvent { + private body = document.querySelector("body"); + private addFeedButton = document.querySelector("#add-feed-button"); private pinButton = document.querySelector("#pin-button"); - constructor(){ + constructor() { this.addFeedButton.addEventListener("click", e => ModalManager.displayModal("#add-feed-modal")); - // Pin button - this.pinButton.addEventListener("click", e => { - const body = document.querySelector("body"); - const classToCheck = "pinned"; - if(body.classList.contains(classToCheck)) { - body.classList.remove(classToCheck); - } else { - body.classList.add(classToCheck); - } - }); + this.pinButton.addEventListener("click", e => this.body.classList.toggle("pinned")); + } }
bfba3e732f499b36c15f4bb9686a92f0ac3c9e5f
html/ts/generated.d.ts
html/ts/generated.d.ts
// Stuff that Shake generates and injects in // The version of Shake declare const version: string; ///////////////////////////////////////////////////////////////////// // PROFILE DATA declare const profile: Profile2[]; declare type timestamp = int interface Trace { command: string; start: seconds; stop: seconds; } interface Profile { name: string; // Name of the thing I built execution: seconds; // Seconds I took to execute built: timestamp; // Timestamp at which I was built changed: timestamp; // Timestamp at which I last changed depends: int[]; // Which 0-based indexes I depended on (always lower than my index) traces?: Trace[]; // List of traces } type Trace2 = [string ,seconds ,seconds ] type Profile2 = [string ,seconds ,timestamp ,timestamp ,int[] ,Trace2[] ] ///////////////////////////////////////////////////////////////////// // PROGRESS DATA declare const progress: { name: String, values: Progress[] }[]; interface Progress { idealSecs: number; idealPerc: number; actualSecs: number; actualPerc: number; }
// Stuff that Shake generates and injects in // The version of Shake declare const version: string; ///////////////////////////////////////////////////////////////////// // PROFILE DATA // var rather than const, because we override it when testing declare var profile: Profile2[]; declare type timestamp = int interface Trace { command: string; start: seconds; stop: seconds; } interface Profile { name: string; // Name of the thing I built execution: seconds; // Seconds I took to execute built: timestamp; // Timestamp at which I was built changed: timestamp; // Timestamp at which I last changed depends: int[]; // Which 0-based indexes I depended on (always lower than my index) traces?: Trace[]; // List of traces } type Trace2 = [string ,seconds ,seconds ] type Profile2 = [string ,seconds ,timestamp ,timestamp ,int[] ,Trace2[] ] ///////////////////////////////////////////////////////////////////// // PROGRESS DATA declare const progress: { name: String, values: Progress[] }[]; interface Progress { idealSecs: number; idealPerc: number; actualSecs: number; actualPerc: number; }
Make the profile mutable, to faciliate testing
Make the profile mutable, to faciliate testing
TypeScript
bsd-3-clause
ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake,ndmitchell/shake
--- +++ @@ -6,7 +6,8 @@ ///////////////////////////////////////////////////////////////////// // PROFILE DATA -declare const profile: Profile2[]; +// var rather than const, because we override it when testing +declare var profile: Profile2[]; declare type timestamp = int
9f19407e3cad98126c8ae15aa1ddc45a26770ff4
addons/docs/src/blocks/index.ts
addons/docs/src/blocks/index.ts
export { ColorPalette, ColorItem, IconGallery, IconItem, Typeset } from '@storybook/components'; export * from './Anchor'; export * from './ArgsTable'; export * from './Canvas'; export * from './Description'; export * from './DocsContext'; export * from './DocsPage'; export * from './DocsContainer'; export * from './DocsStory'; export * from './Heading'; export * from './Meta'; export * from './Preview'; export * from './Primary'; export * from './Props'; export * from './Source'; export * from './Stories'; export * from './Story'; export * from './Subheading'; export * from './Subtitle'; export * from './Title'; export * from './Wrapper'; export * from './types'; export * from './mdx';
export { ColorPalette, ColorItem, IconGallery, IconItem, Typeset } from '@storybook/components'; export * from './Anchor'; export * from './ArgsTable'; export * from './Canvas'; export * from './Description'; export * from './DocsContext'; export * from './DocsPage'; export * from './DocsContainer'; export * from './DocsStory'; export * from './Heading'; export * from './Meta'; export * from './Preview'; export * from './Primary'; export * from './Props'; export * from './Source'; export * from './SourceContainer'; export * from './Stories'; export * from './Story'; export * from './Subheading'; export * from './Subtitle'; export * from './Title'; export * from './Wrapper'; export * from './types'; export * from './mdx';
Make source code accessible from outside
Make source code accessible from outside
TypeScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook
--- +++ @@ -14,6 +14,7 @@ export * from './Primary'; export * from './Props'; export * from './Source'; +export * from './SourceContainer'; export * from './Stories'; export * from './Story'; export * from './Subheading';
4525a4038885d6e54323b941e58571455e14a79a
app/src/ui/window/full-screen-info.tsx
app/src/ui/window/full-screen-info.tsx
import * as React from 'react' export class FullScreenInfo extends React.Component<any, any> { public render () { return ( <div className='toast-notification-container'> <div className='toast-notification'> Press <kbd className='kbd'>Esc</kbd> to exit fullscreen </div> </div> ) } }
import * as React from 'react' interface IFullScreenInfoState { readonly renderInfo: boolean } // const holdDuration = 750 export class FullScreenInfo extends React.Component<any, IFullScreenInfoState> { // private infoDisappearTimeoutId: number | null = null public constructor() { super() this.state = { renderInfo: false, } } public render () { if (!this.state.renderInfo) { return null } return ( <div className='toast-notification-container'> <div className='toast-notification'> Press <kbd className='kbd'>Esc</kbd> to exit fullscreen </div> </div> ) } }
Add some basic rendering states
Add some basic rendering states
TypeScript
mit
j-f1/forked-desktop,desktop/desktop,desktop/desktop,kactus-io/kactus,say25/desktop,say25/desktop,desktop/desktop,hjobrien/desktop,kactus-io/kactus,artivilla/desktop,kactus-io/kactus,shiftkey/desktop,say25/desktop,artivilla/desktop,j-f1/forked-desktop,gengjiawen/desktop,hjobrien/desktop,gengjiawen/desktop,hjobrien/desktop,gengjiawen/desktop,j-f1/forked-desktop,gengjiawen/desktop,say25/desktop,shiftkey/desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,artivilla/desktop,desktop/desktop,shiftkey/desktop,hjobrien/desktop
--- +++ @@ -1,7 +1,28 @@ import * as React from 'react' -export class FullScreenInfo extends React.Component<any, any> { +interface IFullScreenInfoState { + readonly renderInfo: boolean +} + +// const holdDuration = 750 + +export class FullScreenInfo extends React.Component<any, IFullScreenInfoState> { + + // private infoDisappearTimeoutId: number | null = null + + public constructor() { + super() + + this.state = { + renderInfo: false, + } + } + public render () { + if (!this.state.renderInfo) { + return null + } + return ( <div className='toast-notification-container'> <div className='toast-notification'>
ce12268c798f375cde1fe3d4c7cdfa913f108b92
resources/assets/lib/user-multiplayer-index.tsx
resources/assets/lib/user-multiplayer-index.tsx
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import UserJsonExtended from 'interfaces/user-json-extended'; import UserMultiplayerHistoryJson from 'interfaces/user-multiplayer-history-json'; import core from 'osu-core-singleton'; import * as React from 'react'; import UserMultiplayerHistoryContext, { makeStore, updateStore } from 'user-multiplayer-history-context'; import Main from 'user-multiplayer-index/main'; core.reactTurbolinks.register('user-multiplayer-index', true, () => { const jsonUser = osu.parseJson<UserJsonExtended>('json-user'); const json = osu.parseJson<UserMultiplayerHistoryJson>('json-user-multiplayer-index'); const store = makeStore(); updateStore(store, json); return ( <UserMultiplayerHistoryContext.Provider value={store}> <Main user={jsonUser} /> </UserMultiplayerHistoryContext.Provider> ); });
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. // See the LICENCE file in the repository root for full licence text. import UserJsonExtended from 'interfaces/user-json-extended'; import UserMultiplayerHistoryJson from 'interfaces/user-multiplayer-history-json'; import core from 'osu-core-singleton'; import * as React from 'react'; import UserMultiplayerHistoryContext, { makeStore, updateStore } from 'user-multiplayer-history-context'; import Main from 'user-multiplayer-index/main'; core.reactTurbolinks.register('user-multiplayer-index', () => { const jsonUser = osu.parseJson<UserJsonExtended>('json-user'); const json = osu.parseJson<UserMultiplayerHistoryJson>('json-user-multiplayer-index'); const store = makeStore(); updateStore(store, json); return ( <UserMultiplayerHistoryContext.Provider value={store}> <Main user={jsonUser} /> </UserMultiplayerHistoryContext.Provider> ); });
Adjust function call for new component
Adjust function call for new component
TypeScript
agpl-3.0
LiquidPL/osu-web,notbakaneko/osu-web,ppy/osu-web,notbakaneko/osu-web,nanaya/osu-web,LiquidPL/osu-web,LiquidPL/osu-web,nanaya/osu-web,LiquidPL/osu-web,nanaya/osu-web,notbakaneko/osu-web,ppy/osu-web,nanaya/osu-web,notbakaneko/osu-web,nanaya/osu-web,LiquidPL/osu-web,ppy/osu-web,ppy/osu-web,notbakaneko/osu-web,ppy/osu-web
--- +++ @@ -8,7 +8,7 @@ import UserMultiplayerHistoryContext, { makeStore, updateStore } from 'user-multiplayer-history-context'; import Main from 'user-multiplayer-index/main'; -core.reactTurbolinks.register('user-multiplayer-index', true, () => { +core.reactTurbolinks.register('user-multiplayer-index', () => { const jsonUser = osu.parseJson<UserJsonExtended>('json-user'); const json = osu.parseJson<UserMultiplayerHistoryJson>('json-user-multiplayer-index'); const store = makeStore();
a62c0a3d177d63e2d56205e69b58c3dea3f686ee
src/ts/view/counter.ts
src/ts/view/counter.ts
namespace YJMCNT { /** * CounterView */ export class CounterView extends Core.View { counter:Counter; constructor() { super(); this.counter = new Counter(); this.counter.addObserver(this); } render() { var counter = $("<div>"); var countView = $("<span>"); countView.addClass("count"); countView.html( "count: "+this.counter.show().toString() ); var manipulate = $("<div>"); manipulate.addClass("manipulate"); var countUpButton = $("<button>"); countUpButton.html("Up"); countUpButton.addClass("countUp"); countUpButton.appendTo(manipulate); var countDownButton = $("<button>"); countDownButton.html("Down"); countDownButton.addClass("countDown"); countDownButton.appendTo(manipulate); counter.append(countView); counter.append(manipulate); return counter; } update() { this.notifyObservers(); } } }
namespace YJMCNT { /** * CounterView */ export class CounterView extends Core.View { counter:Counter; constructor() { super(); this.counter = new Counter(); this.counter.addObserver(this); } render() { var counter = $("<div>"); var countView = $("<span>"); countView.addClass("count"); countView.html( "count: "+this.counter.show().toString() ); var manipulate = $("<div>"); manipulate.addClass("manipulate"); var countUpButton = $("<button>"); countUpButton.html("Up"); countUpButton.addClass("countUp"); countUpButton.appendTo(manipulate); var countDownButton = $("<button>"); countDownButton.html("Down"); countDownButton.addClass("countDown"); countDownButton.appendTo(manipulate); var countResetButton = $("<button>"); countResetButton.html("Reset"); countResetButton.addClass("countReset"); countResetButton.appendTo(manipulate); counter.append(countView); counter.append(manipulate); return counter; } update() { this.notifyObservers(); } } }
Add count reset button (not work)
Add count reset button (not work)
TypeScript
mit
yajamon/chrome-ext-counter,yajamon/chrome-ext-counter,yajamon/chrome-ext-counter
--- +++ @@ -29,6 +29,11 @@ countDownButton.addClass("countDown"); countDownButton.appendTo(manipulate); + var countResetButton = $("<button>"); + countResetButton.html("Reset"); + countResetButton.addClass("countReset"); + countResetButton.appendTo(manipulate); + counter.append(countView); counter.append(manipulate); return counter;
511ba13c3d644552620c32f74a6815199886ea26
src/utils/network.ts
src/utils/network.ts
async function getOKResponse(url: string, mimeType?: string) { const response = await fetch( url, { cache: 'force-cache', credentials: 'omit', }, ); if (mimeType && !response.headers.get('Content-Type').startsWith(mimeType)) { throw new Error(`Mime type mismatch when loading ${url}`); } if (!response.ok) { throw new Error(`Unable to load ${url} ${response.status} ${response.statusText}`); } return response; } export async function loadAsDataURL(url: string, mimeType?: string) { const response = await getOKResponse(url, mimeType); return await readResponseAsDataURL(response); } export async function readResponseAsDataURL(response: Response) { const blob = await response.blob(); const dataURL = await (new Promise<string>((resolve) => { const reader = new FileReader(); reader.onloadend = () => resolve(reader.result as string); reader.readAsDataURL(blob); })); return dataURL; } export async function loadAsText(url: string, mimeType?: string) { const response = await getOKResponse(url, mimeType); return await response.text(); }
import {isFirefox} from './platform'; async function getOKResponse(url: string, mimeType?: string) { const response = await fetch( url, { cache: 'force-cache', credentials: 'omit', }, ); // Firefox bug, content type is "application/x-unknown-content-type" if (isFirefox() && mimeType === 'text/css' && url.startsWith('moz-extension://') && url.endsWith('.css')) { return response; } if (mimeType && !response.headers.get('Content-Type').startsWith(mimeType)) { throw new Error(`Mime type mismatch when loading ${url}`); } if (!response.ok) { throw new Error(`Unable to load ${url} ${response.status} ${response.statusText}`); } return response; } export async function loadAsDataURL(url: string, mimeType?: string) { const response = await getOKResponse(url, mimeType); return await readResponseAsDataURL(response); } export async function readResponseAsDataURL(response: Response) { const blob = await response.blob(); const dataURL = await (new Promise<string>((resolve) => { const reader = new FileReader(); reader.onloadend = () => resolve(reader.result as string); reader.readAsDataURL(blob); })); return dataURL; } export async function loadAsText(url: string, mimeType?: string) { const response = await getOKResponse(url, mimeType); return await response.text(); }
Patch for wrong Firefox add-ons CSS MIME type
Patch for wrong Firefox add-ons CSS MIME type
TypeScript
mit
darkreader/darkreader,alexanderby/darkreader,darkreader/darkreader,alexanderby/darkreader,darkreader/darkreader,alexanderby/darkreader
--- +++ @@ -1,3 +1,5 @@ +import {isFirefox} from './platform'; + async function getOKResponse(url: string, mimeType?: string) { const response = await fetch( url, @@ -6,6 +8,11 @@ credentials: 'omit', }, ); + + // Firefox bug, content type is "application/x-unknown-content-type" + if (isFirefox() && mimeType === 'text/css' && url.startsWith('moz-extension://') && url.endsWith('.css')) { + return response; + } if (mimeType && !response.headers.get('Content-Type').startsWith(mimeType)) { throw new Error(`Mime type mismatch when loading ${url}`);
fe9d73eb5bc08e752793f143c31c713c93ef85d0
tests/cases/fourslash/server/openFile.ts
tests/cases/fourslash/server/openFile.ts
/// <reference path="../fourslash.ts"/> // @Filename: test1.ts ////t. // @Filename: test.ts ////var t = '10'; // @Filename: tsconfig.json ////{ "files": ["test.ts", "test1.ts"] } var overridingContent = "var t = 10; t."; debugger; goTo.file("test.ts", overridingContent); goTo.file("test1.ts"); goTo.eof(); verify.completionListContains("toExponential");
/// <reference path="../fourslash.ts"/> // @Filename: test1.ts ////t. // @Filename: test.ts ////var t = '10'; // @Filename: tsconfig.json ////{ "files": ["test.ts", "test1.ts"] } var overridingContent = "var t = 10; t."; goTo.file("test.ts", overridingContent); goTo.file("test1.ts"); goTo.eof(); verify.completionListContains("toExponential");
Remove debugger statement from test
Remove debugger statement from test
TypeScript
apache-2.0
RyanCavanaugh/TypeScript,DLehenbauer/TypeScript,donaldpipowitch/TypeScript,jeremyepling/TypeScript,plantain-00/TypeScript,samuelhorwitz/typescript,weswigham/TypeScript,kimamula/TypeScript,ionux/TypeScript,synaptek/TypeScript,synaptek/TypeScript,erikmcc/TypeScript,kimamula/TypeScript,fabioparra/TypeScript,thr0w/Thr0wScript,RyanCavanaugh/TypeScript,nojvek/TypeScript,AbubakerB/TypeScript,TukekeSoft/TypeScript,ionux/TypeScript,basarat/TypeScript,mmoskal/TypeScript,AbubakerB/TypeScript,mihailik/TypeScript,kitsonk/TypeScript,nycdotnet/TypeScript,donaldpipowitch/TypeScript,evgrud/TypeScript,samuelhorwitz/typescript,DLehenbauer/TypeScript,ziacik/TypeScript,blakeembrey/TypeScript,erikmcc/TypeScript,evgrud/TypeScript,kimamula/TypeScript,microsoft/TypeScript,vilic/TypeScript,kpreisser/TypeScript,blakeembrey/TypeScript,ziacik/TypeScript,blakeembrey/TypeScript,plantain-00/TypeScript,microsoft/TypeScript,weswigham/TypeScript,Eyas/TypeScript,mihailik/TypeScript,Microsoft/TypeScript,jwbay/TypeScript,nycdotnet/TypeScript,SaschaNaz/TypeScript,kitsonk/TypeScript,basarat/TypeScript,jeremyepling/TypeScript,chuckjaz/TypeScript,donaldpipowitch/TypeScript,plantain-00/TypeScript,Microsoft/TypeScript,yortus/TypeScript,ionux/TypeScript,blakeembrey/TypeScript,alexeagle/TypeScript,mihailik/TypeScript,weswigham/TypeScript,Eyas/TypeScript,Microsoft/TypeScript,chuckjaz/TypeScript,SaschaNaz/TypeScript,thr0w/Thr0wScript,basarat/TypeScript,nojvek/TypeScript,DLehenbauer/TypeScript,AbubakerB/TypeScript,evgrud/TypeScript,kimamula/TypeScript,jwbay/TypeScript,nycdotnet/TypeScript,yortus/TypeScript,thr0w/Thr0wScript,fabioparra/TypeScript,vilic/TypeScript,nojvek/TypeScript,DLehenbauer/TypeScript,TukekeSoft/TypeScript,donaldpipowitch/TypeScript,basarat/TypeScript,kpreisser/TypeScript,fabioparra/TypeScript,alexeagle/TypeScript,mmoskal/TypeScript,vilic/TypeScript,Eyas/TypeScript,microsoft/TypeScript,nojvek/TypeScript,ionux/TypeScript,RyanCavanaugh/TypeScript,jeremyepling/TypeScript,minestarks/TypeScript,ziacik/TypeScript,samuelhorwitz/typescript,yortus/TypeScript,chuckjaz/TypeScript,plantain-00/TypeScript,mihailik/TypeScript,jwbay/TypeScript,vilic/TypeScript,kpreisser/TypeScript,fabioparra/TypeScript,nycdotnet/TypeScript,mmoskal/TypeScript,evgrud/TypeScript,kitsonk/TypeScript,AbubakerB/TypeScript,ziacik/TypeScript,alexeagle/TypeScript,TukekeSoft/TypeScript,chuckjaz/TypeScript,Eyas/TypeScript,synaptek/TypeScript,SaschaNaz/TypeScript,minestarks/TypeScript,jwbay/TypeScript,SaschaNaz/TypeScript,yortus/TypeScript,thr0w/Thr0wScript,minestarks/TypeScript,erikmcc/TypeScript,mmoskal/TypeScript,samuelhorwitz/typescript,synaptek/TypeScript,erikmcc/TypeScript
--- +++ @@ -10,7 +10,6 @@ ////{ "files": ["test.ts", "test1.ts"] } var overridingContent = "var t = 10; t."; -debugger; goTo.file("test.ts", overridingContent); goTo.file("test1.ts"); goTo.eof();
67f689ca905227c7f2656572d3bf0faba1588d6f
pdf/pdf-tests.ts
pdf/pdf-tests.ts
/// <reference path="PDF.D.TS" /> var pdf: PDFPageProxy; // // Fetch the PDF document from the URL using promises // PDFJS.getDocument('helloworld.pdf').then(function (pdf) { // Using promise to fetch the page pdf.getPage(1).then(function (page) { var scale = 1.5; var viewport = page.getViewport(scale); // // Prepare canvas using PDF page dimensions // var canvas = <HTMLCanvasElement>document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; // // Render PDF page into canvas context // var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext); }); });
/// <reference path="pdf.d.ts" /> var pdf: PDFPageProxy; // // Fetch the PDF document from the URL using promises // PDFJS.getDocument('helloworld.pdf').then(function (pdf) { // Using promise to fetch the page pdf.getPage(1).then(function (page) { var scale = 1.5; var viewport = page.getViewport(scale); // // Prepare canvas using PDF page dimensions // var canvas = <HTMLCanvasElement>document.getElementById('the-canvas'); var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; // // Render PDF page into canvas context // var renderContext = { canvasContext: context, viewport: viewport }; page.render(renderContext); }); });
Fix PDF.D.TS -> pdf.d.ts reference
Fix PDF.D.TS -> pdf.d.ts reference
TypeScript
mit
MugeSo/DefinitelyTyped,benishouga/DefinitelyTyped,wkrueger/DefinitelyTyped,xswordsx/DefinitelyTyped,MidnightDesign/DefinitelyTyped,bdukes/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,jraymakers/DefinitelyTyped,mjjames/DefinitelyTyped,pocesar/DefinitelyTyped,Maplecroft/DefinitelyTyped,syuilo/DefinitelyTyped,Karabur/DefinitelyTyped,stylelab-io/DefinitelyTyped,mareek/DefinitelyTyped,harcher81/DefinitelyTyped,wilkerlucio/DefinitelyTyped,bdukes/DefinitelyTyped,vpineda1996/DefinitelyTyped,hatz48/DefinitelyTyped,aaharu/DefinitelyTyped,designxtek/DefinitelyTyped,blittle/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,giabao/DefinitelyTyped,danludwig/DefinitelyTyped,mshmelev/DefinitelyTyped,lcorneliussen/DefinitelyTyped,ml-workshare/DefinitelyTyped,modifyink/DefinitelyTyped,chrootsu/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,RupertAvery/DefinitelyTyped,david-driscoll/DefinitelyTyped,ecramer89/DefinitelyTyped,algorithme/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,igorsechyn/DefinitelyTyped,maxlang/DefinitelyTyped,giggio/DefinitelyTyped,tigerxy/DefinitelyTyped,abner/DefinitelyTyped,tomtheisen/DefinitelyTyped,mattblang/DefinitelyTyped,kyo-ago/DefinitelyTyped,aciccarello/DefinitelyTyped,daptiv/DefinitelyTyped,Syati/DefinitelyTyped,robert-voica/DefinitelyTyped,wbuchwalter/DefinitelyTyped,kalloc/DefinitelyTyped,OfficeDev/DefinitelyTyped,mattanja/DefinitelyTyped,nycdotnet/DefinitelyTyped,zhiyiting/DefinitelyTyped,alainsahli/DefinitelyTyped,gyohk/DefinitelyTyped,jasonswearingen/DefinitelyTyped,balassy/DefinitelyTyped,Penryn/DefinitelyTyped,ctaggart/DefinitelyTyped,esperco/DefinitelyTyped,Wordenskjold/DefinitelyTyped,demerzel3/DefinitelyTyped,georgemarshall/DefinitelyTyped,UzEE/DefinitelyTyped,philippsimon/DefinitelyTyped,paulbakker/DefinitelyTyped,arma-gast/DefinitelyTyped,hiraash/DefinitelyTyped,alextkachman/DefinitelyTyped,abbasmhd/DefinitelyTyped,spearhead-ea/DefinitelyTyped,evansolomon/DefinitelyTyped,chadoliver/DefinitelyTyped,paypac/DefinitelyTyped,paulmorphy/DefinitelyTyped,Maplecroft/DefinitelyTyped,Stephanvs/DefinitelyTyped,spion/DefinitelyTyped,vote539/DefinitelyTyped,timjk/DefinitelyTyped,ArturSoler/DefinitelyTyped,sledorze/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,pkhayundi/DefinitelyTyped,Airblader/DefinitelyTyped,psnider/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,Trapulo/DefinitelyTyped,mvarblow/DefinitelyTyped,philippsimon/DefinitelyTyped,blittle/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,brainded/DefinitelyTyped,flyfishMT/DefinitelyTyped,eekboom/DefinitelyTyped,Pro/DefinitelyTyped,s093294/DefinitelyTyped,RupertAvery/DefinitelyTyped,docgit/DefinitelyTyped,chrootsu/DefinitelyTyped,pinoyyid/DefinitelyTyped,gerich-home/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,musakarakas/DefinitelyTyped,Ridermansb/DefinitelyTyped,jimthedev/DefinitelyTyped,axefrog/DefinitelyTyped,DenEwout/DefinitelyTyped,dpsthree/DefinitelyTyped,Asido/DefinitelyTyped,trystanclarke/DefinitelyTyped,lbesson/DefinitelyTyped,ashwinr/DefinitelyTyped,subash-a/DefinitelyTyped,olemp/DefinitelyTyped,bilou84/DefinitelyTyped,magny/DefinitelyTyped,DeluxZ/DefinitelyTyped,QuatroCode/DefinitelyTyped,designxtek/DefinitelyTyped,dmorosinotto/DefinitelyTyped,nainslie/DefinitelyTyped,KhodeN/DefinitelyTyped,algas/DefinitelyTyped,designxtek/DefinitelyTyped,ryan10132/DefinitelyTyped,nakakura/DefinitelyTyped,fdecampredon/DefinitelyTyped,zensh/DefinitelyTyped,davidpricedev/DefinitelyTyped,bluong/DefinitelyTyped,3x14159265/DefinitelyTyped,rfranco/DefinitelyTyped,vagarenko/DefinitelyTyped,scsouthw/DefinitelyTyped,arusakov/DefinitelyTyped,AndrewGaspar/DefinitelyTyped,mwain/DefinitelyTyped,magny/DefinitelyTyped,nicholashead/DefinitelyTyped,Litee/DefinitelyTyped,mcrawshaw/DefinitelyTyped,bobslaede/DefinitelyTyped,pocke/DefinitelyTyped,mrk21/DefinitelyTyped,zoetrope/DefinitelyTyped,Stephanvs/DefinitelyTyped,giabao/DefinitelyTyped,antiveeranna/DefinitelyTyped,leoromanovsky/DefinitelyTyped,TiddoLangerak/DefinitelyTyped,aroder/DefinitelyTyped,olivierlemasle/DefinitelyTyped,varju/DefinitelyTyped,dflor003/DefinitelyTyped,Ptival/DefinitelyTyped,sclausen/DefinitelyTyped,rschmukler/DefinitelyTyped,grahammendick/DefinitelyTyped,KonaTeam/DefinitelyTyped,danfma/DefinitelyTyped,pkaul/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,jtlan/DefinitelyTyped,bardt/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,brentonhouse/DefinitelyTyped,sventschui/DefinitelyTyped,UzEE/DefinitelyTyped,fnipo/DefinitelyTyped,bennett000/DefinitelyTyped,haskellcamargo/DefinitelyTyped,anweiss/DefinitelyTyped,tan9/DefinitelyTyped,martinduparc/DefinitelyTyped,thSoft/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,erosb/DefinitelyTyped,Gmulti/DefinitelyTyped,ayanoin/DefinitelyTyped,balassy/DefinitelyTyped,nestalk/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,dsebastien/DefinitelyTyped,demerzel3/DefinitelyTyped,omidkrad/DefinitelyTyped,stimms/DefinitelyTyped,borisyankov/DefinitelyTyped,fdecampredon/DefinitelyTyped,stephenjelfs/DefinitelyTyped,fredgalvao/DefinitelyTyped,nitintutlani/DefinitelyTyped,gandjustas/DefinitelyTyped,pkaul/DefinitelyTyped,paypac/DefinitelyTyped,colindembovsky/DefinitelyTyped,quantumman/DefinitelyTyped,nitintutlani/DefinitelyTyped,zoetrope/DefinitelyTyped,robertbaker/DefinitelyTyped,hafenr/DefinitelyTyped,3x14159265/DefinitelyTyped,aindlq/DefinitelyTyped,richardTowers/DefinitelyTyped,optical/DefinitelyTyped,angelobelchior8/DefinitelyTyped,Asido/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,Garciat/DefinitelyTyped,jiaz/DefinitelyTyped,manekovskiy/DefinitelyTyped,PawelStroinski/DefinitelyTyped,tomtarrot/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,nmalaguti/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,zalamtech/DefinitelyTyped,vincentw56/DefinitelyTyped,miguelmq/DefinitelyTyped,mariokostelac/DefinitelyTyped,zuzusik/DefinitelyTyped,abner/DefinitelyTyped,pinoyyid/DefinitelyTyped,sixinli/DefinitelyTyped,evandrewry/DefinitelyTyped,zuzusik/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,hastebrot/DefinitelyTyped,Pipe-shen/DefinitelyTyped,emanuelhp/DefinitelyTyped,Dominator008/DefinitelyTyped,wilfrem/DefinitelyTyped,GodsBreath/DefinitelyTyped,Pro/DefinitelyTyped,toedter/DefinitelyTyped,dsebastien/DefinitelyTyped,rolandzwaga/DefinitelyTyped,greglockwood/DefinitelyTyped,hesselink/DefinitelyTyped,minodisk/DefinitelyTyped,georgemarshall/DefinitelyTyped,mrozhin/DefinitelyTyped,Dashlane/DefinitelyTyped,vasek17/DefinitelyTyped,3x14159265/DefinitelyTyped,bjfletcher/DefinitelyTyped,rcchen/DefinitelyTyped,muenchdo/DefinitelyTyped,AndrewGaspar/DefinitelyTyped,mcrawshaw/DefinitelyTyped,gerich-home/DefinitelyTyped,spion/DefinitelyTyped,mcliment/DefinitelyTyped,applesaucers/lodash-invokeMap,tarruda/DefinitelyTyped,yuit/DefinitelyTyped,Belelros/DefinitelyTyped,44ka28ta/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,ajtowf/DefinitelyTyped,micurs/DefinitelyTyped,kanreisa/DefinitelyTyped,innerverse/DefinitelyTyped,RupertAvery/DefinitelyTyped,donnut/DefinitelyTyped,M-Zuber/DefinitelyTyped,use-strict/DefinitelyTyped,RedSeal-co/DefinitelyTyped,tgrospic/DefinitelyTyped,zoetrope/DefinitelyTyped,arma-gast/DefinitelyTyped,alvarorahul/DefinitelyTyped,Airblader/DefinitelyTyped,nycdotnet/DefinitelyTyped,nelsonmorais/DefinitelyTyped,PopSugar/DefinitelyTyped,acepoblete/DefinitelyTyped,sorskoot/DefinitelyTyped,dariajung/DefinitelyTyped,alextkachman/DefinitelyTyped,Maplecroft/DefinitelyTyped,david-driscoll/DefinitelyTyped,sclausen/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,deeleman/DefinitelyTyped,hatz48/DefinitelyTyped,PascalSenn/DefinitelyTyped,RX14/DefinitelyTyped,algas/DefinitelyTyped,axefrog/DefinitelyTyped,chrilith/DefinitelyTyped,jsaelhof/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,toedter/DefinitelyTyped,wilfrem/DefinitelyTyped,nakakura/DefinitelyTyped,bayitajesi/DefinitelyTyped,jaysoo/DefinitelyTyped,egeland/DefinitelyTyped,nwolverson/DefinitelyTyped,stacktracejs/DefinitelyTyped,gcastre/DefinitelyTyped,Riron/DefinitelyTyped,harcher81/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,schmuli/DefinitelyTyped,glenndierckx/DefinitelyTyped,philippstucki/DefinitelyTyped,markogresak/DefinitelyTyped,axefrog/DefinitelyTyped,lseguin42/DefinitelyTyped,giabao/DefinitelyTyped,iislucas/DefinitelyTyped,pwelter34/DefinitelyTyped,pocesar/DefinitelyTyped,lcorneliussen/DefinitelyTyped,ErykB2000/DefinitelyTyped,tgrospic/DefinitelyTyped,nestalk/DefinitelyTyped,dmorosinotto/DefinitelyTyped,MugeSo/DefinitelyTyped,TiddoLangerak/DefinitelyTyped,progre/DefinitelyTyped,OpenMaths/DefinitelyTyped,opichals/DefinitelyTyped,nicholashead/DefinitelyTyped,behzad88/DefinitelyTyped,lcorneliussen/DefinitelyTyped,KhodeN/DefinitelyTyped,gdi2290/DefinitelyTyped,dmoonfire/DefinitelyTyped,gerich-home/DefinitelyTyped,use-strict/DefinitelyTyped,WritingPanda/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,jsaelhof/DefinitelyTyped,lbguilherme/DefinitelyTyped,HereSinceres/DefinitelyTyped,michaelbromley/DefinitelyTyped,chbrown/DefinitelyTyped,AndrewGaspar/DefinitelyTyped,44ka28ta/DefinitelyTyped,bdukes/DefinitelyTyped,psnider/DefinitelyTyped,jraymakers/DefinitelyTyped,YousefED/DefinitelyTyped,YousefED/DefinitelyTyped,florentpoujol/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,lekaha/DefinitelyTyped,nwolverson/DefinitelyTyped,sventschui/DefinitelyTyped,lucyhe/DefinitelyTyped,bdoss/DefinitelyTyped,Jwsonic/DefinitelyTyped,dreampulse/DefinitelyTyped,aaharu/DefinitelyTyped,Bobjoy/DefinitelyTyped,mjjames/DefinitelyTyped,egeland/DefinitelyTyped,moonpyk/DefinitelyTyped,frogcjn/DefinitelyTyped,dumbmatter/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,blittle/DefinitelyTyped,bayitajesi/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,paulmorphy/DefinitelyTyped,bpowers/DefinitelyTyped,ctaggart/DefinitelyTyped,johnnycrab/DefinitelyTyped,bdukes/DefinitelyTyped,georgemarshall/DefinitelyTyped,sventschui/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,OliveTreeBible/DefinitelyTyped,Fraegle/DefinitelyTyped,arueckle/DefinitelyTyped,mattblang/DefinitelyTyped,kyo-ago/DefinitelyTyped,rgripper/DefinitelyTyped,brettle/DefinitelyTyped,corps/DefinitelyTyped,benishouga/DefinitelyTyped,hellopao/DefinitelyTyped,nestalk/DefinitelyTyped,iislucas/DefinitelyTyped,ctaggart/DefinitelyTyped,tdmckinn/DefinitelyTyped,AndrewGaspar/DefinitelyTyped,elisee/DefinitelyTyped,docgit/DefinitelyTyped,greglo/DefinitelyTyped,superduper/DefinitelyTyped,smrq/DefinitelyTyped,paulbakker/DefinitelyTyped,onecentlin/DefinitelyTyped,awerlang/DefinitelyTyped,jeffbcross/DefinitelyTyped,hastebrot/DefinitelyTyped,gcastre/DefinitelyTyped,martinduparc/DefinitelyTyped,nestalk/DefinitelyTyped,colindembovsky/DefinitelyTyped,tan9/DefinitelyTyped,arusakov/DefinitelyTyped,vsavkin/DefinitelyTyped,yuit/DefinitelyTyped,aaharu/DefinitelyTyped,davidpricedev/DefinitelyTyped,igorraush/DefinitelyTyped,harcher81/DefinitelyTyped,bkristensen/DefinitelyTyped,LordJZ/DefinitelyTyped,hor-crux/DefinitelyTyped,rschmukler/DefinitelyTyped,Seikho/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,mhegazy/DefinitelyTyped,modifyink/DefinitelyTyped,nseckinoral/DefinitelyTyped,masonkmeyer/DefinitelyTyped,dydek/DefinitelyTyped,paulbakker/DefinitelyTyped,biomassives/DefinitelyTyped,unknownloner/DefinitelyTyped,algas/DefinitelyTyped,nicholashead/DefinitelyTyped,stephenjelfs/DefinitelyTyped,bobslaede/DefinitelyTyped,axefrog/DefinitelyTyped,xica/DefinitelyTyped,amanmahajan7/DefinitelyTyped,JoshRosen/DefinitelyTyped,TheBay0r/DefinitelyTyped,damianog/DefinitelyTyped,rushi216/DefinitelyTyped,duongphuhiep/DefinitelyTyped,anweiss/DefinitelyTyped,Stephanvs/DefinitelyTyped,Kuniwak/DefinitelyTyped,musicist288/DefinitelyTyped,tscho/DefinitelyTyped,arusakov/DefinitelyTyped,bayitajesi/DefinitelyTyped,munxar/DefinitelyTyped,paxibay/DefinitelyTyped,zoetrope/DefinitelyTyped,adamcarr/DefinitelyTyped,pocesar/DefinitelyTyped,ctaggart/DefinitelyTyped,kyo-ago/DefinitelyTyped,mhegazy/DefinitelyTyped,samwgoldman/DefinitelyTyped,gorcz/DefinitelyTyped,fearthecowboy/DefinitelyTyped,scriby/DefinitelyTyped,musically-ut/DefinitelyTyped,teves-castro/DefinitelyTyped,Litee/DefinitelyTyped,stimms/DefinitelyTyped,the41/DefinitelyTyped,lightswitch05/DefinitelyTyped,nfriend/DefinitelyTyped,emanuelhp/DefinitelyTyped,xStrom/DefinitelyTyped,dmorosinotto/DefinitelyTyped,bencoveney/DefinitelyTyped,Dashlane/DefinitelyTyped,aldo-roman/DefinitelyTyped,hellopao/DefinitelyTyped,xStrom/DefinitelyTyped,borisyankov/DefinitelyTyped,behzad888/DefinitelyTyped,scriby/DefinitelyTyped,goaty92/DefinitelyTyped,mendix/DefinitelyTyped,smrq/DefinitelyTyped,laball/DefinitelyTyped,dydek/DefinitelyTyped,wilkerlucio/DefinitelyTyped,TildaLabs/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,teves-castro/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,KhodeN/DefinitelyTyped,EnableSoftware/DefinitelyTyped,44ka28ta/DefinitelyTyped,44ka28ta/DefinitelyTyped,hx0day/DefinitelyTyped,schmuli/DefinitelyTyped,tgfjt/DefinitelyTyped,wilkerlucio/DefinitelyTyped,almstrand/DefinitelyTyped,dwango-js/DefinitelyTyped,glenndierckx/DefinitelyTyped,thSoft/DefinitelyTyped,KhodeN/DefinitelyTyped,shahata/DefinitelyTyped,jimthedev/DefinitelyTyped,wilkerlucio/DefinitelyTyped,antiveeranna/DefinitelyTyped,RX14/DefinitelyTyped,Lorisu/DefinitelyTyped,stacktracejs/DefinitelyTyped,ciriarte/DefinitelyTyped,paypac/DefinitelyTyped,martinduparc/DefinitelyTyped,Stephanvs/DefinitelyTyped,johnnycrab/DefinitelyTyped,DustinWehr/DefinitelyTyped,sventschui/DefinitelyTyped,thSoft/DefinitelyTyped,laco0416/DefinitelyTyped,isman-usoh/DefinitelyTyped,benliddicott/DefinitelyTyped,johan-gorter/DefinitelyTyped,drillbits/DefinitelyTyped,gildorwang/DefinitelyTyped,nainslie/DefinitelyTyped,flyfishMT/DefinitelyTyped,arcticwaters/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,pinoyyid/DefinitelyTyped,onecentlin/DefinitelyTyped,varju/DefinitelyTyped,tgrospic/DefinitelyTyped,fdecampredon/DefinitelyTyped,takfjt/DefinitelyTyped,michaelbromley/DefinitelyTyped,tinganho/DefinitelyTyped,nobuoka/DefinitelyTyped,teddyward/DefinitelyTyped,gerich-home/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,spion/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,takenet/DefinitelyTyped,Belelros/DefinitelyTyped,gedaiu/DefinitelyTyped,florentpoujol/DefinitelyTyped,robl499/DefinitelyTyped,mareek/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,mariokostelac/DefinitelyTyped,takenet/DefinitelyTyped,Karabur/DefinitelyTyped,mweststrate/DefinitelyTyped,jasonswearingen/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,one-pieces/DefinitelyTyped,jacqt/DefinitelyTyped,danludwig/DefinitelyTyped,tgfjt/DefinitelyTyped,CSharpFan/DefinitelyTyped,schmuli/DefinitelyTyped,cvrajeesh/DefinitelyTyped,Almouro/DefinitelyTyped,greglo/DefinitelyTyped,ArturSoler/DefinitelyTyped,herrmanno/DefinitelyTyped,esperco/DefinitelyTyped,Penryn/DefinitelyTyped,forumone/DefinitelyTyped,bruennijs/DefinitelyTyped,digitalpixies/DefinitelyTyped,anweiss/DefinitelyTyped,michaelbromley/DefinitelyTyped,shlomiassaf/DefinitelyTyped,stanislavHamara/DefinitelyTyped,aciccarello/DefinitelyTyped,varju/DefinitelyTyped,shiwano/DefinitelyTyped,syntax42/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,Saneyan/DefinitelyTyped,vagarenko/DefinitelyTyped,subjectix/DefinitelyTyped,pwelter34/DefinitelyTyped,raijinsetsu/DefinitelyTyped,Airblader/DefinitelyTyped,jesseschalken/DefinitelyTyped,timramone/DefinitelyTyped,rgripper/DefinitelyTyped,harcher81/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,Syati/DefinitelyTyped,kuon/DefinitelyTyped,darkl/DefinitelyTyped,aqua89/DefinitelyTyped,nojaf/DefinitelyTyped,JoshRosen/DefinitelyTyped,duncanmak/DefinitelyTyped,alexdresko/DefinitelyTyped,behzad888/DefinitelyTyped,axelcostaspena/DefinitelyTyped,uestcNaldo/DefinitelyTyped,scatcher/DefinitelyTyped,georgemarshall/DefinitelyTyped,balassy/DefinitelyTyped,isman-usoh/DefinitelyTyped,jeremyhayes/DefinitelyTyped,Dominator008/DefinitelyTyped,whoeverest/DefinitelyTyped,rolandzwaga/DefinitelyTyped,adammartin1981/DefinitelyTyped,hellopao/DefinitelyTyped,PawelStroinski/DefinitelyTyped,blink1073/DefinitelyTyped,Deathspike/DefinitelyTyped,gandjustas/DefinitelyTyped,docgit/DefinitelyTyped,Nemo157/DefinitelyTyped,sandersky/DefinitelyTyped,zuohaocheng/DefinitelyTyped,amanmahajan7/DefinitelyTyped,kabogo/DefinitelyTyped,nmalaguti/DefinitelyTyped,vote539/DefinitelyTyped,colindembovsky/DefinitelyTyped,Belelros/DefinitelyTyped,Zzzen/DefinitelyTyped,zuzusik/DefinitelyTyped,olemp/DefinitelyTyped,JoshRosen/DefinitelyTyped,ducin/DefinitelyTyped,gyohk/DefinitelyTyped,DeadAlready/DefinitelyTyped,akonwi/DefinitelyTyped,pkaul/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,newclear/DefinitelyTyped,mariokostelac/DefinitelyTyped,MarlonFan/DefinitelyTyped,danfma/DefinitelyTyped,mattanja/DefinitelyTyped,tjoskar/DefinitelyTyped,Ptival/DefinitelyTyped,abbasmhd/DefinitelyTyped,rgripper/DefinitelyTyped,miguelmq/DefinitelyTyped,dragouf/DefinitelyTyped,johan-gorter/DefinitelyTyped,applesaucers/lodash-invokeMap,shovon/DefinitelyTyped,s093294/DefinitelyTyped,gregoryagu/DefinitelyTyped,nabeix/DefinitelyTyped,lukehoban/DefinitelyTyped,chrismbarr/DefinitelyTyped,AgentME/DefinitelyTyped,pkaul/DefinitelyTyped,AgentME/DefinitelyTyped,optical/DefinitelyTyped,frogcjn/DefinitelyTyped,raijinsetsu/DefinitelyTyped,rockclimber90/DefinitelyTyped,aciccarello/DefinitelyTyped,RupertAvery/DefinitelyTyped,tboyce/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,progre/DefinitelyTyped,psnider/DefinitelyTyped,fdecampredon/DefinitelyTyped,philippstucki/DefinitelyTyped,Belelros/DefinitelyTyped,newclear/DefinitelyTyped,ArturSoler/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,maglar0/DefinitelyTyped,nobuoka/DefinitelyTyped,samdark/DefinitelyTyped,benishouga/DefinitelyTyped,fredgalvao/DefinitelyTyped,TiddoLangerak/DefinitelyTyped,Carreau/DefinitelyTyped,trystanclarke/DefinitelyTyped,hastebrot/DefinitelyTyped,akonwi/DefinitelyTyped,dmoonfire/DefinitelyTyped,hypno2000/typings,kmeurer/DefinitelyTyped,JaminFarr/DefinitelyTyped,antiveeranna/DefinitelyTyped,Airblader/DefinitelyTyped,colindembovsky/DefinitelyTyped,Mek7/DefinitelyTyped,johnnycrab/DefinitelyTyped,david-driscoll/DefinitelyTyped,algas/DefinitelyTyped,elisee/DefinitelyTyped,billccn/DefinitelyTyped,pafflique/DefinitelyTyped,demerzel3/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,HPFOD/DefinitelyTyped,reppners/DefinitelyTyped,nwolverson/DefinitelyTyped,spion/DefinitelyTyped,Zorgatone/DefinitelyTyped,jbrantly/DefinitelyTyped,Seltzer/DefinitelyTyped,drinchev/DefinitelyTyped,ashwinr/DefinitelyTyped,chocolatechipui/DefinitelyTyped,stimms/DefinitelyTyped,reppners/DefinitelyTyped,mshmelev/DefinitelyTyped,arcticwaters/DefinitelyTyped,QuatroCode/DefinitelyTyped,Zzzen/DefinitelyTyped,s093294/DefinitelyTyped,HPFOD/DefinitelyTyped,JoshRosen/DefinitelyTyped,Chris380/DefinitelyTyped,sorskoot/DefinitelyTyped,amir-arad/DefinitelyTyped,bdoss/DefinitelyTyped,jpevarnek/DefinitelyTyped,designxtek/DefinitelyTyped,Zenorbi/DefinitelyTyped,eugenpodaru/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,theyelllowdart/DefinitelyTyped,michalczukm/DefinitelyTyped,toedter/DefinitelyTyped,Shiak1/DefinitelyTyped,sorskoot/DefinitelyTyped,davidsidlinger/DefinitelyTyped,lcorneliussen/DefinitelyTyped,danludwig/DefinitelyTyped,akonwi/DefinitelyTyped,alvarorahul/DefinitelyTyped,Zorgatone/DefinitelyTyped,donnut/DefinitelyTyped,shiwano/DefinitelyTyped,syuilo/DefinitelyTyped,chrismbarr/DefinitelyTyped,icereed/DefinitelyTyped,nwolverson/DefinitelyTyped,AgentME/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,GregOnNet/DefinitelyTyped,sledorze/DefinitelyTyped,mszczepaniak/DefinitelyTyped,Minishlink/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,giabao/DefinitelyTyped,jimthedev/DefinitelyTyped,Wordenskjold/DefinitelyTyped,rgripper/DefinitelyTyped,wcomartin/DefinitelyTyped,rcchen/DefinitelyTyped,EnableSoftware/DefinitelyTyped,felipe3dfx/DefinitelyTyped,shlomiassaf/DefinitelyTyped,Maplecroft/DefinitelyTyped,alexdresko/DefinitelyTyped,ajtowf/DefinitelyTyped,OpenMaths/DefinitelyTyped,bennett000/DefinitelyTyped,NCARalph/DefinitelyTyped,ArturSoler/DefinitelyTyped,minodisk/DefinitelyTyped,nodeframe/DefinitelyTyped,AgentME/DefinitelyTyped,IAPark/DefinitelyTyped,paypac/DefinitelyTyped,damianog/DefinitelyTyped,drinchev/DefinitelyTyped,basp/DefinitelyTyped,furny/DefinitelyTyped,rerezz/DefinitelyTyped,3x14159265/DefinitelyTyped,sorskoot/DefinitelyTyped,balassy/DefinitelyTyped,PawelStroinski/DefinitelyTyped,demerzel3/DefinitelyTyped,abmohan/DefinitelyTyped,cherrydev/DefinitelyTyped,subash-a/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib
--- +++ @@ -1,4 +1,4 @@ -/// <reference path="PDF.D.TS" /> +/// <reference path="pdf.d.ts" /> var pdf: PDFPageProxy;
fb2dd4620bf7689d32b30ec378abd0989ce1d48d
src/aleksa/intents/tachanka-bot-intent.ts
src/aleksa/intents/tachanka-bot-intent.ts
import { ServerSelectorService } from './../server-selector.service'; import { injectable, inject } from 'inversify'; import { TYPES } from '../../ioc/types'; import { IClient } from '../../contracts'; import { IIntent } from 'aleksa/IIntent'; @injectable() export class TachankaBotIntent implements IIntent { name: string = "TachankaBotIntent"; constructor( @inject(TYPES.Logger) private _logger: ILogger, @inject(TYPES.AleksaServerSelector) private _serverSelector: ServerSelectorService, @inject(TYPES.IClient) private _client: IClient ) { } getCallback(config): (request: any, response: any) => Promise<void> { return async (req, res) => { const { guildId, channelId, userId, name } = await this._serverSelector.getServer(); this._client.sendMessage(guildId, channelId, `>sing for Arijoon`, {}, { isCommand: true }); }; } }
import { ServerSelectorService } from './../server-selector.service'; import { injectable, inject } from 'inversify'; import { TYPES } from '../../ioc/types'; import { IClient } from '../../contracts'; import { IIntent } from 'aleksa/IIntent'; @injectable() export class TachankaBotIntent implements IIntent { name: string = "TachankaBotIntent"; constructor( @inject(TYPES.Logger) private _logger: ILogger, @inject(TYPES.AleksaServerSelector) private _serverSelector: ServerSelectorService, @inject(TYPES.IClient) private _client: IClient ) { } getCallback(config): (request: any, response: any) => Promise<void> { return async (req, res) => { const { guildId, channelId, userId, name } = await this._serverSelector.getServer(); this._client.sendMessage(guildId, channelId, `>sing for Arijoon`, {}, { isCommand: false }); }; } }
Switch isCommand flag on other bots
Switch isCommand flag on other bots
TypeScript
mit
arijoon/vendaire-discord-bot,arijoon/vendaire-discord-bot
--- +++ @@ -18,7 +18,7 @@ getCallback(config): (request: any, response: any) => Promise<void> { return async (req, res) => { const { guildId, channelId, userId, name } = await this._serverSelector.getServer(); - this._client.sendMessage(guildId, channelId, `>sing for Arijoon`, {}, { isCommand: true }); + this._client.sendMessage(guildId, channelId, `>sing for Arijoon`, {}, { isCommand: false }); }; } }
cd6409d4ef9b2ade14aebce140d8119c7f274356
test/e2e/helloworld.ts
test/e2e/helloworld.ts
import t = require("unittest/unittest"); class MyClass { field: string; MyClass(someVal: string) { this.field = someVal; } getField(): string { return this.field + " world"; } } function main(): void { t.test("bigifies text", function() { t.expect("hello".toUpperCase(), t.equals("HELLO")); }); t.test("handles classes", function() { var mc = new MyClass("hello"); t.expect(mc.field.toUpperCase(), t.equals("HELLO WORLD")); }); }
import t = require("unittest/unittest"); class MyClass { field: string; MyClass(someVal: string) { this.field = someVal; } getField(): string { return this.field + " world"; } } function main(): void { t.test("handles classes", function() { var mc = new MyClass("hello"); t.expect(mc.getField().toUpperCase(), t.equals("HELLO WORLD")); }); }
Fix the test case. Remove superfluous test line.
Fix the test case. Remove superfluous test line.
TypeScript
apache-2.0
yjbanov/ts2dart,dart-archive/ts2dart,hterkelsen/ts2dart,caitp/ts2dart,dart-archive/ts2dart,hansl/ts2dart,jteplitz602/ts2dart,alfonso-presa/ts2dart,jacob314/ts2dart,jacob314/ts2dart,jteplitz602/ts2dart,vsavkin/ts2dart,alfonso-presa/ts2dart,hterkelsen/ts2dart,yjbanov/ts2dart,vsavkin/ts2dart,caitp/ts2dart,hansl/ts2dart,vicb/ts2dart,jeffbcross/ts2dart,dart-archive/ts2dart,vicb/ts2dart,jeffbcross/ts2dart
--- +++ @@ -9,9 +9,8 @@ } function main(): void { - t.test("bigifies text", function() { t.expect("hello".toUpperCase(), t.equals("HELLO")); }); t.test("handles classes", function() { var mc = new MyClass("hello"); - t.expect(mc.field.toUpperCase(), t.equals("HELLO WORLD")); + t.expect(mc.getField().toUpperCase(), t.equals("HELLO WORLD")); }); }
dab12e6749ea93eb11aab628ab9255bfc8075cc0
src/autoTable.ts
src/autoTable.ts
import { DocHandler, jsPDFDocument } from './documentHandler' import { createTable } from './inputParser' import { calculateWidths } from './widthCalculator' import { drawTable } from './tableDrawer' import { UserOptions } from './config' export default function autoTable(doc: jsPDFDocument, options: UserOptions) { const docHandler = new DocHandler(doc) let win: Window | undefined if (typeof window !== 'undefined') { win = window } const table = createTable(options, docHandler, win) calculateWidths(table, docHandler) drawTable(table, docHandler) table.finalY = table.cursor.y doc.previousAutoTable = table doc.lastAutoTable = table // Deprecated doc.autoTable.previous = table // Deprecated docHandler.applyStyles(docHandler.userStyles) }
import { DocHandler, jsPDFDocument } from './documentHandler' import { createTable } from './inputParser' import { calculateWidths } from './widthCalculator' import { drawTable } from './tableDrawer' import { UserOptions } from './config' export default function autoTable(doc: jsPDFDocument, options: UserOptions) { const docHandler = new DocHandler(doc) let win: Window | undefined if (typeof window !== 'undefined') { win = window } const table = createTable(options, docHandler, win) calculateWidths(table, docHandler) drawTable(table, docHandler) table.finalY = table.cursor.y doc.previousAutoTable = table doc.lastAutoTable = table // Deprecated if (doc.autoTable) doc.autoTable.previous = table // Deprecated docHandler.applyStyles(docHandler.userStyles) }
Fix crash when using nodejs dist files
Fix crash when using nodejs dist files
TypeScript
mit
simonbengtsson/jsPDF-AutoTable,simonbengtsson/jsPDF-AutoTable,simonbengtsson/jsPDF-AutoTable,someatoms/jsPDF-AutoTable
--- +++ @@ -19,7 +19,7 @@ table.finalY = table.cursor.y doc.previousAutoTable = table doc.lastAutoTable = table // Deprecated - doc.autoTable.previous = table // Deprecated + if (doc.autoTable) doc.autoTable.previous = table // Deprecated docHandler.applyStyles(docHandler.userStyles) }
d3456c723d30377e42549219770a0ad62084d183
ng2-toggle.ts
ng2-toggle.ts
import { Component, Directive, EventEmitter, Input, TemplateRef, ViewContainerRef } from '@angular/core'; @Component({ selector: 'toggle', template: ` <div *ngIf="on"> <ng-content></ng-content> </div> ` }) export class ToggleComponent { on: boolean; change: EventEmitter<boolean>; constructor() { this.change = new EventEmitter<boolean>(); this.on = false; } toggle() { this.on = !this.on; this.change.emit(!this.on); } } @Directive({ selector: '[toggle]' }) export class ToggleDirective { @Input() set toggle(toggle: ToggleComponent) { if (!toggle.on) this.show(); toggle.change.subscribe(on => { if (on) this.show(); else this.hide(); }); } constructor( private template: TemplateRef<ViewContainerRef>, private viewContainer: ViewContainerRef ) {} private hide() { this.viewContainer.clear(); } private show() { this.viewContainer.createEmbeddedView(this.template); } }
import { Component, Directive, EventEmitter, Input, TemplateRef, ViewContainerRef } from '@angular/core'; @Component({ selector: 'toggle', template: ` <div *ngIf="on"> <ng-content></ng-content> </div> ` }) export class ToggleComponent { on = false; change = new EventEmitter<boolean>(); toggle() { this.on = !this.on; this.change.emit(this.on); } } @Directive({ selector: '[toggle]' }) export class ToggleDirective { @Input() set toggle(toggle: ToggleComponent) { if (!toggle.on) this.show(); toggle.change.subscribe(on => { if (on) this.hide(); else this.show(); }); } constructor( private template: TemplateRef<ViewContainerRef>, private viewContainer: ViewContainerRef ) {} private hide() { this.viewContainer.clear(); } private show() { this.viewContainer.createEmbeddedView(this.template); } }
Change event returns opposite value
Change event returns opposite value
TypeScript
mit
jasonroyle/ng2-toggle
--- +++ @@ -11,15 +11,11 @@ ` }) export class ToggleComponent { - on: boolean; - change: EventEmitter<boolean>; - constructor() { - this.change = new EventEmitter<boolean>(); - this.on = false; - } + on = false; + change = new EventEmitter<boolean>(); toggle() { this.on = !this.on; - this.change.emit(!this.on); + this.change.emit(this.on); } } @@ -30,8 +26,8 @@ @Input() set toggle(toggle: ToggleComponent) { if (!toggle.on) this.show(); toggle.change.subscribe(on => { - if (on) this.show(); - else this.hide(); + if (on) this.hide(); + else this.show(); }); } constructor(
aa8a178f96a6b2eeef84634d30cf32db64a3cad6
test/utils/utils.ts
test/utils/utils.ts
import * as fs from "fs"; import * as child from "child_process"; import * as path from "path"; export function getWasmInstance(sourcePath: string, outputFile?:string): WebAssembly.Instance { outputFile = outputFile || sourcePath.replace(".tbs", ".wasm"); let result = child.spawnSync(path.join(__dirname, '../../bin/tc'), [sourcePath, '--out', outputFile]); console.log(result); const data = fs.readFileSync(outputFile); const mod = new WebAssembly.Module(data); return new WebAssembly.Instance(mod); }
import * as fs from "fs"; import * as child from "child_process"; import * as path from "path"; export function getWasmInstance(sourcePath: string, outputFile?:string): WebAssembly.Instance { outputFile = outputFile || sourcePath.replace(".tbs", ".wasm"); let result = child.spawnSync(path.join(__dirname, '../../bin/tc'), [sourcePath, '--out', outputFile]); const data = fs.readFileSync(outputFile); const mod = new WebAssembly.Module(data); return new WebAssembly.Instance(mod); }
Build is stable so debug log removed
Build is stable so debug log removed
TypeScript
apache-2.0
01alchemist/TurboScript,01alchemist/TurboScript,01alchemist/TurboScript,01alchemist/TurboScript,01alchemist/TurboScript,01alchemist/TurboScript
--- +++ @@ -5,7 +5,6 @@ export function getWasmInstance(sourcePath: string, outputFile?:string): WebAssembly.Instance { outputFile = outputFile || sourcePath.replace(".tbs", ".wasm"); let result = child.spawnSync(path.join(__dirname, '../../bin/tc'), [sourcePath, '--out', outputFile]); - console.log(result); const data = fs.readFileSync(outputFile); const mod = new WebAssembly.Module(data); return new WebAssembly.Instance(mod);
09a4e486ccb68906c71af315ef5783316d1ce9d5
app/src/lib/firebase.ts
app/src/lib/firebase.ts
import * as firebase from "firebase"; const projectId = process.env.REACT_APP_FIREBASE_PROJECT_ID; export function initialize(): void { firebase.initializeApp({ apiKey: process.env.REACT_APP_FIREBASE_API_KEY, authDomain: `${projectId}.firebaseapp.com`, databaseURL: `https://${projectId}.firebaseio.com`, storageBucket: `${projectId}.appspot.com`, }); } export async function signIn(): Promise<void> { await firebase.auth().signInWithRedirect(new firebase.auth.GithubAuthProvider()); await firebase.auth().getRedirectResult(); } export function onAuthStateChanged(callback: (user: firebase.User) => void) { firebase.auth().onAuthStateChanged(callback); }
import * as firebase from "firebase"; const projectId = process.env.REACT_APP_FIREBASE_PROJECT_ID; export function initialize(): void { firebase.initializeApp({ apiKey: process.env.REACT_APP_FIREBASE_API_KEY, authDomain: `${projectId}.firebaseapp.com`, databaseURL: `https://${projectId}.firebaseio.com`, storageBucket: `${projectId}.appspot.com`, }); } export async function signIn(): Promise<void> { await firebase.auth().signInWithRedirect(new firebase.auth.GithubAuthProvider()); await firebase.auth().getRedirectResult(); } export function onAuthStateChanged(callback: (user: firebase.User) => void): void { firebase.auth().onAuthStateChanged(callback); }
Set return type of onAuthStateChanged function
Set return type of onAuthStateChanged function
TypeScript
mit
raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d
--- +++ @@ -16,6 +16,6 @@ await firebase.auth().getRedirectResult(); } -export function onAuthStateChanged(callback: (user: firebase.User) => void) { +export function onAuthStateChanged(callback: (user: firebase.User) => void): void { firebase.auth().onAuthStateChanged(callback); }
a91ecc63abd5a1d4b0aafd0f2f8a3f4ac4f29da6
src/Components/NavBar/MinimalNavBar.tsx
src/Components/NavBar/MinimalNavBar.tsx
import { ArtsyLogoBlackIcon, Box } from "@artsy/palette" import { AppContainer } from "Apps/Components/AppContainer" import { RouterLink } from "Artsy/Router/RouterLink" import React from "react" interface MinimalNavBarProps { to: string children: React.ReactNode } export const MinimalNavBar: React.FC<MinimalNavBarProps> = props => { return ( <Box zIndex={1000} background="white" position="absolute" left={0} top={0} width="100%" pt={4} > <AppContainer> <Box height={70} px={[2, 4]}> <RouterLink to={props.to} className="acceptance__logoLink"> <ArtsyLogoBlackIcon /> </RouterLink> </Box> </AppContainer> {props.children} </Box> ) }
import { ArtsyLogoBlackIcon, Box } from "@artsy/palette" import { AppContainer } from "Apps/Components/AppContainer" import { RouterLink } from "Artsy/Router/RouterLink" import React from "react" interface MinimalNavBarProps { to: string children: React.ReactNode } export const MinimalNavBar: React.FC<MinimalNavBarProps> = props => { return ( <Box zIndex={1000} background="white" position="absolute" left={0} top={0} width="100%" pt={4} > <AppContainer> <Box height={70} px={[2, 4]}> <RouterLink to={props.to} data-test="logoLink"> <ArtsyLogoBlackIcon /> </RouterLink> </Box> </AppContainer> {props.children} </Box> ) }
Use data-link instead of classname
Use data-link instead of classname
TypeScript
mit
artsy/reaction,artsy/reaction,artsy/reaction-force,artsy/reaction,artsy/reaction-force
--- +++ @@ -21,7 +21,7 @@ > <AppContainer> <Box height={70} px={[2, 4]}> - <RouterLink to={props.to} className="acceptance__logoLink"> + <RouterLink to={props.to} data-test="logoLink"> <ArtsyLogoBlackIcon /> </RouterLink> </Box>
1abf6ceefe52ed46b29c0b0ae0d4cfd78c620ff4
client/material/icon-button.tsx
client/material/icon-button.tsx
import PropTypes from 'prop-types' import React from 'react' import styled from 'styled-components' import { CardLayer } from '../styles/colors' import Button, { ButtonCommon, ButtonProps } from './button' export const IconButtonContents = styled(ButtonCommon)` width: 48px; min-height: 48px; border-radius: 50%; vertical-align: middle; ${props => { if (props.disabled) return '' return ` &:active { background-color: rgba(255, 255, 255, 0.16); } ${CardLayer} &:active { background-color: rgba(255, 255, 255, 0.1); } ` }} ` export interface IconButtonProps extends Omit<ButtonProps, 'label' | 'contentComponent'> { icon: React.ReactNode title?: string buttonRef?: React.Ref<HTMLButtonElement> } /** A button that displays just an SVG icon. */ const IconButton = React.forwardRef<Button, IconButtonProps>((props, ref) => { const { icon, ...otherProps } = props return <Button ref={ref} {...otherProps} label={icon} contentComponent={IconButtonContents} /> }) IconButton.propTypes = { icon: PropTypes.element.isRequired, } export default IconButton
import PropTypes from 'prop-types' import React from 'react' import styled from 'styled-components' import { CardLayer } from '../styles/colors' import Button, { ButtonCommon, ButtonProps } from './button' export const IconButtonContents = styled(ButtonCommon)` width: 48px; min-height: 48px; border-radius: 8px; vertical-align: middle; ${props => { if (props.disabled) return '' return ` &:active { background-color: rgba(255, 255, 255, 0.16); } ${CardLayer} &:active { background-color: rgba(255, 255, 255, 0.12); } ` }} ` export interface IconButtonProps extends Omit<ButtonProps, 'label' | 'contentComponent'> { icon: React.ReactNode title?: string buttonRef?: React.Ref<HTMLButtonElement> } /** A button that displays just an SVG icon. */ const IconButton = React.forwardRef<Button, IconButtonProps>((props, ref) => { const { icon, ...otherProps } = props return <Button ref={ref} {...otherProps} label={icon} contentComponent={IconButtonContents} /> }) IconButton.propTypes = { icon: PropTypes.element.isRequired, } export default IconButton
Use a boxier shape for icon buttons.
Use a boxier shape for icon buttons.
TypeScript
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -7,7 +7,7 @@ export const IconButtonContents = styled(ButtonCommon)` width: 48px; min-height: 48px; - border-radius: 50%; + border-radius: 8px; vertical-align: middle; ${props => { @@ -19,7 +19,7 @@ } ${CardLayer} &:active { - background-color: rgba(255, 255, 255, 0.1); + background-color: rgba(255, 255, 255, 0.12); } ` }}
db8eb08bd4afdd55685fb1465b8b47b1680e7389
source/scripts/setup-plugins.ts
source/scripts/setup-plugins.ts
import * as child_process from "child_process" import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" const go = async () => { // Download settings const db = jsonDatabase(DATABASE_JSON_FILE) await db.setup() const installation = await db.getInstallation(0) if (!installation) { return } // Look for plugins if (installation.settings.plugins && installation.settings.plugins.length !== 0) { const plugins = installation.settings.plugins.join(" ") console.log("Installing: " + plugins) // tslint:disable-line // Install them with yarn child_process.execSync("yarn add " + plugins) } else { console.log("Not adding any plugins") // tslint:disable-line } } go()
import * as child_process from "child_process" import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" const log = console.log const go = async () => { // Download settings const db = jsonDatabase(DATABASE_JSON_FILE) await db.setup() const installation = await db.getInstallation(0) if (!installation) { return } // Look for plugins if (installation.settings.plugins && installation.settings.plugins.length !== 0) { const plugins = installation.settings.plugins.join(" ") log("Installing: " + plugins) const ls = child_process.spawn("yarn", ["add", ...plugins]) ls.stdout.on("data", data => log(`stdout: ${data}`)) ls.stderr.on("data", data => log(`stderr: ${data}`)) ls.on("close", code => log(`child process exited with code ${code}`)) } else { log("Not adding any plugins") } } go()
Add some stdout logs for plugin deploys
Add some stdout logs for plugin deploys
TypeScript
mit
danger/peril,danger/peril,danger/peril,danger/peril,danger/peril
--- +++ @@ -2,6 +2,8 @@ import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" + +const log = console.log const go = async () => { // Download settings @@ -15,11 +17,15 @@ // Look for plugins if (installation.settings.plugins && installation.settings.plugins.length !== 0) { const plugins = installation.settings.plugins.join(" ") - console.log("Installing: " + plugins) // tslint:disable-line - // Install them with yarn - child_process.execSync("yarn add " + plugins) + log("Installing: " + plugins) + + const ls = child_process.spawn("yarn", ["add", ...plugins]) + + ls.stdout.on("data", data => log(`stdout: ${data}`)) + ls.stderr.on("data", data => log(`stderr: ${data}`)) + ls.on("close", code => log(`child process exited with code ${code}`)) } else { - console.log("Not adding any plugins") // tslint:disable-line + log("Not adding any plugins") } }
52b2882efaa4352cb99cf2fe739aef92d71b6e6d
packages/logary/src/utils/sendBeacon.ts
packages/logary/src/utils/sendBeacon.ts
import { Observable, of } from "rxjs" import './BigInt-JSON-patch' /** * A function that sends the body asynchronously to the specified url. */ export default function sendBeacon(url: string, data: string | Blob | FormData | URLSearchParams | ReadableStream<Uint8Array>) { if (typeof window !== 'undefined' && window.navigator.sendBeacon != null) { // console.log('send beacon data:', data) return of(window.navigator.sendBeacon(url, data)) } else { // https://github.com/southpolesteve/node-abort-controller return new Observable<boolean>(o => { const AbortController = require('node-abort-controller') const controller = new AbortController() const signal = controller.signal const headers = { 'content-type': 'application/json; charset=utf-8', 'accept': 'application/json' } fetch(url, { method: 'POST', body: data, signal, headers }) .then(res => res.json()) .then(json => { o.next(json) o.complete() }) .catch(e => { o.error(e) }) }) } }
import { Observable, of } from "rxjs" import './BigInt-JSON-patch' /** * A function that sends the body asynchronously to the specified url. */ export default function sendBeacon(url: string, data: string | Blob | FormData | URLSearchParams | ReadableStream<Uint8Array>) { if (typeof window !== 'undefined' && window.navigator.sendBeacon != null) { // console.log('send beacon data:', data) return of(window.navigator.sendBeacon(url, data)) } else { // https://github.com/southpolesteve/node-abort-controller return new Observable<boolean>(o => { const AbortController = require('node-abort-controller') const controller = new AbortController() const signal = controller.signal const headers = { 'content-type': 'application/json; charset=utf-8', 'accept': 'application/json' } fetch(url, { method: 'POST', body: data, signal, headers }) .then(res => res.json()) .then(json => { o.next(json) o.complete() }) .catch(e => { o.error(e) }) return () => { controller.abort() } }) } }
Use AbortController cancellation mechanism if warranted
Use AbortController cancellation mechanism if warranted
TypeScript
mit
logary/logary-js,logary/logary-js
--- +++ @@ -27,6 +27,9 @@ .catch(e => { o.error(e) }) + return () => { + controller.abort() + } }) } }
a8512997355abce17730486329ce7146d9b78fe3
src/drawableObjects.ts
src/drawableObjects.ts
export interface DrawableObject { drawOn(canvas: HTMLCanvasElement): any; } export type BlockType = "Entry" | "Choice" | "Action" | "Exit"; export interface Block extends DrawableObject { type: BlockType; } export interface Connection extends DrawableObject { from: Block; to: Block; }
export interface DrawableObject { drawOn(canvas: HTMLCanvasElement): any; } // enum value can be read as string, e.g.: blockType[blockType.Entry] export enum BlockType { Entry, Condition, Action, Exit } export interface Block extends DrawableObject { type: BlockType; } export interface Connection extends DrawableObject { from: Block; to: Block; }
Change BlockType to enum, rename Choice to Condition
Change BlockType to enum, rename Choice to Condition
TypeScript
mit
hckr/diagram-editor,hckr/diagram-editor
--- +++ @@ -2,7 +2,13 @@ drawOn(canvas: HTMLCanvasElement): any; } -export type BlockType = "Entry" | "Choice" | "Action" | "Exit"; +// enum value can be read as string, e.g.: blockType[blockType.Entry] +export enum BlockType { + Entry, + Condition, + Action, + Exit +} export interface Block extends DrawableObject { type: BlockType;
c0e61177175d1a0be831ec307e37ed4b13166cd4
src/components/Checkbox/Checkbox.tsx
src/components/Checkbox/Checkbox.tsx
import React from 'react' import styled from 'styled-components' import { Nodes } from '../../types' const List = styled.ul` list-style-type: none; ` const StyledCheckbox = styled.input` margin-right: 0.5rem; cursor: pointer; ` interface Props { id: string nodes: Nodes onToggle(id: string): void } export const Checkbox = ({ id, nodes, onToggle }: Props) => { const node = nodes[id] const { text, childIds, checked } = node const handleChange = () => onToggle(id) return ( <React.Fragment key={id}> {text && ( <li> <label> <StyledCheckbox type='checkbox' checked={checked} onChange={handleChange} /> {text} </label> </li> )} {childIds.length ? ( <li> <List> {childIds.map((childId) => ( <Checkbox key={childId} id={childId} nodes={nodes} onToggle={onToggle} /> ))} </List> </li> ) : null} </React.Fragment> ) }
import React from 'react' import styled from 'styled-components' import { Nodes } from '../../types' const List = styled.ul` list-style-type: none; ` const StyledCheckbox = styled.input` margin-right: 0.5rem; cursor: pointer; ` interface Props { id: string nodes: Nodes onToggle: (id: string) => void } export const Checkbox = ({ id, nodes, onToggle }: Props) => { const node = nodes[id] const { text, childIds, checked } = node const handleChange = () => onToggle(id) return ( <React.Fragment key={id}> {text && ( <li> <label> <StyledCheckbox type='checkbox' checked={checked} onChange={handleChange} /> {text} </label> </li> )} {childIds.length ? ( <li> <List> {childIds.map((childId) => ( <Checkbox key={childId} id={childId} nodes={nodes} onToggle={onToggle} /> ))} </List> </li> ) : null} </React.Fragment> ) }
Use consistent syntax for defining interface members
Use consistent syntax for defining interface members
TypeScript
mit
joelgeorgev/react-checkbox-tree,joelgeorgev/react-checkbox-tree
--- +++ @@ -15,7 +15,7 @@ interface Props { id: string nodes: Nodes - onToggle(id: string): void + onToggle: (id: string) => void } export const Checkbox = ({ id, nodes, onToggle }: Props) => {
28a9f9c6adb8aef3b9625d3c969bef522b67656d
site/client/CountryProfileConstants.tsx
site/client/CountryProfileConstants.tsx
import { covidCountryProfileSlug, covidLandingSlug, covidCountryProfileRootPath } from "site/server/covid/CovidConstants" export type CountryProfileProject = "coronavirus" | "co2" export interface CountryProfileSpec { project: CountryProfileProject pageTitle: string genericProfileSlug: string landingPageSlug: string selector: string rootPath: string } export const co2CountryProfileRootPath = "co2/country" export const co2CountryProfilePath = "/co2-country-profile" export const countryProfileSpecs: Map< CountryProfileProject, CountryProfileSpec > = new Map([ [ "coronavirus", { project: "coronavirus", pageTitle: "Coronavirus Pandemic", genericProfileSlug: covidCountryProfileSlug, landingPageSlug: covidLandingSlug, selector: ".wp-block-covid-search-country", rootPath: covidCountryProfileRootPath } ], [ "co2", { project: "co2", pageTitle: "CO2", genericProfileSlug: "co2-country-profile", landingPageSlug: "co2-and-greenhouse-gas-emissions-landing-page", selector: ".wp-block-co2-search-country", rootPath: co2CountryProfileRootPath } ] ])
import { covidCountryProfileSlug, covidLandingSlug, covidCountryProfileRootPath } from "site/server/covid/CovidConstants" export type CountryProfileProject = "coronavirus" | "co2" export interface CountryProfileSpec { project: CountryProfileProject pageTitle: string genericProfileSlug: string landingPageSlug: string selector: string rootPath: string } export const co2CountryProfileRootPath = "co2/country" export const co2CountryProfilePath = "/co2-country-profile" export const countryProfileSpecs: Map< CountryProfileProject, CountryProfileSpec > = new Map([ [ "coronavirus", { project: "coronavirus", pageTitle: "Coronavirus Pandemic", genericProfileSlug: covidCountryProfileSlug, landingPageSlug: covidLandingSlug, selector: ".wp-block-covid-search-country", rootPath: covidCountryProfileRootPath } ], [ "co2", { project: "co2", pageTitle: "CO2", genericProfileSlug: "co2-country-profile", landingPageSlug: "co2-and-other-greenhouse-gas-emissions", selector: ".wp-block-co2-search-country", rootPath: co2CountryProfileRootPath } ] ])
Update landingPageSlug for CO₂ country profiles
Update landingPageSlug for CO₂ country profiles
TypeScript
mit
owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher
--- +++ @@ -39,7 +39,7 @@ project: "co2", pageTitle: "CO2", genericProfileSlug: "co2-country-profile", - landingPageSlug: "co2-and-greenhouse-gas-emissions-landing-page", + landingPageSlug: "co2-and-other-greenhouse-gas-emissions", selector: ".wp-block-co2-search-country", rootPath: co2CountryProfileRootPath }
e8f86407551aae79d5303e3ad19160256a4a3964
src/extensions.ts
src/extensions.ts
/** * Triggered when a user was logged in * * @factoryParam {User} user The user object that was logged in */ export const EP_PHOVEA_CORE_LOGIN = 'epPhoveaCoreLogin'; /** * Triggered when a user was logged out. Does not provide any further information. */ export const EP_PHOVEA_CORE_LOGOUT = 'epPhoveaCoreLogout';
/** * Triggered when a user was logged in * * @factoryParam {IUser} user The user object that was logged in */ export const EP_PHOVEA_CORE_LOGIN = 'epPhoveaCoreLogin'; /** * Triggered when a user was logged out. Does not provide any further information. */ export const EP_PHOVEA_CORE_LOGOUT = 'epPhoveaCoreLogout';
Fix data type in extension point documenation
Fix data type in extension point documenation
TypeScript
bsd-3-clause
phovea/phovea_core,Caleydo/caleydo_web,phovea/phovea_core,Caleydo/caleydo_web,Caleydo/caleydo_core
--- +++ @@ -1,7 +1,7 @@ /** * Triggered when a user was logged in * - * @factoryParam {User} user The user object that was logged in + * @factoryParam {IUser} user The user object that was logged in */ export const EP_PHOVEA_CORE_LOGIN = 'epPhoveaCoreLogin';
bdbb33be6314729b9ba921e15da5e17b9ca61f8a
prepare.ts
prepare.ts
/// <reference types="node" /> import * as path from 'path'; import * as fs from 'fs-extra'; const PACKAGE_JSON = 'package.json'; const LIB_PATH = './lib'; fs.copySync(PACKAGE_JSON, path.join(LIB_PATH, PACKAGE_JSON));
/// <reference types="node" /> import * as path from 'path'; import * as fs from 'fs-extra'; const LIB_PATH = './lib'; const preservedFiles = [ 'package.json', 'README.md', ]; for (const file of preservedFiles) { fs.copySync(file, path.join(LIB_PATH, file)); }
Update package script to copy README
Update package script to copy README
TypeScript
mit
kourge/ordering
--- +++ @@ -2,7 +2,13 @@ import * as path from 'path'; import * as fs from 'fs-extra'; -const PACKAGE_JSON = 'package.json'; const LIB_PATH = './lib'; -fs.copySync(PACKAGE_JSON, path.join(LIB_PATH, PACKAGE_JSON)); +const preservedFiles = [ + 'package.json', + 'README.md', +]; + +for (const file of preservedFiles) { + fs.copySync(file, path.join(LIB_PATH, file)); +}
87b17d97efe8ca563569ea9b20d812bfd7f1ad64
apps/template-blank/app.ts
apps/template-blank/app.ts
import application = require("application"); application.mainModule = "app/main-page"; // Remove this in the AppBuilder templates application.cssFile = "app/template-blank/app.css" application.start();
import application = require("application"); application.mainModule = "main-page"; // Remove this in the AppBuilder templates application.cssFile = "template-blank/app.css" application.start();
Fix the path in the blank template
Fix the path in the blank template
TypeScript
mit
genexliu/NativeScript,NativeScript/NativeScript,NativeScript/NativeScript,hdeshev/NativeScript,hdeshev/NativeScript,hdeshev/NativeScript,NativeScript/NativeScript,genexliu/NativeScript,NativeScript/NativeScript,NativeScript/NativeScript,genexliu/NativeScript
--- +++ @@ -1,7 +1,7 @@ import application = require("application"); -application.mainModule = "app/main-page"; +application.mainModule = "main-page"; // Remove this in the AppBuilder templates -application.cssFile = "app/template-blank/app.css" +application.cssFile = "template-blank/app.css" application.start();
c89e6974159cce89dbf1f076a99b32938ced6043
packages/notifications/src/Notification.ts
packages/notifications/src/Notification.ts
import { get } from 'lodash' import { INotification, NotificationState, INotificationOptions } from './Contracts' export default class Notification implements INotification { timestamp = new Date dismissed = false displayed = false defaultOptions = {} constructor( readonly state: NotificationState = NotificationState.Info, readonly message: string, options: INotificationOptions ) { this.options = options || this.defaultOptions } getState(): NotificationState { return this.state } getMessage(): string { return this.message } getOptions(): INotificationOptions { return this.options } getTimestamp(): Date { return this.timestamp } isDismissed(): boolean { return this.dismissed } isDismissable(): boolean { return !!this.options.dismissable } wasDisplayed(): boolean { return this.displayed } }
import { get } from 'lodash' import { INotification, NotificationState, INotificationOptions } from './Contracts' export default class Notification implements INotification { timestamp = new Date dismissed = false displayed = false defaultOptions = {} constructor( readonly state: NotificationState = NotificationState.Info, readonly message: string, options: INotificationOptions ) { this.options = options || this.defaultOptions } getState(): NotificationState { return this.state } getMessage(): string { return this.message } getOptions(): INotificationOptions { return this.options } getTimestamp(): Date { return this.timestamp } isDismissed(): boolean { return this.dismissed } isDismissable(): boolean { return get(this.options, 'dismissable', false) } wasDisplayed(): boolean { return this.displayed } }
Fix missed code during commit
Fix missed code during commit
TypeScript
mit
tsarholdings/neutron
--- +++ @@ -36,7 +36,7 @@ } isDismissable(): boolean { - return !!this.options.dismissable + return get(this.options, 'dismissable', false) } wasDisplayed(): boolean {
4cd1e2a797d3c404077e3b929eeba238b5abb8f2
lib/utils.ts
lib/utils.ts
import Promise = require('any-promise') import { parse as parseQuery } from 'querystring' import Request from './request' export type TextTypes = 'text' | 'json' | 'urlencoded' export const textTypes = ['text', 'json', 'urlencoded'] export function parse (request: Request, value: string, type: string) { // Return plain-text as is. if (type === 'text') { return value } // Parsing empty strings should return `null` (non-strict). if (value === '') { return null } // Attempt to parse the response as JSON. if (type === 'json') { try { return JSON.parse(value) } catch (err) { throw request.error(`Unable to parse response body: ${err.message}`, 'EPARSE', err) } } // Attempt to parse the response as URL encoding. if (type === 'urlencoded') { return parseQuery(value) } throw new TypeError(`Unable to parse type: ${type}`) }
import Promise = require('any-promise') import { parse as parseQuery } from 'querystring' import Request from './request' export type TextTypes = 'text' | 'json' | 'urlencoded' export const textTypes = ['text', 'json', 'urlencoded'] const PROTECTION_PREFIX = /^\)\]\}',?\n/ export function parse (request: Request, value: string, type: string) { // Return plain-text as is. if (type === 'text') { return value } // Parsing empty strings should return `null` (non-strict). if (value === '') { return null } // Attempt to parse the response as JSON. if (type === 'json') { try { return JSON.parse(value.replace(PROTECTION_PREFIX, '')) } catch (err) { throw request.error(`Unable to parse response body: ${err.message}`, 'EPARSE', err) } } // Attempt to parse the response as URL encoding. if (type === 'urlencoded') { return parseQuery(value) } throw new TypeError(`Unable to parse type: ${type}`) }
Handle JSON protection prefix when parsing
Handle JSON protection prefix when parsing
TypeScript
mit
blakeembrey/popsicle,blakeembrey/popsicle
--- +++ @@ -4,6 +4,8 @@ export type TextTypes = 'text' | 'json' | 'urlencoded' export const textTypes = ['text', 'json', 'urlencoded'] + +const PROTECTION_PREFIX = /^\)\]\}',?\n/ export function parse (request: Request, value: string, type: string) { // Return plain-text as is. @@ -19,7 +21,7 @@ // Attempt to parse the response as JSON. if (type === 'json') { try { - return JSON.parse(value) + return JSON.parse(value.replace(PROTECTION_PREFIX, '')) } catch (err) { throw request.error(`Unable to parse response body: ${err.message}`, 'EPARSE', err) }
12a9584b386b8872b9541822b48067a9d4735e39
manup-demo/src/app/app.module.ts
manup-demo/src/app/app.module.ts
import { HttpClient, HttpClientModule } from '@angular/common/http'; import { ErrorHandler, NgModule } from '@angular/core'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; import { ManUpModule, ManUpService } from 'ionic-manup'; import { HomePage } from '../pages/home/home'; import { MyApp } from './app.component'; export function translateLoader(http: HttpClient) { return new TranslateHttpLoader(http, 'assets/i18n', '.json'); } @NgModule({ declarations: [MyApp, HomePage], imports: [ IonicModule.forRoot(MyApp), HttpClientModule, ManUpModule.forRoot({ url: 'https://raw.githubusercontent.com/NextFaze/ionic-manup/master/manup-demo/manup.json', externalTranslations: true }), TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: translateLoader, deps: [HttpClient] } }) ], bootstrap: [IonicApp], providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }, ManUpService], entryComponents: [MyApp, HomePage] }) export class AppModule {}
import { HttpClient, HttpClientModule } from '@angular/common/http'; import { ErrorHandler, NgModule } from '@angular/core'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular'; import { ManUpModule, ManUpService } from 'ionic-manup'; import { HomePage } from '../pages/home/home'; import { MyApp } from './app.component'; export function translateLoader(http: HttpClient) { return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); } @NgModule({ declarations: [MyApp, HomePage], imports: [ IonicModule.forRoot(MyApp), HttpClientModule, ManUpModule.forRoot({ url: 'https://raw.githubusercontent.com/NextFaze/ionic-manup/master/manup-demo/manup.json', externalTranslations: true }), TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: translateLoader, deps: [HttpClient] } }) ], bootstrap: [IonicApp], providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }, ManUpService], entryComponents: [MyApp, HomePage] }) export class AppModule {}
Fix path to translation files in demo
Fix path to translation files in demo
TypeScript
mit
NextFaze/ionic-manup,NextFaze/ionic-manup,NextFaze/ionic-manup
--- +++ @@ -9,7 +9,7 @@ import { MyApp } from './app.component'; export function translateLoader(http: HttpClient) { - return new TranslateHttpLoader(http, 'assets/i18n', '.json'); + return new TranslateHttpLoader(http, 'assets/i18n/', '.json'); } @NgModule({ declarations: [MyApp, HomePage],
90699c8c31e0650973f319c1df72b4e1fff01682
cypress/integration/viewingRooms.spec.ts
cypress/integration/viewingRooms.spec.ts
import { visitWithStatusRetries } from "../helpers/visitWithStatusRetries" describe("Viewing rooms", () => { it("/viewing-rooms", () => { visitWithStatusRetries("viewing-rooms") cy.get("h1").should("contain", "Viewing Rooms") cy.title().should("eq", "Artsy Viewing Rooms") }) })
import { visitWithStatusRetries } from "../helpers/visitWithStatusRetries" describe("Viewing rooms", () => { it("/viewing-rooms", () => { visitWithStatusRetries("viewing-rooms") cy.get("h1").should("contain", "Viewing Rooms") cy.title().should("eq", "Artsy Viewing Rooms") // follow link to viewing room const roomLink = cy.get('a[href*="/viewing-room/"]:first') roomLink.click() cy.url().should("contain", "/viewing-room/") cy.contains("Works") }) })
Add assertion about visiting individual viewing room, to stand in for Integrity's smoke test
Add assertion about visiting individual viewing room, to stand in for Integrity's smoke test
TypeScript
mit
artsy/force,artsy/force,artsy/force-public,artsy/force,artsy/force,artsy/force-public
--- +++ @@ -5,5 +5,11 @@ visitWithStatusRetries("viewing-rooms") cy.get("h1").should("contain", "Viewing Rooms") cy.title().should("eq", "Artsy Viewing Rooms") + + // follow link to viewing room + const roomLink = cy.get('a[href*="/viewing-room/"]:first') + roomLink.click() + cy.url().should("contain", "/viewing-room/") + cy.contains("Works") }) })
3400cd9457bc8fe72913c2ace5e5f5f0e96d3280
lib/directives/mobx-autorun.directive.ts
lib/directives/mobx-autorun.directive.ts
import { Directive, ViewContainerRef, TemplateRef, HostListener, Renderer, OnInit, OnDestroy } from '@angular/core'; import { autorun } from 'mobx'; import { mobxAngularDebug } from '../utils/mobx-angular-debug'; @Directive({ selector: '[mobxAutorun]' }) export class MobxAutorunDirective implements OnInit, OnDestroy { protected templateBindings = {}; protected dispose: any; protected view: any; constructor( protected templateRef: TemplateRef<any>, protected viewContainer: ViewContainerRef, protected renderer: Renderer) { } ngOnInit() { this.view = this.viewContainer.createEmbeddedView(this.templateRef); if (this.dispose) this.dispose(); this.autoDetect(this.view); mobxAngularDebug(this.view, this.renderer, this.dispose); } autoDetect(view) { this.dispose = autorun( `${view._view.parentView.context.constructor.name}.detectChanges()`, () => view['detectChanges']() ); } ngOnDestroy() { if (this.dispose) this.dispose(); } }
import { Directive, ViewContainerRef, TemplateRef, HostListener, Renderer, OnInit, OnDestroy } from '@angular/core'; import { autorun } from 'mobx'; import { mobxAngularDebug } from '../utils/mobx-angular-debug'; @Directive({ selector: '[mobxAutorun]' }) export class MobxAutorunDirective implements OnInit, OnDestroy { protected templateBindings = {}; protected dispose: any; protected view: any; constructor( protected templateRef: TemplateRef<any>, protected viewContainer: ViewContainerRef, protected renderer: Renderer) { } ngOnInit() { this.view = this.viewContainer.createEmbeddedView(this.templateRef); if (this.dispose) this.dispose(); this.autoDetect(this.view); mobxAngularDebug(this.view, this.renderer, this.dispose); } autoDetect(view) { const autorunName = view._view.component ? `${view._view.component.constructor.name}.detectChanges()` // angular 4+ : `${view._view.parentView.context.constructor.name}.detectChanges()`; // angular 2 this.dispose = autorun( autorunName, () => view['detectChanges']() ); } ngOnDestroy() { if (this.dispose) this.dispose(); } }
Add support for angular 4
Add support for angular 4
TypeScript
mit
mobxjs/mobx-angular,500tech/ng2-mobx,500tech/ng2-mobx,500tech/ng2-mobx,mobxjs/mobx-angular,mobxjs/mobx-angular,mobxjs/mobx-angular
--- +++ @@ -24,8 +24,12 @@ } autoDetect(view) { + const autorunName = view._view.component + ? `${view._view.component.constructor.name}.detectChanges()` // angular 4+ + : `${view._view.parentView.context.constructor.name}.detectChanges()`; // angular 2 + this.dispose = autorun( - `${view._view.parentView.context.constructor.name}.detectChanges()`, + autorunName, () => view['detectChanges']() ); }
d4e46c2612be52a81fc42bf7064bc81200876d4a
helpers/object.ts
helpers/object.ts
export default class HelperObject { public static clone(obj: any): any { if (obj == null || typeof (obj) !== "object") { return obj; // any non-objects are passed by value, not reference } if (obj instanceof Date) { return new Date(obj.getTime()); } let temp: any = new obj.constructor(); Object.keys(obj).forEach(key => { temp[key] = HelperObject.clone(obj[key]); }); return temp; } public static merge(from: any, to: any): any { for (let i in from) { if (from[i] instanceof Array && to[i] instanceof Array) { to[i] = to[i].concat(from[i]); } else { to[i] = from[i]; } } return from; } }
export default class HelperObject { public static clone(obj: any): any { if (obj == null || typeof (obj) !== "object") { return obj; // any non-objects are passed by value, not reference } if (obj instanceof Date) { return new Date(obj.getTime()); } let temp: any = new obj.constructor(); Object.keys(obj).forEach(key => { temp[key] = HelperObject.clone(obj[key]); }); return temp; } public static merge(from: any, to: any): any { for (let i in from) { if (from[i] instanceof Array && to[i] instanceof Array) { to[i] = to[i].concat(from[i]); } else { to[i] = from[i]; } } return to; } }
Fix a bug in HelperObject.merge()
Fix a bug in HelperObject.merge()
TypeScript
mit
crossroads-education/eta,crossroads-education/eta
--- +++ @@ -21,6 +21,6 @@ to[i] = from[i]; } } - return from; + return to; } }
f9e084b619c8b511b937e1aa867ac09de264abfe
src/app/store/index.ts
src/app/store/index.ts
import * as fromRouter from '@ngrx/router-store' import { ActionReducerMap, MetaReducer, createFeatureSelector, createSelector } from '@ngrx/store' import { storeFreeze } from 'ngrx-store-freeze' import { ENV } from '../../environments/environment' import { CustomRouterState } from '../shared/utils/custom-router-state-serializer' export interface State { router: fromRouter.RouterReducerState<CustomRouterState> } export const reducers: ActionReducerMap<State> = { router: fromRouter.routerReducer } export const metaReducers: MetaReducer<{}>[] = !ENV.PROD ? [storeFreeze] : [] export const getRouterState = createFeatureSelector< fromRouter.RouterReducerState<CustomRouterState> >('router') export const getRouterUrl = createSelector(getRouterState, router => { return router && router.state && router.state.url }) export const getRouterParams = createSelector(getRouterState, router => { return router && router.state && router.state.params })
import * as fromRouter from '@ngrx/router-store' import { ActionReducerMap, MetaReducer, createFeatureSelector, createSelector } from '@ngrx/store' import { storeFreeze } from 'ngrx-store-freeze' import { ENV } from '../../environments/environment' import { CustomRouterState } from '../shared/utils/custom-router-state-serializer' export interface State { router: fromRouter.RouterReducerState<CustomRouterState> } export const reducers: ActionReducerMap<State> = { router: fromRouter.routerReducer } export const metaReducers: MetaReducer<{}>[] = !ENV.PROD ? [storeFreeze] : [] export const getRouterState = createFeatureSelector< fromRouter.RouterReducerState<CustomRouterState> >('router') export const getRouterUrl = createSelector(getRouterState, router => { return router && router.state && router.state.url }) export const getRouterParams = createSelector(getRouterState, router => { return router && router.state && router.state.params }) export const getRouterParamsStudyName = createSelector( getRouterState, router => { return router && router.state && router.state.params['studyName'] } )
Add `studyName` selector from route params
Add `studyName` selector from route params
TypeScript
apache-2.0
RADAR-CNS/RADAR-Dashboard,RADAR-CNS/RADAR-Dashboard,RADAR-CNS/RADAR-Dashboard,RADAR-CNS/RADAR-Dashboard
--- +++ @@ -31,3 +31,10 @@ export const getRouterParams = createSelector(getRouterState, router => { return router && router.state && router.state.params }) + +export const getRouterParamsStudyName = createSelector( + getRouterState, + router => { + return router && router.state && router.state.params['studyName'] + } +)
b6b47ac07a27f7b8c4b4d8c96c2c4f5c1858ec95
src/js/Helpers/Collapse.d.ts
src/js/Helpers/Collapse.d.ts
import * as React from 'react'; import { Props } from '../index'; export interface CollapseProps extends Props { defaultStyle?: React.CSSProperties; collapsed: boolean; springConfig: Object; children?: React.ReactElement<any>; animate?: boolean; } declare const Collapse: React.ComponentClass<CollapseProps>; export default Collapse;
import * as React from 'react'; import { Props } from '../index'; export interface CollapseProps extends Props { defaultStyle?: React.CSSProperties; collapsed: boolean; springConfig?: Object; children?: React.ReactElement<any>; animate?: boolean; } declare const Collapse: React.ComponentClass<CollapseProps>; export default Collapse;
Make `springConfig` of `Collapse` optional
Typescript: Make `springConfig` of `Collapse` optional Since it has a default value, it's not required to be set when using the component.
TypeScript
mit
mlaursen/react-md,mlaursen/react-md,mlaursen/react-md
--- +++ @@ -4,7 +4,7 @@ export interface CollapseProps extends Props { defaultStyle?: React.CSSProperties; collapsed: boolean; - springConfig: Object; + springConfig?: Object; children?: React.ReactElement<any>; animate?: boolean; }
7c96785b5fdacdaae584cb2343f426e24eca1794
src/js/Interfaces/Models/INotificationFilterSet.ts
src/js/Interfaces/Models/INotificationFilterSet.ts
interface INotificationFilterSet { read?: boolean; subjectType: string[]; reasonType: string[]; repository: number[]; };
interface INotificationFilterSet { read: boolean; subjectType: string[]; reasonType: string[]; repository: number[]; };
Make Read on NotificationFilterSet required
Make Read on NotificationFilterSet required
TypeScript
mit
harksys/HawkEye,harksys/HawkEye,harksys/HawkEye
--- +++ @@ -1,7 +1,7 @@ interface INotificationFilterSet { - read?: boolean; + read: boolean; subjectType: string[];
def543422ab87402170135f8684aa2a29b45e284
src/__tests__/validator/index.ts
src/__tests__/validator/index.ts
import { validateData } from '../../validator'; test('invalid', () => { expect(() => (validateData as any)()).toThrow(); expect(() => (validateData as any)({ tag: -1 })).toThrow(); });
import { validateData } from '../../validator'; import { uint8 } from '../../schemas'; test('invalid', () => { expect(() => (validateData as any)()).toThrow(); expect(() => (validateData as any)({ ...uint8, tag: -1 })).toThrow(); expect(() => (validateData as any)({ ...uint8, version: -1 })).toThrow(); });
Add test for invalid schema version
Add test for invalid schema version
TypeScript
mit
maxdavidson/structly,maxdavidson/structly
--- +++ @@ -1,6 +1,8 @@ import { validateData } from '../../validator'; +import { uint8 } from '../../schemas'; test('invalid', () => { expect(() => (validateData as any)()).toThrow(); - expect(() => (validateData as any)({ tag: -1 })).toThrow(); + expect(() => (validateData as any)({ ...uint8, tag: -1 })).toThrow(); + expect(() => (validateData as any)({ ...uint8, version: -1 })).toThrow(); });
c92b6779f5f25dd21f3ccb888eb50644d551199a
src/web/main/router.ts
src/web/main/router.ts
import * as express from 'express'; export default function(app: express.Express) { console.log('Init Web router'); }
import * as express from 'express'; export default function(app: express.Express) { console.log('Init Web router'); }
Add newline to end of file
Add newline to end of file
TypeScript
mit
misskey-delta/Misskey-Web,misskey-delta/Misskey-Web,MissKernel/Misskey-Web,MissKernel/Misskey-Web,Tosuke/Misskey-Web,MissKernel/Misskey-Web,Tosuke/Misskey-Web,Tosuke/Misskey-Web,armchair-philosophy/Misskey-Web,MissKernel/Misskey-Web,armchair-philosophy/Misskey-Web,misskey-delta/Misskey-Web,armchair-philosophy/Misskey-Web,potato4d/Misskey-Web,potato4d/Misskey-Web,potato4d/Misskey-Web,Tosuke/Misskey-Web
12a2728c29ea88c9253c55477bed0ac0989cc76c
step-release-vis/e2e/src/app.e2e-spec.ts
step-release-vis/e2e/src/app.e2e-spec.ts
// TODO(andreystar): review the autogenerated config, once the file is actually in use, and we have more insight on the real needs import { AppPage } from './app.po'; import { browser, logging } from 'protractor'; describe('workspace-project App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); it('should display welcome message', () => { page.navigateTo(); expect(page.getTitleText()).toEqual('step-release-vis app is running!'); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }); });
// TODO(andreystar): review the autogenerated config, once the file is actually in use, and we have more insight on the real needs import { AppPage } from './app.po'; import { browser, logging } from 'protractor'; describe('workspace-project App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER); expect(logs).not.toContain(jasmine.objectContaining({ level: logging.Level.SEVERE, } as logging.Entry)); }); });
Update test files for e2e.
Update test files for e2e.
TypeScript
apache-2.0
googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020,googleinterns/step251-2020
--- +++ @@ -9,11 +9,6 @@ page = new AppPage(); }); - it('should display welcome message', () => { - page.navigateTo(); - expect(page.getTitleText()).toEqual('step-release-vis app is running!'); - }); - afterEach(async () => { // Assert that there are no errors emitted from the browser const logs = await browser.manage().logs().get(logging.Type.BROWSER);
744cbd726e2dd1a12d5b2b9b3e505b9834405f27
src/utils.ts
src/utils.ts
import { Clone, IMerge, Merge } from 'lutils'; export const merge: IMerge = new Merge({ depth: 100 }).merge; export const clone = new Clone({ depth: 100 }).clone; export const isIterable = (obj) => obj != null && typeof obj[Symbol.iterator] === 'function'
import { Clone, IMerge, Merge } from 'lutils'; export const merge: IMerge = new Merge({ depth: 100 }).merge; export const clone = new Clone({ depth: 100 }).clone; export function isIterable (obj) { if (obj === null || obj === undefined) { return false; } return typeof obj[Symbol.iterator] === 'function'; }
Expand isIterable to beat the linter...
Expand isIterable to beat the linter...
TypeScript
mit
temando/serverless-openapi-documentation,temando/serverless-openapi-documentation,temando/serverless-openapi-documentation
--- +++ @@ -2,4 +2,11 @@ export const merge: IMerge = new Merge({ depth: 100 }).merge; export const clone = new Clone({ depth: 100 }).clone; -export const isIterable = (obj) => obj != null && typeof obj[Symbol.iterator] === 'function' + +export function isIterable (obj) { + if (obj === null || obj === undefined) { + return false; + } + + return typeof obj[Symbol.iterator] === 'function'; +}
b296fc3cdf10629f30619a992b133dabc0301f3a
packages/lesswrong/platform/express/server/loadDatabaseSettings.ts
packages/lesswrong/platform/express/server/loadDatabaseSettings.ts
import { setPublicSettings, getServerSettingsCache, setServerSettingsCache, registeredSettings } from '../../../lib/settingsCache'; import { getDatabase } from '../lib/mongoCollection'; export async function refreshSettingsCaches() { const db = getDatabase(); if (db) { const table = db.collection("databasemetadata"); // TODO: Do these two parallel to save a roundtrip const serverSettingsObject = await table.findOne({name: "serverSettings"}) const publicSettingsObject = await table.findOne({name: "publicSettings"}) setServerSettingsCache(serverSettingsObject?.value || {__initialized: true}); // We modify the publicSettings object that is made available in lib to allow both the client and the server to access it setPublicSettings(publicSettingsObject?.value || {__initialized: true}); } }
import { setPublicSettings, getServerSettingsCache, setServerSettingsCache, registeredSettings } from '../../../lib/settingsCache'; import { getDatabase } from '../lib/mongoCollection'; export async function refreshSettingsCaches() { const db = getDatabase(); if (db) { const table = db.collection("databasemetadata"); const [serverSettingsObject, publicSettingsObject] = await Promise.all([ await table.findOne({name: "serverSettings"}), await table.findOne({name: "publicSettings"}) ]); setServerSettingsCache(serverSettingsObject?.value || {__initialized: true}); // We modify the publicSettings object that is made available in lib to allow both the client and the server to access it setPublicSettings(publicSettingsObject?.value || {__initialized: true}); } }
Load DB settings in parallel
Load DB settings in parallel
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -5,9 +5,10 @@ const db = getDatabase(); if (db) { const table = db.collection("databasemetadata"); - // TODO: Do these two parallel to save a roundtrip - const serverSettingsObject = await table.findOne({name: "serverSettings"}) - const publicSettingsObject = await table.findOne({name: "publicSettings"}) + const [serverSettingsObject, publicSettingsObject] = await Promise.all([ + await table.findOne({name: "serverSettings"}), + await table.findOne({name: "publicSettings"}) + ]); setServerSettingsCache(serverSettingsObject?.value || {__initialized: true}); // We modify the publicSettings object that is made available in lib to allow both the client and the server to access it
6fbb591a90fadf9dd4f72b1f8af1d3250beea606
packages/client/src/util/commonPrefix.ts
packages/client/src/util/commonPrefix.ts
export function commonPrefix(values: string[]): string { if (!values.length) return ''; const result = values.reduce(pfx); return result; } function pfx(a: string, b: string): string { const s = Math.min(a.length, b.length); let i = 0; while (i < s && a[i] === b[i]) { i++; } return a.slice(0, i); }
export function commonPrefix(values: string[]): string { if (!values.length) return ''; const min = values.reduce((min, curr) => (min <= curr ? min : curr)); const max = values.reduce((max, curr) => (max >= curr ? max : curr)); return pfx(min, max); } function pfx(a: string, b: string): string { const s = Math.min(a.length, b.length); let i = 0; while (i < s && a[i] === b[i]) { i++; } return a.slice(0, i); }
Improve the common prefix alg
Improve the common prefix alg
TypeScript
mit
Jason-Rev/vscode-spell-checker,Jason-Rev/vscode-spell-checker,Jason-Rev/vscode-spell-checker,Jason-Rev/vscode-spell-checker,Jason-Rev/vscode-spell-checker
--- +++ @@ -1,8 +1,9 @@ export function commonPrefix(values: string[]): string { if (!values.length) return ''; - const result = values.reduce(pfx); - return result; + const min = values.reduce((min, curr) => (min <= curr ? min : curr)); + const max = values.reduce((max, curr) => (max >= curr ? max : curr)); + return pfx(min, max); } function pfx(a: string, b: string): string {
9e9eee7f9fdf29875aa9b7def2f68fa19aee4fcf
src/app/_services/ov-api.service.spec.ts
src/app/_services/ov-api.service.spec.ts
import { TestBed } from '@angular/core/testing'; import { OvApiService } from './ov-api.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('OvApiService', () => { let service: OvApiService; beforeEach(() => { TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, ], }); service = TestBed.inject(OvApiService); }); it('should be created', () => { expect(service).toBeTruthy(); }); });
import { TestBed } from '@angular/core/testing'; import { OvApiService } from './ov-api.service'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; describe('OvApiService', () => { let service: OvApiService; let httpTestingController: HttpTestingController; beforeEach(() => { TestBed.configureTestingModule({ imports: [ HttpClientTestingModule, ], }); // Inject the HTTP test controller for each test httpTestingController = TestBed.inject(HttpTestingController); // Instantiate service under test service = TestBed.inject(OvApiService); }); it('should be created', () => { expect(service).toBeTruthy(); }); it('#getDepartureTimes() should request and unwrap departure times', () => { service.getDepartureTimes('zazzoo').subscribe(data => expect(data).toEqual({foo: 'bar'})); // Mock the HTTP service const req = httpTestingController.expectOne('http://v0.ovapi.nl/stopareacode/zazzoo'); // Verify request method expect(req.request.method).toEqual('GET'); // Respond with test data req.flush({ zazzoo: { foo: 'bar', } }); // Verify there's no outstanding request httpTestingController.verify(); }); });
Add unit tests for OvApiService
Add unit tests for OvApiService
TypeScript
mit
yktoo/infopi,yktoo/infopi,yktoo/infopi,yktoo/infopi
--- +++ @@ -1,10 +1,12 @@ import { TestBed } from '@angular/core/testing'; import { OvApiService } from './ov-api.service'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; describe('OvApiService', () => { + let service: OvApiService; + let httpTestingController: HttpTestingController; beforeEach(() => { TestBed.configureTestingModule({ @@ -12,10 +14,36 @@ HttpClientTestingModule, ], }); + + // Inject the HTTP test controller for each test + httpTestingController = TestBed.inject(HttpTestingController); + + // Instantiate service under test service = TestBed.inject(OvApiService); }); it('should be created', () => { expect(service).toBeTruthy(); }); + + it('#getDepartureTimes() should request and unwrap departure times', () => { + service.getDepartureTimes('zazzoo').subscribe(data => expect(data).toEqual({foo: 'bar'})); + + // Mock the HTTP service + const req = httpTestingController.expectOne('http://v0.ovapi.nl/stopareacode/zazzoo'); + + // Verify request method + expect(req.request.method).toEqual('GET'); + + // Respond with test data + req.flush({ + zazzoo: { + foo: 'bar', + } + }); + + // Verify there's no outstanding request + httpTestingController.verify(); + }); + });
e8da941703579c30ef59adc2abca60315ab57d7c
src/app/_services/api/api-models/business-api.ts
src/app/_services/api/api-models/business-api.ts
import { Organization } from '../../../models/organization'; export class BusinessApi { public id: number; public legalName: string; public commonName: string; public mail: string; public legalStatus: string; public siret: string; public shareCapital: number; public RCSNumber: string; public APECode: string; public vatNumber: string; public vatRate: number; public legalRepresentative: string; constructor(organization: Organization) { this.id = organization.id; if ( organization.legalName ) { this.legalName = organization.legalName; } if ( organization.vatRate ) { this.vatRate = organization.vatRate; } if ( organization.legalStatus ) { this.legalStatus = organization.legalStatus; } if ( organization.siret ) { this.siret = organization.siret; } if ( organization.APECode ) { this.APECode = organization.APECode; } if ( organization.vatNumber ) { this.vatNumber = organization.vatNumber; } if ( organization.RCSNumber ) { this.RCSNumber = organization.RCSNumber; } if ( organization.shareCapital ) { this.shareCapital = organization.shareCapital; } } }
import { Organization } from '../../../models/organization'; export class BusinessApi { public id: number; public legalName: string; public commonName: string; public mail: string; public legalStatus: string; public siret: string; public shareCapital: number; public RCSNumber: string; public APECode: string; public vatNumber: string; public vatRate: number; public legalRepresentative: string; constructor(organization: Organization) { this.id = organization.id; if ( organization.legalName ) { this.legalName = organization.legalName; } if ( organization.mail ) { this.mail = organization.mail; } if ( organization.vatRate ) { this.vatRate = organization.vatRate; } if ( organization.legalStatus ) { this.legalStatus = organization.legalStatus; } if ( organization.siret ) { this.siret = organization.siret; } if ( organization.APECode ) { this.APECode = organization.APECode; } if ( organization.vatNumber ) { this.vatNumber = organization.vatNumber; } if ( organization.RCSNumber ) { this.RCSNumber = organization.RCSNumber; } if ( organization.shareCapital ) { this.shareCapital = organization.shareCapital; } } }
Add necessary email for business
Add necessary email for business
TypeScript
mit
XavierGuichet/bemoove-front,XavierGuichet/bemoove-front,XavierGuichet/bemoove-front
--- +++ @@ -19,6 +19,9 @@ if ( organization.legalName ) { this.legalName = organization.legalName; + } + if ( organization.mail ) { + this.mail = organization.mail; } if ( organization.vatRate ) { this.vatRate = organization.vatRate;
84f8bc6bb53c2c4a0aa32b89e7cab4b5c3538053
deploy/deploy_poll.ts
deploy/deploy_poll.ts
import {HardhatRuntimeEnvironment} from "hardhat/types" import {DeployFunction} from "hardhat-deploy/types" import ContractDeployer from "./deployer" const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) { const {deployments, getNamedAccounts} = hre // Get the deployments and getNamedAccounts which are provided by hardhat-deploy const {deploy, get} = deployments // the deployments object itself contains the deploy function const {deployer} = await getNamedAccounts() // Fetch named accounts from hardhat.config.ts const contractDeployer = new ContractDeployer(deploy, deployer, deployments) const livepeerToken = await get("LivepeerToken") await contractDeployer.deployAndRegister({ contract: "PollCreator", name: "PollCreator", args: [livepeerToken.address] }) } func.dependencies = ["Contracts"] func.tags = ["Poll"] export default func
import {HardhatRuntimeEnvironment} from "hardhat/types" import {DeployFunction} from "hardhat-deploy/types" import ContractDeployer from "./deployer" const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) { const {deployments, getNamedAccounts} = hre // Get the deployments and getNamedAccounts which are provided by hardhat-deploy const {deploy, get} = deployments // the deployments object itself contains the deploy function const {deployer} = await getNamedAccounts() // Fetch named accounts from hardhat.config.ts const contractDeployer = new ContractDeployer(deploy, deployer, deployments) const bondingManager = await get("BondingManager") await contractDeployer.deployAndRegister({ contract: "PollCreator", name: "PollCreator", args: [bondingManager.address] }) } func.dependencies = ["Contracts"] func.tags = ["Poll"] export default func
Fix PollCreator deploy script dep
deploy: Fix PollCreator deploy script dep
TypeScript
mit
livepeer/protocol,livepeer/protocol,livepeer/protocol
--- +++ @@ -11,12 +11,12 @@ const contractDeployer = new ContractDeployer(deploy, deployer, deployments) - const livepeerToken = await get("LivepeerToken") + const bondingManager = await get("BondingManager") await contractDeployer.deployAndRegister({ contract: "PollCreator", name: "PollCreator", - args: [livepeerToken.address] + args: [bondingManager.address] }) }
c30821c7ef6cd8268ac7e66fa862e64590218bf5
Configuration/TypoScript/Includes/Page.ts
Configuration/TypoScript/Includes/Page.ts
page.meta { # tell mobile devices to initially scale the page to fit the devices screen width # viewport = width=device-width, initial-scale=1.0 }
config { # set the 'no-js' html-class for Modernizr htmlTag_setParams = class="no-js" } page.meta { # tell mobile devices to initially scale the page to fit the devices screen width # viewport = width=device-width, initial-scale=1.0 }
Set the 'no-js' class on the html-element by default
[FEATURE] Set the 'no-js' class on the html-element by default
TypeScript
mit
t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template,t3b/t3b_template
--- +++ @@ -1,3 +1,8 @@ +config { + # set the 'no-js' html-class for Modernizr + htmlTag_setParams = class="no-js" +} + page.meta { # tell mobile devices to initially scale the page to fit the devices screen width # viewport = width=device-width, initial-scale=1.0
d4de7cafa69c527ba27b6aeef486c3179226aa72
src/app/gallery/image.service.spec.ts
src/app/gallery/image.service.spec.ts
import { TestBed, inject } from '@angular/core/testing'; import { ImageService } from './image.service'; describe('ImageService', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [ImageService] }); }); it('should ...', inject([ImageService], (service: ImageService) => { expect(service).toBeTruthy(); })); });
import { TestBed, inject } from '@angular/core/testing'; import { HttpModule, Http, Response, ResponseOptions, XHRBackend } from '@angular/http'; import { MockBackend } from '@angular/http/testing'; import { ImageInfo } from './image-info'; import { ImageService } from './image.service'; const mockFeaturedImageData = { id: 1, title: 'mock featured image', date: Date.now(), description: 'long mock image description', thumbnail: './thumbnail.jpg', src: './original.jpg', containingAlbums: [ { name: 'mockalbum', title: 'mock album' } ], featured: true }; const mockUnfeaturedImageData = { id: 2, title: 'mock unfeatured image', date: Date.now(), description: 'long mock image description - unfeatured', thumbnail: './thumbnail.jpg', src: './original.jpg', containingAlbums: [ { name: 'mockalbum', title: 'mock album' } ], featured: false }; describe('ImageService', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpModule], providers: [ ImageService, { provide: XHRBackend, useClass: MockBackend } ] }); }); it('should get all images from album', inject([ImageService, XHRBackend], (service, mockBackend) => { const mockResponse = { data: [mockFeaturedImageData, mockUnfeaturedImageData] }; mockBackend.connections.subscribe((connection) => { connection.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockResponse) }))); }); service.getImagesFromAlbum('any', 1).subscribe((images: ImageInfo[]) => { expect(images.length).toBe(2); expect(images[0].id).toBe(1); expect(images[0].title).toBe('mock featured image'); expect(images[0].featured).toBeTruthy(); expect(images[1].id).toBe(2); expect(images[1].title).toBe('mock unfeatured image'); expect(images[1].featured).toBeFalsy(); }); })); it('should get a single image', inject([ImageService, XHRBackend], (service, mockBackend) => { const mockResponse = { data: mockUnfeaturedImageData }; mockBackend.connections.subscribe((connection) => { connection.mockRespond(new Response(new ResponseOptions({ body: JSON.stringify(mockResponse) }))); }); service.getImagesFromAlbum('any', 1).subscribe((image: ImageInfo) => { expect(image.id).toBe(2); expect(image.title).toBe('mock unfeatured image'); expect(image.featured).toBeFalsy(); }); })); });
Add tests for image service
Add tests for image service
TypeScript
apache-2.0
jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog
--- +++ @@ -1,14 +1,90 @@ import { TestBed, inject } from '@angular/core/testing'; +import { + HttpModule, + Http, + Response, + ResponseOptions, + XHRBackend +} from '@angular/http'; +import { MockBackend } from '@angular/http/testing'; + +import { ImageInfo } from './image-info'; import { ImageService } from './image.service'; + +const mockFeaturedImageData = { + id: 1, + title: 'mock featured image', + date: Date.now(), + description: 'long mock image description', + thumbnail: './thumbnail.jpg', + src: './original.jpg', + containingAlbums: [ + { name: 'mockalbum', title: 'mock album' } + ], + featured: true +}; + +const mockUnfeaturedImageData = { + id: 2, + title: 'mock unfeatured image', + date: Date.now(), + description: 'long mock image description - unfeatured', + thumbnail: './thumbnail.jpg', + src: './original.jpg', + containingAlbums: [ + { name: 'mockalbum', title: 'mock album' } + ], + featured: false +}; describe('ImageService', () => { beforeEach(() => { TestBed.configureTestingModule({ - providers: [ImageService] + imports: [HttpModule], + providers: [ + ImageService, + { provide: XHRBackend, useClass: MockBackend } + ] }); }); - it('should ...', inject([ImageService], (service: ImageService) => { - expect(service).toBeTruthy(); + it('should get all images from album', + inject([ImageService, XHRBackend], (service, mockBackend) => { + const mockResponse = { data: [mockFeaturedImageData, mockUnfeaturedImageData] }; + + mockBackend.connections.subscribe((connection) => { + connection.mockRespond(new Response(new ResponseOptions({ + body: JSON.stringify(mockResponse) + }))); + }); + + service.getImagesFromAlbum('any', 1).subscribe((images: ImageInfo[]) => { + expect(images.length).toBe(2); + + expect(images[0].id).toBe(1); + expect(images[0].title).toBe('mock featured image'); + expect(images[0].featured).toBeTruthy(); + + expect(images[1].id).toBe(2); + expect(images[1].title).toBe('mock unfeatured image'); + expect(images[1].featured).toBeFalsy(); + }); + })); + + it('should get a single image', + inject([ImageService, XHRBackend], (service, mockBackend) => { + const mockResponse = { data: mockUnfeaturedImageData }; + + mockBackend.connections.subscribe((connection) => { + connection.mockRespond(new Response(new ResponseOptions({ + body: JSON.stringify(mockResponse) + }))); + }); + + service.getImagesFromAlbum('any', 1).subscribe((image: ImageInfo) => { + expect(image.id).toBe(2); + expect(image.title).toBe('mock unfeatured image'); + expect(image.featured).toBeFalsy(); + }); })); });
d5747cbb8972094759b5a34a3e8e1af593e019e4
src/pages/user/index.ts
src/pages/user/index.ts
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class User { user: any; private readonly router: Router; private readonly api: HackerNewsApi; private id: string; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { if (params.id === undefined) { this.router.navigateToRoute('news'); return; } this.id = params.id; this.user = await this.api.fetch(`user/${this.id}`); } }
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class User { user: any; private readonly router: Router; private readonly api: HackerNewsApi; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { if (params.id === undefined) { this.router.navigateToRoute('news'); return; } this.user = await this.api.fetch(`user/${params.id}`); } }
Remove unnecessary class level variable in user page
Remove unnecessary class level variable in user page
TypeScript
isc
michaelbull/aurelia-hacker-news,MikeBull94/aurelia-hacker-news,michaelbull/aurelia-hacker-news,MikeBull94/aurelia-hacker-news,michaelbull/aurelia-hacker-news
--- +++ @@ -8,7 +8,6 @@ private readonly router: Router; private readonly api: HackerNewsApi; - private id: string; constructor(router: Router, api: HackerNewsApi) { this.router = router; @@ -21,7 +20,6 @@ return; } - this.id = params.id; - this.user = await this.api.fetch(`user/${this.id}`); + this.user = await this.api.fetch(`user/${params.id}`); } }
5379bca95e65167295890d46ce99e0b78af256ef
src/app/sections/breadcrumbs/breadcrumbs.component.ts
src/app/sections/breadcrumbs/breadcrumbs.component.ts
import { Component, Input, OnInit } from '@angular/core'; import { DataService } from '../../services/data.service'; import { Path } from '../../interfaces/path.interface'; @Component({ selector: 'app-breadcrumbs', templateUrl: './breadcrumbs.component.html', styleUrls: ['./breadcrumbs.component.sass'] }) export class BreadcrumbsComponent implements OnInit { @Input() section: Path; @Input() subalias: string; subname: string = ''; constructor(private data: DataService) { } ngOnInit() { this.setSubname(this.section.alias, this.subalias); } private setSubname(alias: string, subalias: string) { this.data.getSubsectionName(alias, subalias).subscribe((data) => { this.subname = data; }); } }
import { Component, Input, OnInit } from '@angular/core'; import { DataService } from '../../services/data.service'; import { Path } from '../../interfaces/path.interface'; @Component({ selector: 'app-breadcrumbs', templateUrl: './breadcrumbs.component.html', styleUrls: ['./breadcrumbs.component.sass'] }) export class BreadcrumbsComponent implements OnInit { @Input() section: Path; @Input() subalias: string; subname: string = ''; constructor(private data: DataService) { } ngOnInit() { if (this.subalias) this.setSubname(this.section.alias, this.subalias); } private setSubname(alias: string, subalias: string) { this.data.getSubsectionName(alias, subalias).subscribe((data) => { this.subname = data; }); } }
Correct extra call of set subname function
Correct extra call of set subname function
TypeScript
mit
KeJSaR/artezian-info-web,KeJSaR/artezian-info-web,KeJSaR/artezian-info-web,KeJSaR/artezian-info-web
--- +++ @@ -18,7 +18,7 @@ constructor(private data: DataService) { } ngOnInit() { - this.setSubname(this.section.alias, this.subalias); + if (this.subalias) this.setSubname(this.section.alias, this.subalias); } private setSubname(alias: string, subalias: string) {
8f003ea6af271ee08a897dd35ffbffa4ccac03e9
src/IConfig.ts
src/IConfig.ts
/* Copyright 2019 The Matrix.org Foundation C.I.C. 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. */ // This should follow the format in slack-config-schema.yaml type LogEnum = "error"|"warn"| "info"|"debug"|"off"; export interface IConfig { slack_hook_port: number; inbound_uri_prefix: string; bot_username: string; username_prefix: string; slack_master_token?: string; matrix_admin_room?: string; homeserver: { url: string; server_name: string; media_url?: string; }; tls: { key_file: string; crt_file: string; }; logging: { console: LogEnum; fileDatePattern: string; timestampFormat: string; files: {[filename: string]: LogEnum} }; oauth2?: { client_id: string; client_secret: string; redirect_prefix?: string; }; enable_metrics: boolean; dbdir: string; }
/* Copyright 2019 The Matrix.org Foundation C.I.C. 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. */ // This should follow the format in slack-config-schema.yaml type LogEnum = "error"|"warn"| "info"|"debug"|"off"; import { WebClientOptions } from "@slack/web-api"; export interface IConfig { slack_hook_port: number; inbound_uri_prefix: string; bot_username: string; username_prefix: string; slack_master_token?: string; matrix_admin_room?: string; homeserver: { url: string; server_name: string; media_url?: string; }; tls: { key_file: string; crt_file: string; }; logging: { console: LogEnum; fileDatePattern: string; timestampFormat: string; files: {[filename: string]: LogEnum} }; oauth2?: { client_id: string; client_secret: string; redirect_prefix?: string; }; slack_client_opts?: WebClientOptions; enable_metrics: boolean; dbdir: string; }
Add option to specify additional parameters in the config
Add option to specify additional parameters in the config
TypeScript
apache-2.0
matrix-org/matrix-appservice-slack,matrix-org/matrix-appservice-slack,matrix-org/matrix-appservice-slack,matrix-org/matrix-appservice-slack
--- +++ @@ -17,6 +17,7 @@ // This should follow the format in slack-config-schema.yaml type LogEnum = "error"|"warn"| "info"|"debug"|"off"; +import { WebClientOptions } from "@slack/web-api"; export interface IConfig { slack_hook_port: number; @@ -52,6 +53,7 @@ redirect_prefix?: string; }; + slack_client_opts?: WebClientOptions; enable_metrics: boolean; dbdir: string;
78c8a7065fbf13c6497916b3c1b2e13e0fdfeb4b
packages/react-sequential-id/src/index.ts
packages/react-sequential-id/src/index.ts
import { ReactElement, SFC, StatelessComponent } from 'react' import uniqueid from 'uniqueid' export interface ISequentialIdProps { children: (id: string) => ReactElement<any> | null } export type SequentialIdComponent = StatelessComponent<ISequentialIdProps> export type SequentialIdSFC = SFC<ISequentialIdProps> export function withIdFactory(factory: Function): SequentialIdSFC { return function SequentialId({ children }: ISequentialIdProps) { return children(factory()) } } const DefaultComponent: SequentialIdComponent = withIdFactory(uniqueid('i')) export default DefaultComponent
import { ReactElement, SFC, StatelessComponent } from 'react' import uniqueid from 'uniqueid' export interface ISequentialIdProps { children: (id: string) => ReactElement<any> | null } export type SequentialIdComponent = StatelessComponent<ISequentialIdProps> export type SequentialIdSFC = SFC<ISequentialIdProps> export function withIdFactory(factory: () => string): SequentialIdSFC { return function SequentialId({ children }: ISequentialIdProps) { return children(factory()) } } const DefaultComponent: SequentialIdComponent = withIdFactory(uniqueid('i')) export default DefaultComponent
Improve typing of factory function
Improve typing of factory function
TypeScript
mit
thirdhand/components,thirdhand/components
--- +++ @@ -8,7 +8,7 @@ export type SequentialIdComponent = StatelessComponent<ISequentialIdProps> export type SequentialIdSFC = SFC<ISequentialIdProps> -export function withIdFactory(factory: Function): SequentialIdSFC { +export function withIdFactory(factory: () => string): SequentialIdSFC { return function SequentialId({ children }: ISequentialIdProps) { return children(factory()) }
79346849f27a00934b0cee51f06e690d5883d069
src/dumb-cache.ts
src/dumb-cache.ts
"use strict"; import { EmberOperation, getHelp } from "./ember-ops"; export default class DumbCache { public generateChoices; public serveOperation: EmberOperation; public testServeOperation: EmberOperation; public preload(): Promise<any> { return this._preloadGenerateChoices(); } constructor(options = { preload: false}) { if (options.preload) { this.preload(); } } private _preloadGenerateChoices(): Promise<any> { return new Promise((resolve, reject) => { getHelp("generate").then((result) => { if (result && result.availableBlueprints) { this.generateChoices = result.availableBlueprints[0]["ember-cli"]; resolve(); } else { // Todo: Handle this reject(); } }); }); } }
"use strict"; import { EmberOperation, getHelp } from "./ember-ops"; export default class DumbCache { public generateChoices; public serveOperation: EmberOperation; public testServeOperation: EmberOperation; public preload(): Promise<any> { return this._preloadGenerateChoices(); } constructor(options = { preload: false}) { if (options.preload) { this.preload(); } } private _preloadGenerateChoices(): Promise<any> { return new Promise((resolve, reject) => { getHelp("generate").then((result) => { if (result && result.availableBlueprints) { this.generateChoices = result.availableBlueprints.reduce((allChoices, currentChoices) => { const newOptions = []; Object.keys(currentChoices).forEach((choiceSource) => { newOptions.push(...currentChoices[choiceSource]); }); return [...allChoices, ...newOptions]; }, []); resolve(); } else { // Todo: Handle this reject(); } }); }); } }
Fix blueprint generators and include all available blueprints
Fix blueprint generators and include all available blueprints
TypeScript
mit
felixrieseberg/vsc-ember-cli,t-sauer/vsc-ember-cli
--- +++ @@ -21,7 +21,14 @@ return new Promise((resolve, reject) => { getHelp("generate").then((result) => { if (result && result.availableBlueprints) { - this.generateChoices = result.availableBlueprints[0]["ember-cli"]; + this.generateChoices = result.availableBlueprints.reduce((allChoices, currentChoices) => { + const newOptions = []; + Object.keys(currentChoices).forEach((choiceSource) => { + newOptions.push(...currentChoices[choiceSource]); + }); + + return [...allChoices, ...newOptions]; + }, []); resolve(); } else { // Todo: Handle this
cffdbf8bd99471e86888d4c9974337d64c36d965
utils/server/staticGen.tsx
utils/server/staticGen.tsx
import { WEBPACK_OUTPUT_PATH } from 'serverSettings' import { ENV, WEBPACK_DEV_URL, BAKED_BASE_URL } from 'settings' import * as fs from 'fs-extra' import urljoin = require('url-join') import * as path from 'path' let manifest: {[key: string]: string} export function webpack(assetName: string, context?: string) { if (ENV === 'production') { // Read the real asset name from the manifest in case it has a hashed filename if (!manifest) { const manifestPath = path.join(WEBPACK_OUTPUT_PATH, 'manifest.json') manifest = JSON.parse(fs.readFileSync(manifestPath).toString('utf8')) } assetName = manifest[assetName] return urljoin('/assets', assetName) } else { if (assetName.match(/\.js$/)) { assetName = `js/${assetName}` } else if (assetName.match(/\.css$/)) { assetName = `css/${assetName}` } return urljoin(WEBPACK_DEV_URL, assetName) } }
import { WEBPACK_OUTPUT_PATH } from 'serverSettings' import { ENV, WEBPACK_DEV_URL, BAKED_BASE_URL } from 'settings' import * as fs from 'fs-extra' import urljoin = require('url-join') import * as path from 'path' let manifest: {[key: string]: string} export function webpack(assetName: string, context?: string) { if (ENV === 'production') { // Read the real asset name from the manifest in case it has a hashed filename if (!manifest) { const manifestPath = path.join(WEBPACK_OUTPUT_PATH, 'manifest.json') manifest = JSON.parse(fs.readFileSync(manifestPath).toString('utf8')) } assetName = manifest[assetName] return urljoin(BAKED_BASE_URL, '/assets', assetName) } else { if (assetName.match(/\.js$/)) { assetName = `js/${assetName}` } else if (assetName.match(/\.css$/)) { assetName = `css/${assetName}` } return urljoin(WEBPACK_DEV_URL, assetName) } }
Revert "fix: remove host from assets URL"
Revert "fix: remove host from assets URL" This reverts commit 563a0eb56f513262180a1db17eec1e56297ff717. It caused the SDG tracker to not load charts, as we use the native embeds there too.
TypeScript
mit
owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher
--- +++ @@ -14,7 +14,7 @@ } assetName = manifest[assetName] - return urljoin('/assets', assetName) + return urljoin(BAKED_BASE_URL, '/assets', assetName) } else { if (assetName.match(/\.js$/)) { assetName = `js/${assetName}`
f0b12a4fab3ea6818910b45feb112675432ba4b5
src/SyntaxNodes/NsflBlockNode.ts
src/SyntaxNodes/NsflBlockNode.ts
import { OutlineSyntaxNode } from './OutlineSyntaxNode' export class NsflBlockNode { OUTLINE_SYNTAX_NODE(): void { } constructor(public children: OutlineSyntaxNode[] = []) { } protected NSFL_BLOCK_NODE(): void { } }
import { RichOutlineSyntaxNode } from './RichOutlineSyntaxNode' export class NsflBlockNode extends RichOutlineSyntaxNode { protected NSFL_BLOCK_NODE(): void { } }
Use RichOutlineSyntaxNode for NSFL blocks
Use RichOutlineSyntaxNode for NSFL blocks
TypeScript
mit
start/up,start/up
--- +++ @@ -1,10 +1,6 @@ -import { OutlineSyntaxNode } from './OutlineSyntaxNode' +import { RichOutlineSyntaxNode } from './RichOutlineSyntaxNode' -export class NsflBlockNode { - OUTLINE_SYNTAX_NODE(): void { } - - constructor(public children: OutlineSyntaxNode[] = []) { } - +export class NsflBlockNode extends RichOutlineSyntaxNode { protected NSFL_BLOCK_NODE(): void { } }
a78575a6c0a496f9aa3ec406a0a6cf9bcf0df582
applications/mail/src/app/components/list/ItemStar.tsx
applications/mail/src/app/components/list/ItemStar.tsx
import React, { MouseEvent } from 'react'; import { Icon, useLoading, classnames } from 'react-components'; import { Element } from '../../models/element'; import { isMessage as testIsMessage, isStarred as testIsStarred } from '../../helpers/elements'; import { useStar } from '../../hooks/useApplyLabels'; interface Props { element?: Element; } const ItemStar = ({ element = {} }: Props) => { const [loading, withLoading] = useLoading(); const star = useStar(); const isMessage = testIsMessage(element); const isStarred = testIsStarred(element); const iconName = isStarred ? 'starfull' : 'star'; const handleClick = async (event: MouseEvent) => { event.stopPropagation(); withLoading(star(isMessage, [element.ID || ''], !isStarred)); }; return ( <button disabled={loading} type="button" className={classnames([ 'starbutton item-star inline-flex stop-propagation', isStarred && 'starbutton--is-starred' ])} onClick={handleClick} > <Icon name={iconName} /> </button> ); }; export default ItemStar;
import React, { MouseEvent } from 'react'; import { Icon, useLoading, classnames } from 'react-components'; import { Element } from '../../models/element'; import { isMessage as testIsMessage, isStarred as testIsStarred } from '../../helpers/elements'; import { useStar } from '../../hooks/useApplyLabels'; interface Props { element?: Element; } const ItemStar = ({ element = {} }: Props) => { const [loading, withLoading] = useLoading(); const star = useStar(); const isMessage = testIsMessage(element); const isStarred = testIsStarred(element); const iconName = isStarred ? 'starfull' : 'star'; const handleClick = async (event: MouseEvent) => { event.stopPropagation(); withLoading(star(isMessage, [element.ID || ''], !isStarred)); }; return ( <button disabled={loading} type="button" className={classnames([ 'starbutton relative item-star inline-flex stop-propagation', isStarred && 'starbutton--is-starred' ])} onClick={handleClick} > <Icon name={iconName} className="starbutton-icon-star" /> </button> ); }; export default ItemStar;
Fix - missing classes for layout/animation
Fix - missing classes for layout/animation
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -27,12 +27,12 @@ disabled={loading} type="button" className={classnames([ - 'starbutton item-star inline-flex stop-propagation', + 'starbutton relative item-star inline-flex stop-propagation', isStarred && 'starbutton--is-starred' ])} onClick={handleClick} > - <Icon name={iconName} /> + <Icon name={iconName} className="starbutton-icon-star" /> </button> ); };
585b006577e90fc8056c7b903e6c20ce523d2877
scripts/update-changelog.ts
scripts/update-changelog.ts
import * as fs from "fs" // Update the CHANGELOG with the new version const changelog = fs.readFileSync("CHANGELOG.md", "utf8") const newCHANGELOG = changelog.replace( "<!-- Your comment below this -->", `<!-- Your comment below this --> # ${process.env.VERSION} ` ) fs.writeFileSync("CHANGELOG.md", newCHANGELOG, "utf8")
// import * as fs from "fs" // // Update the CHANGELOG with the new version // const changelog = fs.readFileSync("CHANGELOG.md", "utf8") // const newCHANGELOG = changelog.replace( // "<!-- Your comment below this -->", // `<!-- Your comment below this --> // # ${process.env.VERSION} // ` // ) // fs.writeFileSync("CHANGELOG.md", newCHANGELOG, "utf8")
Remove the update changelog setp
Remove the update changelog setp
TypeScript
mit
danger/danger-js,danger/danger-js,danger/danger-js,danger/danger-js
--- +++ @@ -1,13 +1,13 @@ -import * as fs from "fs" +// import * as fs from "fs" -// Update the CHANGELOG with the new version +// // Update the CHANGELOG with the new version -const changelog = fs.readFileSync("CHANGELOG.md", "utf8") -const newCHANGELOG = changelog.replace( - "<!-- Your comment below this -->", - `<!-- Your comment below this --> +// const changelog = fs.readFileSync("CHANGELOG.md", "utf8") +// const newCHANGELOG = changelog.replace( +// "<!-- Your comment below this -->", +// `<!-- Your comment below this --> -# ${process.env.VERSION} -` -) -fs.writeFileSync("CHANGELOG.md", newCHANGELOG, "utf8") +// # ${process.env.VERSION} +// ` +// ) +// fs.writeFileSync("CHANGELOG.md", newCHANGELOG, "utf8")
7ba8c01e6613859740cedd9dbdd77909566e3f49
packages/utils/src/customisations/bool.ts
packages/utils/src/customisations/bool.ts
/** * Get boolean customisation value from attribute */ export function toBoolean( name: string, value: unknown, defaultValue: boolean ): boolean { switch (typeof value) { case 'boolean': return value; case 'number': return !!value; case 'string': switch (value.toLowerCase()) { case '1': case 'true': case name: return true; case '0': case 'false': case '': return false; } } return defaultValue; }
/** * Get boolean customisation value from attribute */ export function toBoolean( name: string, value: unknown, defaultValue: boolean ): boolean { switch (typeof value) { case 'boolean': return value; case 'number': return !!value; case 'string': switch (value.toLowerCase()) { case '1': case 'true': case name.toLowerCase(): return true; case '0': case 'false': case '': return false; } } return defaultValue; }
Fix attribute comparison in toBoolean in Utils
Fix attribute comparison in toBoolean in Utils
TypeScript
mit
simplesvg/simple-svg,simplesvg/simple-svg,simplesvg/simple-svg
--- +++ @@ -17,7 +17,7 @@ switch (value.toLowerCase()) { case '1': case 'true': - case name: + case name.toLowerCase(): return true; case '0':
522b64673f130eafc7bbc05b6850ba1c3dc01ec4
app/components/docedit/core/forms/type-relation/type-row.component.ts
app/components/docedit/core/forms/type-relation/type-row.component.ts
import {Component, EventEmitter, Input, OnChanges, Output} from '@angular/core'; import {FieldDocument} from 'idai-components-2'; import {ModelUtil} from '../../../../../core/model/model-util'; import {ReadImagestore} from '../../../../../core/images/imagestore/read-imagestore'; import {FieldReadDatastore} from '../../../../../core/datastore/field/field-read-datastore'; @Component({ moduleId: module.id, selector: 'dai-type-row', templateUrl: './type-row.html' }) /** * TODO show type foto on the left side * * @author Daniel de Oliveira */ export class TypeRowComponent implements OnChanges { public mainThumbnailUrl: string|undefined; @Input() document: FieldDocument; @Input() imageIds: string[]; @Output() onSelect: EventEmitter<void> = new EventEmitter<void>(); constructor(private imagestore: ReadImagestore) {} async ngOnChanges() { if (this.document) this.mainThumbnailUrl = await this.getMainThumbnailUrl(this.document); } private async getMainThumbnailUrl(document: FieldDocument): Promise<string|undefined> { const mainImageId: string | undefined = ModelUtil.getMainImageId(document); if (!mainImageId) return undefined; return await this.imagestore.read(mainImageId, false, true); } }
import {Component, EventEmitter, Input, OnChanges, Output} from '@angular/core'; import {FieldDocument} from 'idai-components-2'; import {ModelUtil} from '../../../../../core/model/model-util'; import {ReadImagestore} from '../../../../../core/images/imagestore/read-imagestore'; @Component({ moduleId: module.id, selector: 'dai-type-row', templateUrl: './type-row.html' }) /** * @author Daniel de Oliveira */ export class TypeRowComponent implements OnChanges { public mainThumbnailUrl: string|undefined; @Input() document: FieldDocument; @Input() imageIds: string[]; @Output() onSelect: EventEmitter<void> = new EventEmitter<void>(); constructor(private imagestore: ReadImagestore) {} async ngOnChanges() { if (this.document) this.mainThumbnailUrl = await this.getMainThumbnailUrl(this.document); } private async getMainThumbnailUrl(document: FieldDocument): Promise<string|undefined> { const mainImageId: string | undefined = ModelUtil.getMainImageId(document); if (!mainImageId) return undefined; return await this.imagestore.read(mainImageId, false, true); } }
Remove todo; remove unused import
Remove todo; remove unused import
TypeScript
apache-2.0
codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client
--- +++ @@ -2,7 +2,6 @@ import {FieldDocument} from 'idai-components-2'; import {ModelUtil} from '../../../../../core/model/model-util'; import {ReadImagestore} from '../../../../../core/images/imagestore/read-imagestore'; -import {FieldReadDatastore} from '../../../../../core/datastore/field/field-read-datastore'; @Component({ @@ -11,8 +10,6 @@ templateUrl: './type-row.html' }) /** - * TODO show type foto on the left side - * * @author Daniel de Oliveira */ export class TypeRowComponent implements OnChanges {
85d0aab054772c96192ac30ef37055b2cbb46bcc
app/src/lib/progress/fetch-progress-parser.ts
app/src/lib/progress/fetch-progress-parser.ts
import { StepProgressParser } from './step-progress' /** * Highly approximate (some would say outright inaccurate) division * of the individual progress reporting steps in a fetch operation */ const steps = [ { title: 'remote: Compressing objects', weight: 0.1 }, { title: 'Receiving objects', weight: 0.7 }, { title: 'Resolving deltas', weight: 0.2 }, ] /** * A utility class for interpreting the output from `git push --progress` * and turning that into a percentage value estimating the overall progress * of the clone. */ export class PushProgressParser extends StepProgressParser { public constructor() { super(steps) } }
import { StepProgressParser } from './step-progress' /** * Highly approximate (some would say outright inaccurate) division * of the individual progress reporting steps in a fetch operation */ const steps = [ { title: 'remote: Compressing objects', weight: 0.1 }, { title: 'Receiving objects', weight: 0.7 }, { title: 'Resolving deltas', weight: 0.2 }, ] /** * A utility class for interpreting the output from `git fetch --progress` * and turning that into a percentage value estimating the overall progress * of the fetch. */ export class FetchProgressParser extends StepProgressParser { public constructor() { super(steps) } }
Hide my copy paste sins
Hide my copy paste sins
TypeScript
mit
gengjiawen/desktop,desktop/desktop,shiftkey/desktop,say25/desktop,kactus-io/kactus,artivilla/desktop,BugTesterTest/desktops,kactus-io/kactus,hjobrien/desktop,BugTesterTest/desktops,j-f1/forked-desktop,shiftkey/desktop,desktop/desktop,BugTesterTest/desktops,artivilla/desktop,j-f1/forked-desktop,gengjiawen/desktop,desktop/desktop,BugTesterTest/desktops,j-f1/forked-desktop,artivilla/desktop,say25/desktop,shiftkey/desktop,hjobrien/desktop,gengjiawen/desktop,kactus-io/kactus,kactus-io/kactus,j-f1/forked-desktop,gengjiawen/desktop,say25/desktop,hjobrien/desktop,hjobrien/desktop,shiftkey/desktop,artivilla/desktop,say25/desktop,desktop/desktop
--- +++ @@ -11,11 +11,11 @@ ] /** - * A utility class for interpreting the output from `git push --progress` + * A utility class for interpreting the output from `git fetch --progress` * and turning that into a percentage value estimating the overall progress - * of the clone. + * of the fetch. */ -export class PushProgressParser extends StepProgressParser { +export class FetchProgressParser extends StepProgressParser { public constructor() { super(steps) }
264d4b45bd8b5f3d1c9aa8efef78abd45fbf3780
src/xml/transforms/enveloped_signature.ts
src/xml/transforms/enveloped_signature.ts
import { Select, XE, XmlError } from "xml-core"; import { Transform } from "../transform"; /** * Represents the enveloped signature transform for an XML digital signature as defined by the W3C. */ export class XmlDsigEnvelopedSignatureTransform extends Transform { public Algorithm = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"; /** * Returns the output of the current XmlDsigEnvelopedSignatureTransform object. * @returns string */ public GetOutput(): any { if (!this.innerXml) { throw new XmlError(XE.PARAM_REQUIRED, "innerXml"); } const signature = Select(this.innerXml, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']")[0]; if (signature) { signature.parentNode!.removeChild(signature); } return this.innerXml; } }
import { Select, XE, XmlError } from "xml-core"; import { Transform } from "../transform"; /** * Represents the enveloped signature transform for an XML digital signature as defined by the W3C. */ export class XmlDsigEnvelopedSignatureTransform extends Transform { public Algorithm = "http://www.w3.org/2000/09/xmldsig#enveloped-signature"; /** * Returns the output of the current XmlDsigEnvelopedSignatureTransform object. * @returns string */ public GetOutput(): any { if (!this.innerXml) { throw new XmlError(XE.PARAM_REQUIRED, "innerXml"); } const signatures = Select(this.innerXml, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']"); for (let i = 0; i < signatures.length; i++) { const signature = signatures[i]; if (signature.parentNode) { signature.parentNode.removeChild(signature); } } return this.innerXml; } }
Remove all Signature child nodes
Remove all Signature child nodes
TypeScript
mit
PeculiarVentures/xmldsigjs,PeculiarVentures/xmldsigjs
--- +++ @@ -18,9 +18,12 @@ throw new XmlError(XE.PARAM_REQUIRED, "innerXml"); } - const signature = Select(this.innerXml, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']")[0]; - if (signature) { - signature.parentNode!.removeChild(signature); + const signatures = Select(this.innerXml, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']"); + for (let i = 0; i < signatures.length; i++) { + const signature = signatures[i]; + if (signature.parentNode) { + signature.parentNode.removeChild(signature); + } } return this.innerXml; }
4fae8d4ca5ee2976af38fe6c07c5a9962d5afa90
frontend/src/pages/home/index.tsx
frontend/src/pages/home/index.tsx
import * as React from 'react'; import { Navbar } from 'components/navbar'; import { Button } from 'components/button'; import { Grid, Column } from 'components/grid'; import { Card } from 'components/card'; import { Hero } from 'components/hero'; import { Title, Subtitle } from 'components/typography'; export const HomePage = () => ( <div> <Navbar /> <Hero renderFooter={() => ( <React.Fragment> <Button>Get your Ticket</Button> <Button variant="secondary">Propose a talk</Button> </React.Fragment> )} > <Title>PyCon 10</Title> <Subtitle>Florence, XX XXXX 2019</Subtitle> <Subtitle level={2}>Location</Subtitle> </Hero> <div className="pitch"> <div> <h2>Perché la pycon</h2> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, reprehenderit labore, voluptatem officia velit rerum amet excepturi esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non laudantium, ipsam veniam? </p> </div> <div> <h2>Di cosa parleremo</h2> <h3>Data</h3> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, reprehenderit labore, voluptatem officia velit rerum amet excepturi esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non laudantium, ipsam veniam? </p> <h3>Web</h3> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, reprehenderit labore, voluptatem officia velit rerum amet excepturi esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non laudantium, ipsam veniam? </p> </div> </div> <div className="keynote-speakers"> <Grid> <Column cols={4}> <Card>Example</Card> <Card>Example</Card> </Column> <Column cols={4}> <Card>Example</Card> <Card>Example</Card> </Column> <Column cols={4}> <Card>Example</Card> <Card>Example</Card> </Column> </Grid> <Button variant="secondary">See the schedule</Button> </div> </div> );
import * as React from 'react'; import { Navbar } from 'components/navbar'; import { Button } from 'components/button'; import { Hero } from 'components/hero'; import { Title, Subtitle } from 'components/typography'; export const HomePage = () => ( <div> <Navbar /> <Hero renderFooter={() => ( <React.Fragment> <Button variant="secondary">Coming soon</Button> </React.Fragment> )} > <Title>PyCon 10</Title> <Subtitle>Florence, Italy</Subtitle> <Subtitle level={2}>May 2019</Subtitle> </Hero> </div> );
Make home page a landing page
Make home page a landing page
TypeScript
mit
patrick91/pycon,patrick91/pycon
--- +++ @@ -1,8 +1,6 @@ import * as React from 'react'; import { Navbar } from 'components/navbar'; import { Button } from 'components/button'; -import { Grid, Column } from 'components/grid'; -import { Card } from 'components/card'; import { Hero } from 'components/hero'; import { Title, Subtitle } from 'components/typography'; @@ -13,66 +11,13 @@ <Hero renderFooter={() => ( <React.Fragment> - <Button>Get your Ticket</Button> - <Button variant="secondary">Propose a talk</Button> + <Button variant="secondary">Coming soon</Button> </React.Fragment> )} > <Title>PyCon 10</Title> - <Subtitle>Florence, XX XXXX 2019</Subtitle> - <Subtitle level={2}>Location</Subtitle> + <Subtitle>Florence, Italy</Subtitle> + <Subtitle level={2}>May 2019</Subtitle> </Hero> - - <div className="pitch"> - <div> - <h2>Perché la pycon</h2> - - <p> - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, - reprehenderit labore, voluptatem officia velit rerum amet excepturi - esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non - laudantium, ipsam veniam? - </p> - </div> - - <div> - <h2>Di cosa parleremo</h2> - - <h3>Data</h3> - <p> - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, - reprehenderit labore, voluptatem officia velit rerum amet excepturi - esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non - laudantium, ipsam veniam? - </p> - - <h3>Web</h3> - <p> - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt, - reprehenderit labore, voluptatem officia velit rerum amet excepturi - esse, sit ea harum! Aspernatur, earum. Dolor sed commodi non - laudantium, ipsam veniam? - </p> - </div> - </div> - - <div className="keynote-speakers"> - <Grid> - <Column cols={4}> - <Card>Example</Card> - <Card>Example</Card> - </Column> - <Column cols={4}> - <Card>Example</Card> - <Card>Example</Card> - </Column> - <Column cols={4}> - <Card>Example</Card> - <Card>Example</Card> - </Column> - </Grid> - - <Button variant="secondary">See the schedule</Button> - </div> </div> );
a18f33ac913ad93e9d6a47415f02d8f8381bbb2e
src/components/hero-selector.component.ts
src/components/hero-selector.component.ts
import { Component, Input, Output, EventEmitter } from '@angular/core'; import { HeroesService, IHero } from '../services/heroes.service'; @Component({ selector: 'hero-selector', template: ` <div class="modal" [class.is-active]="active"> <div class="modal-background"></div> <div class="modal-container"> <div class="modal-content"> <div class="hero-selector"> <hero-portrait *ngFor="let hero of heroes" (click)="heroClicked(hero)" class="hero" [hero]="hero" [small]="true"> </hero-portrait> </div> </div> </div> <button class="modal-close" (click)="close()"></button> </div> `, styles: [` .hero-selector { display: flex; flex-wrap: wrap; justify-content: center; } .modal-content { margin: 0; } `], providers: [HeroesService], }) export class HeroSelectorComponent { private heroes: IHero[]; @Input() private active: boolean; @Output() private heroSelected = new EventEmitter<IHero>(); @Output() private closeClicked = new EventEmitter(); constructor(private heroesService: HeroesService) { this.heroes = heroesService.AllHeroes; } private heroClicked(hero: IHero) { this.heroSelected.emit(hero); } private close() { this.closeClicked.emit(); } }
import { Component, Input, Output, EventEmitter } from '@angular/core'; import { HeroesService, IHero } from '../services/heroes.service'; @Component({ selector: 'hero-selector', template: ` <div class="modal" [class.is-active]="active"> <div class="modal-background"></div> <div class="modal-container"> <div class="modal-content"> <div class="hero-selector"> <hero-portrait *ngFor="let hero of heroes" (click)="heroClicked(hero)" class="hero" [hero]="hero" [small]="true"> </hero-portrait> </div> </div> </div> <button class="modal-close" (click)="close()"></button> </div> `, styles: [` .hero-selector { display: flex; flex-wrap: wrap; justify-content: center; } .modal-content { max-height: calc(100vh - 100px); margin: 0; } `], providers: [HeroesService], }) export class HeroSelectorComponent { private heroes: IHero[]; @Input() private active: boolean; @Output() private heroSelected = new EventEmitter<IHero>(); @Output() private closeClicked = new EventEmitter(); constructor(private heroesService: HeroesService) { this.heroes = heroesService.AllHeroes; } private heroClicked(hero: IHero) { this.heroSelected.emit(hero); } private close() { this.closeClicked.emit(); } }
Expand hero selector view to more height
Expand hero selector view to more height
TypeScript
mit
Overcomplicated/website,Overcomplicated/website,Overcomplicated/website,Overcomplicated/website
--- +++ @@ -32,6 +32,7 @@ } .modal-content { + max-height: calc(100vh - 100px); margin: 0; } `],
3ccabc7ffe7d6beb14c1c33c051aa91102a7a73a
src/shared/constants.ts
src/shared/constants.ts
/* |-------------------------------------------------------------------------- | supported Formats |-------------------------------------------------------------------------- */ export const SUPPORTED_TRACKS_EXTENSIONS = [ // MP3 / MP4 '.mp3', '.mp4', '.aac', '.m4a', '.3gp', '.wav', // Opus '.ogg', '.ogv', '.ogm', '.opus', // Flac '.flac', ]; export const SUPPORTED_PLAYLISTS_EXTENSIONS = ['.m3u'];
/* |-------------------------------------------------------------------------- | supported Formats |-------------------------------------------------------------------------- */ export const SUPPORTED_TRACKS_EXTENSIONS = [ // MP3 / MP4 '.mp3', '.mp4', '.aac', '.m4a', '.3gp', '.wav', // Opus '.ogg', '.ogv', '.ogm', '.opus', // Flac '.flac', // web media '.webm', ]; export const SUPPORTED_PLAYLISTS_EXTENSIONS = ['.m3u'];
Update webm in supported extensions
Update webm in supported extensions
TypeScript
mit
KeitIG/museeks,KeitIG/museeks,KeitIG/museeks
--- +++ @@ -19,6 +19,8 @@ '.opus', // Flac '.flac', + // web media + '.webm', ]; export const SUPPORTED_PLAYLISTS_EXTENSIONS = ['.m3u'];
c7804cba05b6533f49677493a81499767eb74da8
src/tasks/UploadTask.ts
src/tasks/UploadTask.ts
import {SCRIPT_DIR, TEMPLATES_DIR} from "./Task"; import {DeployTask} from "./DeployTask"; import {Config} from "../config"; import {Session, SessionResult, executeScript, copy} from "../Session"; const fs = require('fs'); const path = require('path'); const util = require('util'); export class UploadTask extends DeployTask { protected srcPath : string; protected destPath : string; protected progress : boolean; constructor(config : Config, srcPath : string, destPath : string, progress : boolean = false) { super(config); this.srcPath = srcPath; this.destPath = destPath; this.progress = progress; } public describe() : string { return 'Uploading ' + this.srcPath + ' to ' + this.destPath; } public run(session : Session) : Promise<SessionResult> { return copy(session, this.srcPath, this.destPath, { 'progressBar': this.progress, 'vars': this.extendArgs({ }) }); } }
import {SCRIPT_DIR, TEMPLATES_DIR} from "./Task"; import {DeployTask} from "./DeployTask"; import {Config} from "../config"; import {Session, SessionResult, executeScript, copy} from "../Session"; const fs = require('fs'); const path = require('path'); const util = require('util'); export class UploadTask extends DeployTask { protected srcPath : string; protected destPath : string; protected progress : boolean; constructor(config : Config, srcPath : string, destPath : string, progress : boolean = false) { super(config); this.srcPath = srcPath; this.destPath = destPath; this.progress = progress; } public describe() : string { return 'Uploading ' + this.srcPath + ' to ' + this.destPath; } public run(session : Session) : Promise<SessionResult> { return copy(session, this.srcPath, this.destPath, { 'progressBar': this.progress }); } }
Fix upload task (vars enables the ejs compilation)
Fix upload task (vars enables the ejs compilation)
TypeScript
mit
c9s/typeloy,c9s/typeloy
--- +++ @@ -30,9 +30,6 @@ public run(session : Session) : Promise<SessionResult> { return copy(session, this.srcPath, - this.destPath, { - 'progressBar': this.progress, - 'vars': this.extendArgs({ }) - }); + this.destPath, { 'progressBar': this.progress }); } }
4462342e1f76f5c46ca3279a44ebb812f5939f08
bt/lib/events.ts
bt/lib/events.ts
/** * @class EventEmitter * @description Very basic events support with listeners. */ export class EventEmitter { private listeners : { [s:string]: Function[] } = {}; constructor(names: string[]) { names.forEach((n:string) => this.listeners[n] = []); } /** * Start listening to an event. * @method EventEmitter#on * @param {string} name [event name] * @param {Function} f [callback function] */ on(name: string, f: Function) { this.listeners[name].push(f); } emit(name: string, thisArg: any, ...args) { this.listeners[name].forEach((l) => l.apply(thisArg, args)); } emitAsync(name: string, thisArg: any, ...args) { setTimeout(() => { this.listeners[name].forEach((l) => l.apply(thisArg, args)); }, 0); } }
/** * @class EventEmitter * @description Very basic events support with listeners. */ export class EventEmitter { private listeners : { [s:string]: Function[] } = {}; constructor(names: string[], private forwardTo: EventEmitter = null) { names.forEach((n:string) => this.listeners[n] = []); } /** * Start listening to an event. * @method EventEmitter#on * @param {string} name [event name] * @param {Function} f [callback function] */ on(name: string, f: Function) { this.listeners[name].push(f); } emit(name: string, thisArg: any, ...args) { this.listeners[name].forEach((l) => l.apply(thisArg, args)); if (this.forwardTo !== null) { this.forwardTo.emit(name, thisArg, ...args); } } emitAsync(name: string, thisArg: any, ...args) { setTimeout(() => { this.listeners[name].forEach((l) => l.apply(thisArg, args)); }, 0); if (this.forwardTo !== null) { this.forwardTo.emitAsync(name, thisArg, ...args); } } }
Add forwarding capabilities to event emitters.
Add forwarding capabilities to event emitters.
TypeScript
mit
yourpalal/backtalk,yourpalal/backtalk
--- +++ @@ -6,7 +6,7 @@ export class EventEmitter { private listeners : { [s:string]: Function[] } = {}; - constructor(names: string[]) { + constructor(names: string[], private forwardTo: EventEmitter = null) { names.forEach((n:string) => this.listeners[n] = []); } @@ -22,11 +22,18 @@ emit(name: string, thisArg: any, ...args) { this.listeners[name].forEach((l) => l.apply(thisArg, args)); + if (this.forwardTo !== null) { + this.forwardTo.emit(name, thisArg, ...args); + } } emitAsync(name: string, thisArg: any, ...args) { setTimeout(() => { this.listeners[name].forEach((l) => l.apply(thisArg, args)); }, 0); + + if (this.forwardTo !== null) { + this.forwardTo.emitAsync(name, thisArg, ...args); + } } }
30bee8eca5570ca6103701fa67941434050dd2fa
test/user-list-item-spec.ts
test/user-list-item-spec.ts
import { expect } from './support'; import { createMockStore } from './lib/mock-store'; import { Store } from '../src/lib/store'; import { User, Profile } from '../src/lib/models/api-shapes'; import { UserViewModel } from '../src/user-list-item'; const storeData: { [key: string]: User } = { jamesFranco: { id: 'jamesFranco', name: 'franco', real_name: 'James Franco', profile: { image_72: 'http://screencomment.com/site/wp-content/uploads/2010/05/james_franco.jpg' } as Profile } as User }; describe('the UserViewModel', () => { let store: Store, userKey: string, fixture: UserViewModel; beforeEach(() => { store = createMockStore(storeData); userKey = Object.keys(storeData)[0]; fixture = new UserViewModel(store, userKey, null); }); it('should use a default profile image until it retrieves the user', async () => { expect(fixture.profileImage.match(/default-avatar/)).to.be.ok; await fixture.changed.take(1).toPromise(); expect(fixture.profileImage.match(/james_franco/)).to.be.ok; }); });
import { expect } from './support'; import { MockStore } from './lib/mock-store'; import { Store } from '../src/lib/store'; import { User, Profile } from '../src/lib/models/api-shapes'; import { UserViewModel } from '../src/user-list-item'; const users: { [key: string]: User } = { jamesFranco: { id: 'jamesFranco', name: 'franco', real_name: 'James Franco', profile: { image_72: 'http://screencomment.com/site/wp-content/uploads/2010/05/james_franco.jpg' } as Profile } as User }; describe('the UserViewModel', () => { let store: Store, fixture: UserViewModel; beforeEach(() => { const userKey = Object.keys(users)[0]; store = new MockStore({ users }); fixture = new UserViewModel(store, userKey, null); }); it('should use a default profile image until it retrieves the user', async () => { expect(fixture.profileImage.match(/default-avatar/)).to.be.ok; await fixture.changed.take(1).toPromise(); expect(fixture.profileImage.match(/james_franco/)).to.be.ok; }); });
Fix the UserViewModel spec afterward.
Fix the UserViewModel spec afterward.
TypeScript
bsd-3-clause
paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline
--- +++ @@ -1,10 +1,10 @@ import { expect } from './support'; -import { createMockStore } from './lib/mock-store'; +import { MockStore } from './lib/mock-store'; import { Store } from '../src/lib/store'; import { User, Profile } from '../src/lib/models/api-shapes'; import { UserViewModel } from '../src/user-list-item'; -const storeData: { [key: string]: User } = { +const users: { [key: string]: User } = { jamesFranco: { id: 'jamesFranco', name: 'franco', @@ -16,11 +16,11 @@ }; describe('the UserViewModel', () => { - let store: Store, userKey: string, fixture: UserViewModel; + let store: Store, fixture: UserViewModel; beforeEach(() => { - store = createMockStore(storeData); - userKey = Object.keys(storeData)[0]; + const userKey = Object.keys(users)[0]; + store = new MockStore({ users }); fixture = new UserViewModel(store, userKey, null); });
18c6976fbb5b378aa15a99a2b8f753ec6250ff3b
openwhisk/compiler/src/actions.ts
openwhisk/compiler/src/actions.ts
export const config = () => { const path = require('path') const qcertDir = path.resolve(__dirname, '..', '..', '..', '..') const deployConfig = { packages: { qcert: { actions: { qcert: { location: path.resolve(qcertDir, 'bin', 'qcertJS.js'), annotations: { 'web-export': true } } } } } } return deployConfig }
export const config = () => { const path = require('path') const qcertDir = path.resolve(__dirname, '..', '..', '..', '..') const deployConfig = { packages: { qcert: { actions: { qcertCompile: { location: path.resolve(qcertDir, 'bin', 'qcertJS.js') }, qcert: { sequence: "qcert/preCompile,qcert/qcertCompile", annotations: { 'web-export': true } } } } } } return deployConfig }
Insert support for two-action sequence.
Insert support for two-action sequence. The Java action is still deployed separately
TypeScript
apache-2.0
querycert/qcert,querycert/qcert,querycert/qcert,querycert/qcert,querycert/qcert
--- +++ @@ -8,8 +8,11 @@ packages: { qcert: { actions: { - qcert: { - location: path.resolve(qcertDir, 'bin', 'qcertJS.js'), + qcertCompile: { + location: path.resolve(qcertDir, 'bin', 'qcertJS.js') + }, + qcert: { + sequence: "qcert/preCompile,qcert/qcertCompile", annotations: { 'web-export': true }
a06262ea331d8035c269f088e964e8ad1912f9b0
src/util/index.ts
src/util/index.ts
export * from './logger'; export * from './security'; export * from './texts';
export * from './logger'; export * from './security'; export * from './texts'; export * from './events';
Add Events to the util exports
Add Events to the util exports
TypeScript
mit
ibrahimduran/node-kaptan
--- +++ @@ -1,3 +1,4 @@ export * from './logger'; export * from './security'; export * from './texts'; +export * from './events';
6e3c9a91b62fe504847eed40f92157fb7fa87069
mehuge/mehuge-events.ts
mehuge/mehuge-events.ts
module MehugeEvents { var subscribers: any = {}; var listener; /* export function sub(topic: string, handler: (data: any) => void) { var subs = subscribers[topic] = subscribers[topic] || { listeners: [] }; subs.listeners.push({ listener: handler }); // first handler for any topic? Register event handler if (!listener) { cuAPI.OnEvent(listener = function (topic: string, data: any) { var listeners = subscribers[topic].listeners, parsedData; try { parsedData = JSON.parse(data); } catch (e) { parsedData = data; } for (var i = 0; i < listeners.length; i++) { if (listeners[i].listener) { listeners[i].listener(event, parsedData); } } }); } // first handler for this topic, ask client to send these events if (subs.handlers.length === 1) { cuAPI.Listen(topic); } } export function pub(topic: string, data: any) { cuAPI.Fire(topic, JSON.stringify(data)); } */ }
/// <reference path="../cu/cu.ts" /> module MehugeEvents { var subscribers: any = {}; var listener; export function sub(topic: string, handler: (...data: any[]) => void) { var subs = subscribers[topic] = subscribers[topic] || { listeners: [] }; subs.listeners.push({ listener: handler }); // first handler for any topic? Register event handler if (!listener) { cuAPI.OnEvent(listener = function (topic: string, ...data: any[]) { var listeners = subscribers[topic].listeners, parsedData; for (var i = 0; i < listeners.length; i++) { if (listeners[i].listener) { listeners[i].listener(event, data); } } }); } // first handler for this topic, ask client to send these events if (subs.handlers.length === 1) { cuAPI.Listen(topic); } } export function unsub(topic: string) { cuAPI.Ignore(topic); } export function pub(topic: string, ...data: any[]) { cuAPI.Fire(topic, data); } }
Update pub/sub/unsub based on actual events API
Update pub/sub/unsub based on actual events API
TypeScript
mpl-2.0
Mehuge/cu-ui-legacy,Mehuge/cu-ui-legacy,Mehuge/cu-ui-legacy,Mehuge/cu-ui-legacy,Mehuge/cu-ui-legacy
--- +++ @@ -1,23 +1,19 @@ -module MehugeEvents { +/// <reference path="../cu/cu.ts" /> +module MehugeEvents { var subscribers: any = {}; var listener; -/* - export function sub(topic: string, handler: (data: any) => void) { + + export function sub(topic: string, handler: (...data: any[]) => void) { var subs = subscribers[topic] = subscribers[topic] || { listeners: [] }; subs.listeners.push({ listener: handler }); // first handler for any topic? Register event handler if (!listener) { - cuAPI.OnEvent(listener = function (topic: string, data: any) { + cuAPI.OnEvent(listener = function (topic: string, ...data: any[]) { var listeners = subscribers[topic].listeners, parsedData; - try { - parsedData = JSON.parse(data); - } catch (e) { - parsedData = data; - } for (var i = 0; i < listeners.length; i++) { if (listeners[i].listener) { - listeners[i].listener(event, parsedData); + listeners[i].listener(event, data); } } }); @@ -29,8 +25,11 @@ } } - export function pub(topic: string, data: any) { - cuAPI.Fire(topic, JSON.stringify(data)); + export function unsub(topic: string) { + cuAPI.Ignore(topic); } -*/ + + export function pub(topic: string, ...data: any[]) { + cuAPI.Fire(topic, data); + } }
13c5bb181c4ff24620c5a38253f64e279491e1bf
src/main.ts
src/main.ts
import { HtmlDestroyer } from "./html-destroyer"; var htmlDestroyer:HtmlDestroyer = new HtmlDestroyer(); chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { if (request == "destroyH") { destroyH(); sendResponse("destroyH"); } else if (request == "destroyImg") { destroyH(); sendResponse("destroyImg"); } }); function destroyH() { $(document).ready(function() { $("h1,h2,h3,h4,h5,h6").each(function() { var element = $(this); var destroyElement = function() { htmlDestroyer.destroyH(element); $(window).trigger("resize"); setTimeout(destroyElement, Math.random() * 100 + 50); }; destroyElement(); }); }); } function destroyImg() { $(document).ready(function() { $("img").each(function() { var element = $(this); var destroyElement = function() { htmlDestroyer.destroyImg(element); $(window).trigger("resize"); }; var intervalId = setInterval(destroyElement, 200); }); }); }
import { HtmlDestroyer } from "./html-destroyer"; var htmlDestroyer:HtmlDestroyer = new HtmlDestroyer(); chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { if (request == "destroyH") { destroyH(); sendResponse("destroyH"); } else if (request == "destroyImg") { destroyImg(); sendResponse("destroyImg"); } }); function destroyH() { $(document).ready(function() { $("h1,h2,h3,h4,h5,h6").each(function() { var element = $(this); var destroyElement = function() { htmlDestroyer.destroyH(element); $(window).trigger("resize"); setTimeout(destroyElement, Math.random() * 100 + 50); }; destroyElement(); }); }); } function destroyImg() { $(document).ready(function() { $("img").each(function() { var element = $(this); flipAttributesCycle(element, "src", "data-src") }); }); } function destroyHopeOfBeingAnOnlyChild() { const onlyChildPs = $('p').filter(function () { return ($(this).siblings('p').length > 0); }); } function destroyChangesOfNeverGettingType2Diabetes() { } function flipAttributesCycle(element:JQuery, attributeFrom:string, attributeTo:string) { element.attr(attributeTo, element.attr(attributeFrom)); element.attr(attributeFrom, ""); $(window).trigger("resize"); setTimeout(function(){ flipAttributesCycle(element, attributeTo, attributeFrom); }, Math.random() * 200 + 50); }
Destroy Img breaks and fixes the img source
Destroy Img breaks and fixes the img source
TypeScript
mit
epiphanysearch/Html-destroyer,epiphanysearch/Html-destroyer,epiphanysearch/Html-destroyer
--- +++ @@ -11,7 +11,7 @@ } else if (request == "destroyImg") { - destroyH(); + destroyImg(); sendResponse("destroyImg"); } }); @@ -34,11 +34,28 @@ $(document).ready(function() { $("img").each(function() { var element = $(this); - var destroyElement = function() { - htmlDestroyer.destroyImg(element); - $(window).trigger("resize"); - }; - var intervalId = setInterval(destroyElement, 200); + flipAttributesCycle(element, "src", "data-src") }); }); } + +function destroyHopeOfBeingAnOnlyChild() { + const onlyChildPs = $('p').filter(function () { + return ($(this).siblings('p').length > 0); + }); + + +} + +function destroyChangesOfNeverGettingType2Diabetes() { + +} + +function flipAttributesCycle(element:JQuery, attributeFrom:string, attributeTo:string) { + element.attr(attributeTo, element.attr(attributeFrom)); + element.attr(attributeFrom, ""); + $(window).trigger("resize"); + setTimeout(function(){ + flipAttributesCycle(element, attributeTo, attributeFrom); + }, Math.random() * 200 + 50); +}
a0b61fcf9bd6df2de1491162b514dba8afd9803d
tst/main.ts
tst/main.ts
/// <reference path="../src/amd.ts" /> declare const global: any, require: any; const assert = require('assert'); global.require(['tst/fizz'], (fizz: any) => assert.strictEqual(fizz.buzz(), 5));
/// <reference path="../src/amd.ts" /> declare const global: any, require: any; const assert = require('assert'); // Test variants of modules emitted by tsc global.require(['tst/fizz'], (fizz: any) => assert.strictEqual(fizz.buzz(), 5)); // Test mixed sequence of inter-dependent modules global.define('a', [], () => 2) global.require(['b', 'c', 'a'], (b: any, c: any, a: any) => assert.strictEqual(b + c.a + a, 10)); global.define('b', ['c'], (c: any) => c.a + 2); global.define('c', ['a'], (a: any) => ({ a: 1 + a })); global.require(['a', 'd'], (a: any, d: any) => assert.strictEqual(a + d.z, 10)); global.define('d', ['e'], (e: any) => ({ z: 4 + e })); global.define('e', ['a'], (a: any) => 2 + a);
Add tests covering mixed sequence of define/require
Add tests covering mixed sequence of define/require
TypeScript
mit
federico-lox/AMD.ts,federico-lox/AMD.ts
--- +++ @@ -5,4 +5,14 @@ const assert = require('assert'); +// Test variants of modules emitted by tsc global.require(['tst/fizz'], (fizz: any) => assert.strictEqual(fizz.buzz(), 5)); + +// Test mixed sequence of inter-dependent modules +global.define('a', [], () => 2) +global.require(['b', 'c', 'a'], (b: any, c: any, a: any) => assert.strictEqual(b + c.a + a, 10)); +global.define('b', ['c'], (c: any) => c.a + 2); +global.define('c', ['a'], (a: any) => ({ a: 1 + a })); +global.require(['a', 'd'], (a: any, d: any) => assert.strictEqual(a + d.z, 10)); +global.define('d', ['e'], (e: any) => ({ z: 4 + e })); +global.define('e', ['a'], (a: any) => 2 + a);
7c1f198f20163bf598f30d774c0ecfc0b7f8c66e
src/util.ts
src/util.ts
import axios from 'axios'; import { createWriteStream } from 'fs'; import * as cp from 'child_process'; export async function download(from: string, to: string) { const { data } = await axios({ method: 'get', url: from, responseType:'stream', }); return new Promise((resolve, reject) => { data.pipe(createWriteStream(to)); data.on('end', resolve); data.on('error', reject); }); } export function exec(command: string): Promise<string> { return new Promise(( resolve: (result: string) => void, reject, ) => { cp.exec(command, (err, stdout) => { if (err) { reject(err); } else { resolve(stdout); } }); }); } export function rm(file: string) { return exec(`rm ${file}`); }
import axios from 'axios'; import { createWriteStream } from 'fs'; import * as cp from 'child_process'; export async function download(from: string, to: string) { const { data } = await axios({ method: 'get', url: from, responseType:'stream', }); return new Promise((resolve, reject) => { const writable = createWriteStream(to); data.pipe(writable); writable.on('close', resolve); writable.on('error', reject); }); } export function exec(command: string): Promise<string> { return new Promise(( resolve: (result: string) => void, reject, ) => { cp.exec(command, (err, stdout) => { if (err) { reject(err); } else { resolve(stdout); } }); }); } export function rm(file: string) { return exec(`rm ${file}`); }
Fix timing when download is really finished
Fix timing when download is really finished
TypeScript
mit
team-kke/sonoda-san
--- +++ @@ -10,9 +10,10 @@ }); return new Promise((resolve, reject) => { - data.pipe(createWriteStream(to)); - data.on('end', resolve); - data.on('error', reject); + const writable = createWriteStream(to); + data.pipe(writable); + writable.on('close', resolve); + writable.on('error', reject); }); }
747cbbb55c52a9332ff1f57b5ca6dcbf5888217a
test/GherkinLineTest.ts
test/GherkinLineTest.ts
import * as assert from 'assert' import GherkinLine from '../src/GherkinLine' describe('GherkinLine', () => { describe('#getTableCells', () => { function getCellsText(line: string) { const gl = new GherkinLine(line, 1) return gl.getTableCells().map((span) => span.text) } it('trims white spaces before cell content', () => { assert.deepStrictEqual(getCellsText('| \t spaces before|'), ['spaces before']) }) it('trims white spaces after cell content', () => { assert.deepStrictEqual(getCellsText('|spaces after |'), ['spaces after']) }) it('trims white spaces around cell content', () => { assert.deepStrictEqual(getCellsText('| \t spaces everywhere \t|'), ['spaces everywhere']) }) it('does not delete white spaces inside a cell', () => { assert.deepStrictEqual(getCellsText('| foo()\n bar\nbaz |'), ['foo()\n bar\nbaz']) }) }) })
import * as assert from 'assert' import GherkinLine from '../src/GherkinLine' describe('GherkinLine', () => { describe('#getTags', () => { function getTags(line: string) { const gl = new GherkinLine(line, 1) return gl.getTags().map((span) => span.text) } it('allows any non-space characters in a tag', () => { assert.deepStrictEqual(getTags(' @foo:bar @zap🥒yo'), ['@foo:bar', '@zap🥒yo']) }) }) describe('#getTableCells', () => { function getCellsText(line: string) { const gl = new GherkinLine(line, 1) return gl.getTableCells().map((span) => span.text) } it('trims white spaces before cell content', () => { assert.deepStrictEqual(getCellsText('| \t spaces before|'), ['spaces before']) }) it('trims white spaces after cell content', () => { assert.deepStrictEqual(getCellsText('|spaces after |'), ['spaces after']) }) it('trims white spaces around cell content', () => { assert.deepStrictEqual(getCellsText('| \t spaces everywhere \t|'), ['spaces everywhere']) }) it('does not delete white spaces inside a cell', () => { assert.deepStrictEqual(getCellsText('| foo()\n bar\nbaz |'), ['foo()\n bar\nbaz']) }) }) })
Add a couple of unit tests to verify that tags work with any non-space character
Add a couple of unit tests to verify that tags work with any non-space character
TypeScript
mit
cucumber/gherkin-javascript,cucumber/gherkin-javascript
--- +++ @@ -2,6 +2,19 @@ import GherkinLine from '../src/GherkinLine' describe('GherkinLine', () => { + describe('#getTags', () => { + function getTags(line: string) { + const gl = new GherkinLine(line, 1) + + return gl.getTags().map((span) => span.text) + } + + it('allows any non-space characters in a tag', () => { + assert.deepStrictEqual(getTags(' @foo:bar @zap🥒yo'), ['@foo:bar', '@zap🥒yo']) + }) + + }) + describe('#getTableCells', () => { function getCellsText(line: string) { const gl = new GherkinLine(line, 1)
cbb5a7829508fb202873a99ac263101111c74e5a
src/app/core/core.module.spec.ts
src/app/core/core.module.spec.ts
import { TestBed } from '@angular/core/testing'; import { CoreModule } from './core.module'; describe('CoreModule', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ CoreModule, ], }); }); it('throws an error if imported more than once', (done) => { try { new CoreModule(TestBed.get(CoreModule)); } catch (err) { done(); } }); });
import { TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from './core.module'; describe('CoreModule', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ CoreModule, RouterTestingModule, ], }); }); it('throws an error if imported more than once', (done) => { try { new CoreModule(TestBed.get(CoreModule)); } catch (err) { expect(err.message).toContain('already'); done(); } }); });
Fix test setup for CoreModule
Fix test setup for CoreModule It turns out that double-import rejection was not tested because TestBed was missing the Router provider (RouterTestingModule). With this change, the import test works as intended (and we now also check the error message).
TypeScript
bsd-3-clause
cumulous/web,cumulous/web,cumulous/web,cumulous/web
--- +++ @@ -1,4 +1,5 @@ import { TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; import { CoreModule } from './core.module'; @@ -7,6 +8,7 @@ TestBed.configureTestingModule({ imports: [ CoreModule, + RouterTestingModule, ], }); }); @@ -15,6 +17,7 @@ try { new CoreModule(TestBed.get(CoreModule)); } catch (err) { + expect(err.message).toContain('already'); done(); } });
30d9b9cdbcd0b474e3953c3fed6b8e247c34ce34
scripts/Actions/Like.ts
scripts/Actions/Like.ts
import { AnimeNotifier } from "../AnimeNotifier" // like export function like(arn: AnimeNotifier, element: HTMLElement) { let apiEndpoint = arn.findAPIEndpoint(element) arn.post(apiEndpoint + "/like", null) .then(() => arn.reloadContent()) .catch(err => arn.statusMessage.showError(err)) } // unlike export function unlike(arn: AnimeNotifier, element: HTMLElement) { let apiEndpoint = arn.findAPIEndpoint(element) arn.post(apiEndpoint + "/unlike", null) .then(() => arn.reloadContent()) .catch(err => arn.statusMessage.showError(err)) }
import { AnimeNotifier } from "../AnimeNotifier" // like export async function like(arn: AnimeNotifier, element: HTMLElement) { arn.statusMessage.showInfo("Liked!") let apiEndpoint = arn.findAPIEndpoint(element) await arn.post(apiEndpoint + "/like", null).catch(err => arn.statusMessage.showError(err)) arn.reloadContent() } // unlike export async function unlike(arn: AnimeNotifier, element: HTMLElement) { arn.statusMessage.showInfo("Disliked!") let apiEndpoint = arn.findAPIEndpoint(element) await arn.post(apiEndpoint + "/unlike", null).catch(err => arn.statusMessage.showError(err)) arn.reloadContent() }
Add status message when liking stuff
Add status message when liking stuff
TypeScript
mit
animenotifier/notify.moe,animenotifier/notify.moe,animenotifier/notify.moe
--- +++ @@ -1,19 +1,19 @@ import { AnimeNotifier } from "../AnimeNotifier" // like -export function like(arn: AnimeNotifier, element: HTMLElement) { +export async function like(arn: AnimeNotifier, element: HTMLElement) { + arn.statusMessage.showInfo("Liked!") + let apiEndpoint = arn.findAPIEndpoint(element) - - arn.post(apiEndpoint + "/like", null) - .then(() => arn.reloadContent()) - .catch(err => arn.statusMessage.showError(err)) + await arn.post(apiEndpoint + "/like", null).catch(err => arn.statusMessage.showError(err)) + arn.reloadContent() } // unlike -export function unlike(arn: AnimeNotifier, element: HTMLElement) { +export async function unlike(arn: AnimeNotifier, element: HTMLElement) { + arn.statusMessage.showInfo("Disliked!") + let apiEndpoint = arn.findAPIEndpoint(element) - - arn.post(apiEndpoint + "/unlike", null) - .then(() => arn.reloadContent()) - .catch(err => arn.statusMessage.showError(err)) + await arn.post(apiEndpoint + "/unlike", null).catch(err => arn.statusMessage.showError(err)) + arn.reloadContent() }
3f66453b33f58337757f13d8b2f090986483bf5f
src/maas.ts
src/maas.ts
import * as express from "express"; import * as bodyParser from "body-parser"; import * as http from "http"; import * as helmet from "helmet"; import ConfigurationChooser from "./config/index"; import Configuration from "./config/configuration"; import * as routes from "./routes/routerFacade"; // Initializing app let app : express.Express = express(); let configuration : Configuration = ConfigurationChooser.getConfig(); // Allow to get data from body in JSON format app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.json()); // Set helmet for security checks app.use(helmet()); app.use(function (req : express.Request, res : express.Response, next : express.NextFunction) : void { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); // Routes' require /* app.use("/api", routes); */ // Starting the server app.set("port", process.env.PORT || 3000); let server : http.Server = app.listen(app.get("port"), function () : void { console.log("Express server is listening on port " + server.address().port + " in " + configuration.getEnvName() + " environment."); });
import * as express from "express"; import * as bodyParser from "body-parser"; import * as http from "http"; import * as helmet from "helmet"; import ConfigurationChooser from "./config/index"; import Configuration from "./config/configuration"; import * as routes from "./routes/routerFacade"; // Initializing app let app : express.Express = express(); let configuration : Configuration = ConfigurationChooser.getConfig(); // Allow to get data from body in JSON format app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.json()); // Set helmet for security checks app.use(helmet()); app.use(function (req : express.Request, res : express.Response, next : express.NextFunction) : void { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); next(); }); // Routes' require /* app.use("/api", routes); */ app.use('/static/*customizable*/', express.static('/*root path see http://expressjs.com/it/starter/static-files.html*/')); // FIXME // Starting the server app.set("port", process.env.PORT || 3000); let server : http.Server = app.listen(app.get("port"), function () : void { console.log("Express server is listening on port " + server.address().port + " in " + configuration.getEnvName() + " environment."); });
Add static web with express.static
Add static web with express.static
TypeScript
mit
BugBusterSWE/MaaS,BugBusterSWE/MaaS,BugBusterSWE/MaaS,BugBusterSWE/MaaS
--- +++ @@ -29,6 +29,8 @@ // Routes' require /* app.use("/api", routes); */ +app.use('/static/*customizable*/', express.static('/*root path see http://expressjs.com/it/starter/static-files.html*/')); // FIXME + // Starting the server app.set("port", process.env.PORT || 3000); let server : http.Server = app.listen(app.get("port"), function () : void {
69585795b36106447b68749b567b55241e8f2a34
src/impl/프레시안.ts
src/impl/프레시안.ts
import * as $ from 'jquery'; import { clearStyles } from '../util'; import { Article } from 'index'; export const cleanup = () => { $('#scrollDiv, body>img').remove(); } export function parse(): Article { return { title: $('.text-info .title').text().trim(), subtitle: $('.hboxsubtitle').text().trim(), content: clearStyles($('#news_body_area')[0].cloneNode(true)).innerHTML, timestamp: { created: new Date($('.byotherspan .date').text().trim().replace(/\./g, '-').replace(/\s+/, 'T') + '+09:00'), lastModified: undefined }, reporters: [{ name: $('.head_writer_fullname .byother').text().trim(), mail: undefined }] }; }
import * as $ from 'jquery'; import { clearStyles } from '../util'; import { Article } from 'index'; export const cleanup = () => { $('#scrollDiv, body>img, body>div:not([id]), html>iframe, body>iframe, body>script, #fb-root, #sliderAdScript').remove(); } export function parse(): Article { return { title: $('.text-info .title').text().trim(), subtitle: $('.hboxsubtitle').text().trim(), content: clearStyles($('#news_body_area')[0].cloneNode(true)).innerHTML, timestamp: { created: new Date($('.byotherspan .date').text().trim().replace(/\./g, '-').replace(/\s+/, 'T') + '+09:00'), lastModified: undefined }, reporters: [{ name: $('.head_writer_fullname .byother').text().trim(), mail: undefined }] }; }
Clean more elements on pressian.com
Clean more elements on pressian.com
TypeScript
mit
disjukr/just-news,disjukr/just-news,disjukr/jews,disjukr/jews,disjukr/just-news
--- +++ @@ -3,7 +3,7 @@ import { Article } from 'index'; export const cleanup = () => { - $('#scrollDiv, body>img').remove(); + $('#scrollDiv, body>img, body>div:not([id]), html>iframe, body>iframe, body>script, #fb-root, #sliderAdScript').remove(); } export function parse(): Article {
94d01d95ae002af454f31c4fefc895fb93505cd1
src/index.tsx
src/index.tsx
/** @license * Kifu for JS * Copyright (c) 2014 na2hiro (https://github.com/na2hiro) * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ import * as mobx from "mobx"; import * as React from "react"; import { render } from "react-dom"; import Kifu from "./Kifu"; import KifuStore from "./stores/KifuStore"; import { onDomReady } from "./utils/util"; export { mobx }; export function loadString(kifu: string, id?: string): Promise<KifuStore> { return loadCommon(null, kifu, id); } export function load(filePath: string, id?: string): Promise<KifuStore> { return loadCommon(filePath, null, id); } function loadCommon(filePath, kifu, id): Promise<KifuStore> { return new Promise((resolve) => { if (!id) { id = "kifuforjs_" + Math.random() .toString(36) .slice(2); document.write("<div id='" + id + "'></div>"); } onDomReady(() => { const container = document.getElementById(id); const kifuStore = new KifuStore(); render(<Kifu kifuStore={kifuStore} kifu={kifu} filePath={filePath} />, container); resolve(kifuStore); }); }); }
/** @license * Kifu for JS * Copyright (c) 2014 na2hiro (https://github.com/na2hiro) * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ import * as React from "react"; import { render } from "react-dom"; import Kifu from "./Kifu"; import KifuStore from "./stores/KifuStore"; import { onDomReady } from "./utils/util"; import {autorun, when, reaction} from "mobx"; export const mobx = {autorun, when, reaction}; export function loadString(kifu: string, id?: string): Promise<KifuStore> { return loadCommon(null, kifu, id); } export function load(filePath: string, id?: string): Promise<KifuStore> { return loadCommon(filePath, null, id); } function loadCommon(filePath, kifu, id): Promise<KifuStore> { return new Promise((resolve) => { if (!id) { id = "kifuforjs_" + Math.random() .toString(36) .slice(2); document.write("<div id='" + id + "'></div>"); } onDomReady(() => { const container = document.getElementById(id); const kifuStore = new KifuStore(); render(<Kifu kifuStore={kifuStore} kifu={kifu} filePath={filePath} />, container); resolve(kifuStore); }); }); }
Fix export to pass tests
Fix export to pass tests
TypeScript
mit
na2hiro/Kifu-for-JS,na2hiro/Kifu-for-JS,na2hiro/Kifu-for-JS
--- +++ @@ -4,13 +4,13 @@ * This software is released under the MIT License. * http://opensource.org/licenses/mit-license.php */ -import * as mobx from "mobx"; import * as React from "react"; import { render } from "react-dom"; import Kifu from "./Kifu"; import KifuStore from "./stores/KifuStore"; import { onDomReady } from "./utils/util"; -export { mobx }; +import {autorun, when, reaction} from "mobx"; +export const mobx = {autorun, when, reaction}; export function loadString(kifu: string, id?: string): Promise<KifuStore> { return loadCommon(null, kifu, id);
5f7b0a93e2fabe1f391d1b42f1dd4778214932dc
src/Diploms.WebUI/ClientApp/app/app.shared.module.ts
src/Diploms.WebUI/ClientApp/app/app.shared.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './components/app/app.component'; import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './components/home/home.component'; import { FetchDataComponent } from './components/fetchdata/fetchdata.component'; import { CounterComponent } from './components/counter/counter.component'; import { SharedModule } from './shared/shared.module'; @NgModule({ declarations: [ AppComponent, NavMenuComponent, CounterComponent, FetchDataComponent, HomeComponent ], imports: [ SharedModule, HttpModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'counter', component: CounterComponent }, { path: 'fetch-data', component: FetchDataComponent }, { path: '**', redirectTo: 'home' } ]) ] }) export class AppModuleShared { }
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './components/app/app.component'; import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './components/home/home.component'; import { FetchDataComponent } from './components/fetchdata/fetchdata.component'; import { CounterComponent } from './components/counter/counter.component'; import { SharedModule } from './shared/shared.module'; import { DepartmentsModule } from './departments/departments.module'; @NgModule({ declarations: [ AppComponent, NavMenuComponent, CounterComponent, FetchDataComponent, HomeComponent ], imports: [ HttpModule, SharedModule, DepartmentsModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'counter', component: CounterComponent }, { path: 'fetch-data', component: FetchDataComponent }, { path: '**', redirectTo: 'home' } ]) ], schemas : [ NO_ERRORS_SCHEMA ] }) export class AppModuleShared { }
Use DepartmentsModule in the application
Use DepartmentsModule in the application
TypeScript
mit
denismaster/dcs,denismaster/dcs,denismaster/dcs,denismaster/dcs
--- +++ @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; @@ -11,6 +11,7 @@ import { CounterComponent } from './components/counter/counter.component'; import { SharedModule } from './shared/shared.module'; +import { DepartmentsModule } from './departments/departments.module'; @NgModule({ declarations: [ @@ -21,8 +22,9 @@ HomeComponent ], imports: [ + HttpModule, SharedModule, - HttpModule, + DepartmentsModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, @@ -30,7 +32,8 @@ { path: 'fetch-data', component: FetchDataComponent }, { path: '**', redirectTo: 'home' } ]) - ] + ], + schemas : [ NO_ERRORS_SCHEMA ] }) export class AppModuleShared { }
f98eb0eca0dd087afc124f50a6ca4a2e91c4941e
templates/app/src/_name.config.ts
templates/app/src/_name.config.ts
import { Inject } from "./decorators/decorators"; @Inject("$stateProvider", "$urlRouterProvider") export class <%= pAppName %>Config { constructor(stateProvider: ng.ui.IStateProvider, urlRouterProvider: ng.ui.IUrlRouterProvider) { stateProvider .state("<%= appName %>", { url: "/", templateUrl: "<%= hAppName %>.tpl.html" }); urlRouterProvider.otherwise("/"); } }
import { Inject } from "./decorators/decorators"; @Inject("$stateProvider", "$urlRouterProvider") export class <%= pAppName %>Config { constructor(stateProvider: ng.ui.IStateProvider, urlRouterProvider: ng.ui.IUrlRouterProvider) { stateProvider .state("<%= appName %>", { abstract: true, templateUrl: "<%= hAppName %>.tpl.html" }); urlRouterProvider.otherwise("/"); } }
Replace url for an abstract view
Replace url for an abstract view
TypeScript
mit
Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli
--- +++ @@ -5,7 +5,7 @@ constructor(stateProvider: ng.ui.IStateProvider, urlRouterProvider: ng.ui.IUrlRouterProvider) { stateProvider .state("<%= appName %>", { - url: "/", + abstract: true, templateUrl: "<%= hAppName %>.tpl.html" });