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
63d48c4f6ddc391fe7c3f972714af01ebb6f41be
app/src/cli/load-commands.ts
app/src/cli/load-commands.ts
import { IArgv as mriArgv } from 'mri' import { TypeName } from './util' type StringArray = ReadonlyArray<string> const files: StringArray = require('./command-list.json') export type CommandHandler = (args: mriArgv, argv: StringArray) => void export { mriArgv } export interface IOption { readonly type: TypeName readonly aliases?: StringArray readonly description: string readonly default?: any } interface IArgument { readonly name: string readonly required: boolean readonly description: string readonly type: TypeName } export interface ICommandModule { name?: string readonly command: string readonly description: string readonly handler: CommandHandler readonly aliases?: StringArray readonly options?: { [flag: string]: IOption } readonly args?: ReadonlyArray<IArgument> readonly unknownOptionHandler?: (flag: string) => void } const loadModule: (name: string) => ICommandModule = name => require(`./commands/${name}.ts`) interface ICommands { [command: string]: ICommandModule } export const commands: ICommands = {} for (const fileName of files) { const mod = loadModule(fileName) if (!mod.name) { mod.name = fileName } commands[mod.name] = mod }
import { IArgv as mriArgv } from 'mri' import { TypeName } from './util' type StringArray = ReadonlyArray<string> const files: StringArray = require('./command-list.json') export type CommandHandler = (args: mriArgv, argv: StringArray) => void export { mriArgv } export interface IOption { readonly type: TypeName readonly aliases?: StringArray readonly description: string readonly default?: any } interface IArgument { readonly name: string readonly required: boolean readonly description: string readonly type: TypeName } export interface ICommandModule { name?: string readonly command: string readonly description: string readonly handler: CommandHandler readonly aliases?: StringArray readonly options?: { [flag: string]: IOption } readonly args?: ReadonlyArray<IArgument> readonly unknownOptionHandler?: (flag: string) => void } function loadModule(name: string): ICommandModule { return require(`./commands/${name}.ts`) } interface ICommands { [command: string]: ICommandModule } export const commands: ICommands = {} for (const fileName of files) { const mod = loadModule(fileName) if (!mod.name) { mod.name = fileName } commands[mod.name] = mod }
Make `loadModule` into a normal function
Make `loadModule` into a normal function
TypeScript
mit
shiftkey/desktop,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,kactus-io/kactus,kactus-io/kactus,say25/desktop,artivilla/desktop,artivilla/desktop,say25/desktop,artivilla/desktop,desktop/desktop,shiftkey/desktop,say25/desktop,kactus-io/kactus,say25/desktop,j-f1/forked-desktop,j-f1/forked-desktop,desktop/desktop,desktop/desktop,shiftkey/desktop,desktop/desktop
--- +++ @@ -34,8 +34,9 @@ readonly unknownOptionHandler?: (flag: string) => void } -const loadModule: (name: string) => ICommandModule = name => - require(`./commands/${name}.ts`) +function loadModule(name: string): ICommandModule { + return require(`./commands/${name}.ts`) +} interface ICommands { [command: string]: ICommandModule
9c92104cffbb38dc43d60895a36a259c9f2756c8
source/services/date/dateTimeFormatStrings.ts
source/services/date/dateTimeFormatStrings.ts
'use strict'; export var dateTimeFormatServiceName: string = 'dateTimeFormatStrings'; export interface IDateFormatStrings { isoFormat: string; dateTimeFormat: string; dateFormat: string; timeFormat: string; } export var defaultFormats: IDateFormatStrings = { isoFormat: 'YYYY-MM-DDTHH:mm:ssZ', dateTimeFormat: 'M/D/YYYY h:mm A', dateFormat: 'MM/DD/YYYY', timeFormat: 'h:mmA', };
'use strict'; export var dateTimeFormatServiceName: string = 'dateTimeFormatStrings'; export interface IDateFormatStrings { isoFormat: string; dateTimeFormat: string; dateFormat: string; timeFormat: string; } export var defaultFormats: IDateFormatStrings = { isoFormat: 'YYYY-MM-DDTHH:mm:ssZ', dateTimeFormat: 'MM/DD/YYYY h:mm A', dateFormat: 'MM/DD/YYYY', timeFormat: 'h:mmA', };
Use two Ms and Ds
Use two Ms and Ds
TypeScript
mit
SamGraber/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities
--- +++ @@ -11,7 +11,7 @@ export var defaultFormats: IDateFormatStrings = { isoFormat: 'YYYY-MM-DDTHH:mm:ssZ', - dateTimeFormat: 'M/D/YYYY h:mm A', + dateTimeFormat: 'MM/DD/YYYY h:mm A', dateFormat: 'MM/DD/YYYY', timeFormat: 'h:mmA', };
58a9cb2f9485f4958ac755d481f0d7491073e231
src/mobile/lib/model/MstGoal.ts
src/mobile/lib/model/MstGoal.ts
import {MstSvt} from "../../../model/master/Master"; import {MstSkillContainer, MstSvtSkillContainer} from "../../../model/impl/MstContainer"; export interface MstGoal { appVer: string; svtRawData: Array<MstSvt>; svtSkillData: MstSvtSkillContainer; skillData: MstSkillContainer; current: Goal; goals: Array<Goal>; } export interface Goal { id: string; // UUID name: string; servants: Array<GoalSvt>; } export interface GoalSvt { svtId: number; skills: Array<GoalSvtSkill>; } export interface GoalSvtSkill { skillId: number; level: number; } export const defaultMstGoal = { appVer: undefined, current: undefined, goals: [], } as MstGoal;
import {MstSvt} from "../../../model/master/Master"; import {MstSkillContainer, MstSvtSkillContainer} from "../../../model/impl/MstContainer"; export interface MstGoal { appVer: string; svtRawData: Array<MstSvt>; svtSkillData: MstSvtSkillContainer; skillData: MstSkillContainer; current: Goal; goals: Array<Goal>; } export interface Goal { id: string; // UUID name: string; servants: Array<GoalSvt>; } export interface GoalSvt { svtId: number; skills: Array<GoalSvtSkill>; } export interface GoalSvtSkill { skillId: number; level: number; } export const defaultCurrentGoal = { id: "current", name: "current", servants: [], } as Goal; export const defaultMstGoal = { appVer: undefined, current: undefined, goals: [], } as MstGoal;
Add default player current state obj.
Add default player current state obj.
TypeScript
mit
agreatfool/fgo-handbook,agreatfool/fgo-handbook,agreatfool/fgo-handbook,agreatfool/fgo-handbook,agreatfool/fgo-handbook,agreatfool/fgo-handbook
--- +++ @@ -26,6 +26,12 @@ level: number; } +export const defaultCurrentGoal = { + id: "current", + name: "current", + servants: [], +} as Goal; + export const defaultMstGoal = { appVer: undefined, current: undefined,
4a7bf3e5de77731fa2c4d9d362a3fa967138cd94
app/src/components/Column/Post.tsx
app/src/components/Column/Post.tsx
import * as React from 'react'; interface Props { userName: string; text: string; channelName: string; } export default class Post extends React.Component < any, any > { constructor(props) { super(props); this.props = props; } render() { return <div style={{ margin: '20px', border: '5px solid' }}>{this.props.text}</div>; } }
import * as React from 'react'; import Card from 'material-ui/Card'; import { withStyles } from 'material-ui/styles'; interface Props { userName: string; text: string; channelName: string; } const styles = theme => ({ card: { minWidth: 275, }, bullet: { display: 'inline-block', margin: '0 2px', transform: 'scale(0.8)', }, title: { marginBottom: 16, fontSize: 14, color: theme.palette.text.secondary, }, pos: { marginBottom: 12, color: theme.palette.text.secondary, }, }); class Post extends React.Component < any, any > { constructor(props) { super(props); this.props = props; } render() { return ( <div style={{ margin: '20px' }}> <Card> {this.props.text} </Card> </div> ); } } export default withStyles(styles)(Post);
Change Card component to cool ui
Change Card component to cool ui
TypeScript
mit
tanishi/Slackker,tanishi/Slackker,tanishi/Slackker
--- +++ @@ -1,4 +1,6 @@ import * as React from 'react'; +import Card from 'material-ui/Card'; +import { withStyles } from 'material-ui/styles'; interface Props { @@ -7,13 +9,41 @@ channelName: string; } -export default class Post extends React.Component < any, any > { +const styles = theme => ({ + card: { + minWidth: 275, + }, + bullet: { + display: 'inline-block', + margin: '0 2px', + transform: 'scale(0.8)', + }, + title: { + marginBottom: 16, + fontSize: 14, + color: theme.palette.text.secondary, + }, + pos: { + marginBottom: 12, + color: theme.palette.text.secondary, + }, +}); + +class Post extends React.Component < any, any > { constructor(props) { super(props); this.props = props; } render() { - return <div style={{ margin: '20px', border: '5px solid' }}>{this.props.text}</div>; + return ( + <div style={{ margin: '20px' }}> + <Card> + {this.props.text} + </Card> + </div> + ); } } + +export default withStyles(styles)(Post);
0b51b9d3a6edf923b328ff1bf0f5ea935d77765b
src/datasets/summarizations/utils/time-series.ts
src/datasets/summarizations/utils/time-series.ts
import { TimeSeriesPoint } from '../../queries/time-series.query'; import { DAY, WEEK } from '../../../utils/timeUnits'; /** * Group time-series points by the week number of their x-values (date). * The first day of the week is Monday when computing the week number of * a date. * * @param points The array of time-series point to group * @return The group result. Each of the element in the returned array is an * array of time-series points which have the x-values (date) in the same week. * The week arrays are sorted by the week number and the points in each array * are sorted by the x-value (date) in ascending order. */ export function groupPointsByXWeek(points: TimeSeriesPoint[]): TimeSeriesPoint[][] { const weekStartOffset = 4 * DAY; const weekPoints: Record<string, TimeSeriesPoint[]> = {}; points.sort(({ x: a }, { x: b }) => a.getTime() - b.getTime()); for (const point of points) { const week = Math.floor((point.x.getTime() - weekStartOffset) / WEEK); weekPoints[week] = [...(weekPoints[week] ?? []), point]; } const sortedWeekPointPairs = Object.entries(weekPoints).sort(([wa], [wb]) => Number(wa) - Number(wb)); return sortedWeekPointPairs.map(([_, currentWeekPoints]) => currentWeekPoints); }
import { TimeSeriesPoint } from '../../queries/time-series.query'; import { DAY, WEEK } from '../../../utils/timeUnits'; /** * Group time-series points by the week number of their x-values (date). * The first day of the week is Monday when computing the week number of * a date. * * @param points The array of time-series point to group * @return The group result. Each of the element in the returned array is an * array of time-series points which have the x-values (date) in the same week. * The week arrays are sorted by the week number and the points in each array * are sorted by the x-value (date) in ascending order. */ export function groupPointsByXWeek(points: TimeSeriesPoint[]): TimeSeriesPoint[][] { const weekPoints: Record<string, TimeSeriesPoint[]> = {}; points.sort(({ x: a }, { x: b }) => a.getTime() - b.getTime()); for (const point of points) { // `weekNo` is the week number, which is computed by taking the number of // weeks since `new Date(0)`. Because `new Date(0)` is Wednesday and we // consider the first day of the week to be Monday, the time must be subtracted // by four days when computing the week number. const weekStartOffset = 4 * DAY; const weekNo = Math.floor((point.x.getTime() - weekStartOffset) / WEEK); weekPoints[weekNo] = [...(weekPoints[weekNo] ?? []), point]; } const sortedWeekPointPairs = Object.entries(weekPoints).sort(([wa], [wb]) => Number(wa) - Number(wb)); return sortedWeekPointPairs.map(([_, currentWeekPoints]) => currentWeekPoints); }
Add comments for week number computation
Add comments for week number computation
TypeScript
apache-2.0
googleinterns/guide-doge,googleinterns/guide-doge,googleinterns/guide-doge
--- +++ @@ -13,12 +13,16 @@ * are sorted by the x-value (date) in ascending order. */ export function groupPointsByXWeek(points: TimeSeriesPoint[]): TimeSeriesPoint[][] { - const weekStartOffset = 4 * DAY; const weekPoints: Record<string, TimeSeriesPoint[]> = {}; points.sort(({ x: a }, { x: b }) => a.getTime() - b.getTime()); for (const point of points) { - const week = Math.floor((point.x.getTime() - weekStartOffset) / WEEK); - weekPoints[week] = [...(weekPoints[week] ?? []), point]; + // `weekNo` is the week number, which is computed by taking the number of + // weeks since `new Date(0)`. Because `new Date(0)` is Wednesday and we + // consider the first day of the week to be Monday, the time must be subtracted + // by four days when computing the week number. + const weekStartOffset = 4 * DAY; + const weekNo = Math.floor((point.x.getTime() - weekStartOffset) / WEEK); + weekPoints[weekNo] = [...(weekPoints[weekNo] ?? []), point]; } const sortedWeekPointPairs = Object.entries(weekPoints).sort(([wa], [wb]) => Number(wa) - Number(wb)); return sortedWeekPointPairs.map(([_, currentWeekPoints]) => currentWeekPoints);
3f085db5c340251930d9ca89cbc2250c55f493f5
angular/src/tests/attribute-tests.ts
angular/src/tests/attribute-tests.ts
import {Order} from "../app/lod/Order"; import { Observable } from 'rxjs/Observable'; import {Product} from "../app/lod/Product"; describe('Attributes', function() { it( "should be flagged as created", function() { let newOrder = new Order(); let now = new Date(); newOrder.Order.create( { OrderDate: now }); newOrder.logOi(); expect( newOrder.Order$.OrderDate.getTime()).toBe( now.getTime() ); //newOrder.Order$.ShipName = "John Smith"; //newOrder.Order$.OrderDetail.create( { Quantity: 10 }, { position: Position.Last } ); }); });
import {Order} from "../app/lod/Order"; import { Observable } from 'rxjs/Observable'; import {Product} from "../app/lod/Product"; describe('Attributes', function() { it( "should be flagged as created", function() { let newOrder = new Order(); let now = new Date(); newOrder.Order.create( { OrderDate: now }); expect( newOrder.Order$.OrderDate.getTime()).toBe( now.getTime() ); expect( newOrder.Order$.updated).toBeTruthy(); newOrder.Order$.ShipName = "John Smith"; newOrder.Order$.OrderDetail.create( { Quantity: 10 }, { position: Position.Last } ); }); });
Update tests to check for date
Update tests to check for date
TypeScript
apache-2.0
DeegC/Zeidon-Northwind,DeegC/Zeidon-Northwind,DeegC/Zeidon-Northwind,DeegC/Zeidon-Northwind,DeegC/Zeidon-Northwind,DeegC/Zeidon-Northwind
--- +++ @@ -7,9 +7,9 @@ let newOrder = new Order(); let now = new Date(); newOrder.Order.create( { OrderDate: now }); - newOrder.logOi(); expect( newOrder.Order$.OrderDate.getTime()).toBe( now.getTime() ); - //newOrder.Order$.ShipName = "John Smith"; - //newOrder.Order$.OrderDetail.create( { Quantity: 10 }, { position: Position.Last } ); + expect( newOrder.Order$.updated).toBeTruthy(); + newOrder.Order$.ShipName = "John Smith"; + newOrder.Order$.OrderDetail.create( { Quantity: 10 }, { position: Position.Last } ); }); });
487d3f2853918937e26312be4e25a2fc6118e41b
src/devices/incoming_bot_notification.ts
src/devices/incoming_bot_notification.ts
import { beep } from "../util"; import { Notification } from "farmbot/dist/jsonrpc"; import { HardwareState, RpcBotLog } from "../devices/interfaces"; import { error, success, warning } from "../ui"; import { t } from "i18next"; export function handleIncomingBotNotification(msg: Notification<any>, dispatch: Function) { switch (msg.method) { case "status_update": dispatch(statusUpdate((msg as Notification<[HardwareState]>))); beep(); break; case "log_message": handleLogMessage(dispatch, (msg as Notification<[RpcBotLog]>)); break; case "log_dump": dispatch(logDump(msg as Notification<RpcBotLog[]>)); break; }; } function handleLogMessage(dispatch: Function, message: Notification<[RpcBotLog]>) { dispatch(logNotification(message)); } function statusUpdate(statusMessage: Notification<[HardwareState]>) { return { type: "BOT_CHANGE", payload: statusMessage.params[0] }; } function logNotification(botLog: Notification<[RpcBotLog]>) { return { type: "BOT_LOG", payload: botLog.params[0] }; }; function logDump(msgs: Notification<RpcBotLog[]>) { return { type: "BOT_LOG_DUMP", payload: msgs }; }
import { beep } from "../util"; import { Notification } from "farmbot/dist/jsonrpc"; import { HardwareState, RpcBotLog } from "../devices/interfaces"; import { error, success, warning } from "../ui"; import { t } from "i18next"; export function handleIncomingBotNotification(msg: Notification<any>, dispatch: Function) { switch (msg.method) { case "status_update": dispatch(statusUpdate((msg as Notification<[HardwareState]>))); beep(); break; case "log_message": dispatch(logNotification(msg)); break; }; } function statusUpdate(statusMessage: Notification<[HardwareState]>) { return { type: "BOT_CHANGE", payload: statusMessage.params[0] }; } function logNotification(botLog: Notification<[RpcBotLog]>) { return { type: "BOT_LOG", payload: botLog.params[0] }; }; function logDump(msgs: Notification<RpcBotLog[]>) { return { type: "BOT_LOG_DUMP", payload: msgs }; }
Remove unneeded LOG_DUMP switch branch
Remove unneeded LOG_DUMP switch branch
TypeScript
mit
MrChristofferson/farmbot-web-frontend,MrChristofferson/farmbot-web-frontend,FarmBot/farmbot-web-frontend,RickCarlino/farmbot-web-frontend,RickCarlino/farmbot-web-frontend,FarmBot/farmbot-web-frontend
--- +++ @@ -15,17 +15,9 @@ beep(); break; case "log_message": - handleLogMessage(dispatch, (msg as Notification<[RpcBotLog]>)); - break; - case "log_dump": - dispatch(logDump(msg as Notification<RpcBotLog[]>)); + dispatch(logNotification(msg)); break; }; -} - -function handleLogMessage(dispatch: Function, - message: Notification<[RpcBotLog]>) { - dispatch(logNotification(message)); } function statusUpdate(statusMessage: Notification<[HardwareState]>) {
2020188fa05ae159619b229eaff9141bcf6d1813
src/__mocks__/next_model.ts
src/__mocks__/next_model.ts
import faker from 'faker'; export class Faker { private static get positiveInteger(): number { return faker.random.number({ min: 0, max: Number.MAX_SAFE_INTEGER, precision: 1, }); } private static get className(): string { return faker.lorem.word(); } static get modelName(): string { return this.className; } static get limit(): number { return this.positiveInteger; } static get skip(): number { return this.positiveInteger; } };
Add mocks for some base types
Add mocks for some base types
TypeScript
mit
tamino-martinius/node-next-model
--- +++ @@ -0,0 +1,27 @@ +import faker from 'faker'; + +export class Faker { + private static get positiveInteger(): number { + return faker.random.number({ + min: 0, + max: Number.MAX_SAFE_INTEGER, + precision: 1, + }); + } + + private static get className(): string { + return faker.lorem.word(); + } + + static get modelName(): string { + return this.className; + } + + static get limit(): number { + return this.positiveInteger; + } + + static get skip(): number { + return this.positiveInteger; + } +};
78cd5fc1d6d54de0972f843b04242db89893c680
src/app/utilities/browser-detection.service.ts
src/app/utilities/browser-detection.service.ts
import { Injectable } from '@angular/core'; declare var document: any; declare var InstallTrigger: any; declare var isIE: any; declare var opr: any; declare var safari: any; declare var window: any; @Injectable() export class BrowserDetectionService { constructor() { } isOpera(): boolean { return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; } isChrome(): boolean { return !!window.chrome && !!window.chrome.webstore; } isEdge(): boolean { return !isIE && !!window.StyleMedia; } isIE(): boolean { return /*@cc_on!@*/false || !!document.documentMode; } isFirefox(): boolean { return typeof InstallTrigger !== 'undefined'; } isSafari(): boolean { return /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification); } }
import { Injectable } from '@angular/core'; declare var document: any; declare var InstallTrigger: any; declare var isIE: any; declare var opr: any; declare var safari: any; declare var window: any; @Injectable() export class BrowserDetectionService { constructor() { } isOpera(): boolean { return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; } isChrome(): boolean { return !!window.chrome && !!window.chrome.webstore; } isEdge(): boolean { return !isIE && !!window.StyleMedia; } isIE(): boolean { return /*@cc_on!@*/false || !!document.documentMode; } isFirefox(): boolean { return typeof InstallTrigger !== 'undefined'; } isSafari(): boolean { return /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification); } isLinux(): boolean { return window.navigator && window.navigator.userAgent.indexOf("Linux") !== -1 } isOsx(): boolean { return window.navigator && window.navigator.userAgent.indexOf("Mac") !== -1 } isWindows(): boolean { return window.navigator && window.navigator.userAgent.indexOf("Windows") !== -1 } }
Add methods to detect operating system
update(BrowserDetectionService): Add methods to detect operating system
TypeScript
mit
coryshaw1/DubPlus-Site,coryshaw1/DubPlus-Site,coryshaw1/DubPlus-Site,DubPlus/DubPlus-Site,DubPlus/DubPlus-Site,DubPlus/DubPlus-Site
--- +++ @@ -37,4 +37,16 @@ (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification); } + isLinux(): boolean { + return window.navigator && window.navigator.userAgent.indexOf("Linux") !== -1 + } + + isOsx(): boolean { + return window.navigator && window.navigator.userAgent.indexOf("Mac") !== -1 + } + + isWindows(): boolean { + return window.navigator && window.navigator.userAgent.indexOf("Windows") !== -1 + } + }
4823372d8814097600db9fa4152b875fdd72bba7
lib/config.d.ts
lib/config.d.ts
import { Actions } from "./actions"; import { NextUpdate } from "./nextUpdate"; import { PostRender } from "./postRender"; import { Ready } from "./ready"; import { ReceiveUpdate } from "./receiveUpdate"; import { View } from "./view"; interface Config<M, V, U> { initialModel?: M; view?: View<M, V>; postRender?: PostRender<V>; ready?: Ready<U>; actions?: Actions<U>; receiveUpdate?: ReceiveUpdate<M, U>; nextUpdate?: NextUpdate<M, U>; } export { Config };
import { Actions } from "./actions"; import { NextUpdate } from "./nextUpdate"; import { PostRender } from "./postRender"; import { Ready } from "./ready"; import { ReceiveUpdate } from "./receiveUpdate"; import { View } from "./view"; interface Config<M, V, U> { initialModel?: M; actions?: Actions<U>; view?: View<M, V>; postRender?: PostRender<V>; ready?: Ready<U>; receiveUpdate?: ReceiveUpdate<M, U>; nextUpdate?: NextUpdate<M, U>; } export { Config };
Fix components each having own actions.
Fix components each having own actions.
TypeScript
mit
foxdonut/meiosis,foxdonut/meiosis,foxdonut/meiosis
--- +++ @@ -6,10 +6,10 @@ import { View } from "./view"; interface Config<M, V, U> { initialModel?: M; + actions?: Actions<U>; view?: View<M, V>; postRender?: PostRender<V>; ready?: Ready<U>; - actions?: Actions<U>; receiveUpdate?: ReceiveUpdate<M, U>; nextUpdate?: NextUpdate<M, U>; }
53a3fef29bb62b66cbba2b9b3776f69b25f3b4aa
src/ts/uiutils.ts
src/ts/uiutils.ts
import {Component, ComponentConfig} from './components/component'; import {Container} from './components/container'; export namespace UIUtils { export interface TreeTraversalCallback { (component: Component<ComponentConfig>, parent?: Component<ComponentConfig>): void; } export function traverseTree(component: Component<ComponentConfig>, visit: TreeTraversalCallback): void { let recursiveTreeWalker = (component: Component<ComponentConfig>, parent?: Component<ComponentConfig>) => { visit(component, parent); // If the current component is a container, visit it's children if (component instanceof Container) { for (let childComponent of component.getComponents()) { recursiveTreeWalker(childComponent, component); } } }; // Walk and configure the component tree recursiveTreeWalker(component); } // From: https://github.com/nfriend/ts-keycode-enum/blob/master/Key.enum.ts export enum KeyCode { LeftArrow = 37, UpArrow = 38, RightArrow = 39, DownArrow = 40, Space = 32, } }
import {Component, ComponentConfig} from './components/component'; import {Container} from './components/container'; export namespace UIUtils { export interface TreeTraversalCallback { (component: Component<ComponentConfig>, parent?: Component<ComponentConfig>): void; } export function traverseTree(component: Component<ComponentConfig>, visit: TreeTraversalCallback): void { let recursiveTreeWalker = (component: Component<ComponentConfig>, parent?: Component<ComponentConfig>) => { visit(component, parent); // If the current component is a container, visit it's children if (component instanceof Container) { for (let childComponent of component.getComponents()) { recursiveTreeWalker(childComponent, component); } } }; // Walk and configure the component tree recursiveTreeWalker(component); } // From: https://github.com/nfriend/ts-keycode-enum/blob/master/Key.enum.ts export enum KeyCode { LeftArrow = 37, UpArrow = 38, RightArrow = 39, DownArrow = 40, Space = 32, End = 35, Home = 36, } }
Add end and home key controls
Add end and home key controls
TypeScript
mit
bitmovin/bitmovin-player-ui,bitmovin/bitmovin-player-ui,bitmovin/bitmovin-player-ui,bitmovin/bitmovin-player-ui
--- +++ @@ -28,6 +28,9 @@ UpArrow = 38, RightArrow = 39, DownArrow = 40, + Space = 32, + End = 35, + Home = 36, } }
a01ef1404ada3ca1904d3daaca2951370f0011b3
src/pages/pid/dataprocess.ts
src/pages/pid/dataprocess.ts
export class PidDataProcess{ //Default function private static defaultFunc(data, unit : string) : any{ return (parseInt(data, 16)) + unit; } //Vehicle RPM private static _010C(data: string) : any { console.log("Called this method, data was: " + data); return (parseInt(data.replace(" ", ""), 16) / 4) + "rpm"; } public static getData(pid: string, data: string, unit: string) : string{ let func; switch(pid){ case "010C": func = this._010C; break; default: func = this.defaultFunc; break; } return String(func(data.substring(6), unit)); } }
export class PidDataProcess{ public static useImperialUnits: boolean; //Default function private static defaultFunc(data) : any{ return (parseInt(data.replace(" ", ""), 16)); } //Vehicle RPM private static _010C(data: string) : any { return (parseInt(data.replace(" ", ""), 16) / 4); } public static getData(pid: string, data: string, unit: string, iUnit?: string, iUnitConvert?: Function) : string{ let func; switch(pid){ case "010C": func = this._010C; break; default: func = this.defaultFunc; break; } if(PidDataProcess.useImperialUnits && iUnitConvert != null){ return String(iUnitConvert(func(data.substring(6))) + iUnit); }else{ return String(func(data.substring(6)) + unit); } } }
Add support for Imperial Units aka dumb units
Add support for Imperial Units aka dumb units
TypeScript
agpl-3.0
odseco/eco,odseco/eco,odseco/eco
--- +++ @@ -1,24 +1,28 @@ - export class PidDataProcess{ + public static useImperialUnits: boolean; + //Default function - private static defaultFunc(data, unit : string) : any{ - return (parseInt(data, 16)) + unit; + private static defaultFunc(data) : any{ + return (parseInt(data.replace(" ", ""), 16)); } //Vehicle RPM private static _010C(data: string) : any { - console.log("Called this method, data was: " + data); - - return (parseInt(data.replace(" ", ""), 16) / 4) + "rpm"; + return (parseInt(data.replace(" ", ""), 16) / 4); } - public static getData(pid: string, data: string, unit: string) : string{ + public static getData(pid: string, data: string, unit: string, iUnit?: string, iUnitConvert?: Function) : string{ let func; switch(pid){ case "010C": func = this._010C; break; default: func = this.defaultFunc; break; } - return String(func(data.substring(6), unit)); + + if(PidDataProcess.useImperialUnits && iUnitConvert != null){ + return String(iUnitConvert(func(data.substring(6))) + iUnit); + }else{ + return String(func(data.substring(6)) + unit); + } } }
b91d14fd6cc0d4be8611451813ee7ecbea85f713
tests/cases/fourslash/declarationExpressions.ts
tests/cases/fourslash/declarationExpressions.ts
/// <reference path="fourslash.ts"/> ////class A {} ////const B = class C { //// public x; ////}; ////function D() {} ////const E = function F() {} ////console.log(function inner() {}) ////String(function fun() { class cls { public prop; } })) function navExact(name: string, kind: string) { verify.navigationItemsListContains(name, kind, name, "exact"); } navExact("A", "class"); navExact("B", "const"); navExact("C", "class"); navExact("x", "property"); navExact("D", "function"); navExact("E", "const"); navExact("F", "function") navExact("inner", "function"); navExact("fun", "function"); navExact("cls", "class"); navExact("prop", "property");
/// <reference path="fourslash.ts"/> ////class A {} ////const B = class C { //// public x; ////}; ////function D() {} ////const E = function F() {} ////console.log(function() {}, class {}); // Expression with no name should have no effect. ////console.log(function inner() {}); ////String(function fun() { class cls { public prop; } })); function navExact(name: string, kind: string) { verify.navigationItemsListContains(name, kind, name, "exact"); } navExact("A", "class"); navExact("B", "const"); navExact("C", "class"); navExact("x", "property"); navExact("D", "function"); navExact("E", "const"); navExact("F", "function") navExact("inner", "function"); navExact("fun", "function"); navExact("cls", "class"); navExact("prop", "property");
Test expressions with no name
Test expressions with no name
TypeScript
apache-2.0
erikmcc/TypeScript,minestarks/TypeScript,kitsonk/TypeScript,jwbay/TypeScript,RyanCavanaugh/TypeScript,DLehenbauer/TypeScript,thr0w/Thr0wScript,Eyas/TypeScript,alexeagle/TypeScript,nojvek/TypeScript,TukekeSoft/TypeScript,plantain-00/TypeScript,kpreisser/TypeScript,chuckjaz/TypeScript,SaschaNaz/TypeScript,DLehenbauer/TypeScript,basarat/TypeScript,plantain-00/TypeScript,RyanCavanaugh/TypeScript,chuckjaz/TypeScript,kpreisser/TypeScript,basarat/TypeScript,kitsonk/TypeScript,synaptek/TypeScript,mihailik/TypeScript,thr0w/Thr0wScript,alexeagle/TypeScript,DLehenbauer/TypeScript,weswigham/TypeScript,kitsonk/TypeScript,basarat/TypeScript,SaschaNaz/TypeScript,Eyas/TypeScript,donaldpipowitch/TypeScript,nojvek/TypeScript,TukekeSoft/TypeScript,nojvek/TypeScript,chuckjaz/TypeScript,SaschaNaz/TypeScript,Eyas/TypeScript,Microsoft/TypeScript,thr0w/Thr0wScript,microsoft/TypeScript,synaptek/TypeScript,erikmcc/TypeScript,synaptek/TypeScript,vilic/TypeScript,mihailik/TypeScript,synaptek/TypeScript,mihailik/TypeScript,donaldpipowitch/TypeScript,vilic/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,chuckjaz/TypeScript,alexeagle/TypeScript,basarat/TypeScript,TukekeSoft/TypeScript,RyanCavanaugh/TypeScript,weswigham/TypeScript,Microsoft/TypeScript,jwbay/TypeScript,jeremyepling/TypeScript,SaschaNaz/TypeScript,donaldpipowitch/TypeScript,Eyas/TypeScript,jwbay/TypeScript,jeremyepling/TypeScript,microsoft/TypeScript,microsoft/TypeScript,plantain-00/TypeScript,jeremyepling/TypeScript,erikmcc/TypeScript,thr0w/Thr0wScript,jwbay/TypeScript,plantain-00/TypeScript,kpreisser/TypeScript,weswigham/TypeScript,nojvek/TypeScript,mihailik/TypeScript,vilic/TypeScript,donaldpipowitch/TypeScript,DLehenbauer/TypeScript,erikmcc/TypeScript,minestarks/TypeScript,vilic/TypeScript
--- +++ @@ -6,8 +6,9 @@ ////}; ////function D() {} ////const E = function F() {} -////console.log(function inner() {}) -////String(function fun() { class cls { public prop; } })) +////console.log(function() {}, class {}); // Expression with no name should have no effect. +////console.log(function inner() {}); +////String(function fun() { class cls { public prop; } })); function navExact(name: string, kind: string) { verify.navigationItemsListContains(name, kind, name, "exact");
213369e6d0fbc26e524f3f8e28bd39241ab8054b
client/StatBlockEditor/StatBlockEditorComponent.tsx
client/StatBlockEditor/StatBlockEditorComponent.tsx
import React = require("react"); import { StatBlock } from "../../common/StatBlock"; export class StatBlockEditor extends React.Component<StatBlockEditorProps, StatBlockEditorState> { public saveAndClose = () => { this.props.onSave(this.props.statBlock); } public render() { return ""; } } interface StatBlockEditorProps { statBlock: StatBlock; onSave: (statBlock: StatBlock) => void; } interface StatBlockEditorState {}
import React = require("react"); import { Form, Text, } from "react-form"; import { StatBlock } from "../../common/StatBlock"; export class StatBlockEditor extends React.Component<StatBlockEditorProps, StatBlockEditorState> { public saveAndClose = (submittedValues?) => { const editedStatBlock = { ...this.props.statBlock, Name: submittedValues.name }; this.props.onSave(editedStatBlock); } public render() { const statBlock = this.props.statBlock; return <Form onSubmit={this.saveAndClose} render={api => ( <form onSubmit={api.submitForm}> <Text field="name" value={statBlock.Name} /> <button type="submit"><span className="button fa fa-save"></span></button> </form> )} />; } } interface StatBlockEditorProps { statBlock: StatBlock; onSave: (statBlock: StatBlock) => void; } interface StatBlockEditorState { }
Add name field and submit button
Add name field and submit button
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -1,13 +1,26 @@ import React = require("react"); +import { Form, Text, } from "react-form"; import { StatBlock } from "../../common/StatBlock"; export class StatBlockEditor extends React.Component<StatBlockEditorProps, StatBlockEditorState> { - public saveAndClose = () => { - this.props.onSave(this.props.statBlock); + public saveAndClose = (submittedValues?) => { + const editedStatBlock = { + ...this.props.statBlock, + Name: submittedValues.name + }; + + this.props.onSave(editedStatBlock); } - + public render() { - return ""; + const statBlock = this.props.statBlock; + return <Form onSubmit={this.saveAndClose} + render={api => ( + <form onSubmit={api.submitForm}> + <Text field="name" value={statBlock.Name} /> + <button type="submit"><span className="button fa fa-save"></span></button> + </form> + )} />; } } @@ -16,4 +29,4 @@ onSave: (statBlock: StatBlock) => void; } -interface StatBlockEditorState {} +interface StatBlockEditorState { }
487a4c14ea934b20a48bd8d99175a244572662a7
src/Bibliotheca.Client.Web/app/components/projects/projects.component.ts
src/Bibliotheca.Client.Web/app/components/projects/projects.component.ts
import { Component, Input } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Project } from '../../model/project'; import { Branch } from '../../model/branch'; import { Router } from '@angular/router'; import { HttpClientService } from '../../services/httpClient.service'; @Component({ selector: 'projects', templateUrl: 'app/components/projects/projects.component.html' }) export class ProjectsComponent { @Input() public projects: Project[]; @Input() public style: string; constructor(private httpClient: HttpClientService, private router: Router) { } openDocumentation(id: string) { var defaultBranch = ''; for(let project of this.projects) { if(project.id == id) { defaultBranch = project.defaultBranch; break; } } this.httpClient.get('/api/projects/' + id + '/branches/' + defaultBranch).subscribe(result => { var branch = result.json(); this.router.navigate(['/documentation'], { queryParams: { project: id, branch: defaultBranch, file: branch.docsDir + '/index.md' } }); }); } }
import { Component, Input } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Project } from '../../model/project'; import { Branch } from '../../model/branch'; import { Router } from '@angular/router'; import { HttpClientService } from '../../services/httpClient.service'; import { ToasterService } from 'angular2-toaster'; @Component({ selector: 'projects', templateUrl: 'app/components/projects/projects.component.html' }) export class ProjectsComponent { @Input() public projects: Project[]; @Input() public style: string; constructor(private httpClient: HttpClientService, private router: Router, private toaster: ToasterService) { } openDocumentation(id: string) { var defaultBranch:string = null; for(let project of this.projects) { if(project.id == id) { defaultBranch = project.defaultBranch; break; } } if(!defaultBranch) { this.toaster.pop('warning', 'Warning', 'Project doesn\'t have any branches.'); return; } this.httpClient.get('/api/projects/' + id + '/branches/' + defaultBranch).subscribe(result => { var branch = result.json(); this.router.navigate(['/documentation'], { queryParams: { project: id, branch: defaultBranch, file: branch.docsDir + '/index.md' } }); }); } }
Add warning message when there is no branch.
Add warning message when there is no branch.
TypeScript
mit
BibliothecaTeam/Bibliotheca.Client,BibliothecaTeam/Bibliotheca.Client,BibliothecaTeam/Bibliotheca.Client
--- +++ @@ -4,6 +4,7 @@ import { Branch } from '../../model/branch'; import { Router } from '@angular/router'; import { HttpClientService } from '../../services/httpClient.service'; +import { ToasterService } from 'angular2-toaster'; @Component({ selector: 'projects', @@ -17,17 +18,22 @@ @Input() public style: string; - constructor(private httpClient: HttpClientService, private router: Router) { + constructor(private httpClient: HttpClientService, private router: Router, private toaster: ToasterService) { } openDocumentation(id: string) { - var defaultBranch = ''; + var defaultBranch:string = null; for(let project of this.projects) { if(project.id == id) { defaultBranch = project.defaultBranch; break; } + } + + if(!defaultBranch) { + this.toaster.pop('warning', 'Warning', 'Project doesn\'t have any branches.'); + return; } this.httpClient.get('/api/projects/' + id + '/branches/' + defaultBranch).subscribe(result => {
28b2b777ddbab19066704f386d07f2851e1b94c0
src/app/core/routing/app-name-guard.service.ts
src/app/core/routing/app-name-guard.service.ts
import { Injectable } from "@angular/core"; import { CanActivate, Router } from "@angular/router"; import { ActivatedRouteSnapshot } from "@angular/router"; import { RouterStateSnapshot } from "@angular/router"; import log from "loglevel"; /** * */ @Injectable() export class AppNameGuard implements CanActivate { constructor(private router: Router) {} canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): boolean { const appName = route.url[0].path; if (appName === "chipster" || appName === "mylly") { return true; } else { log.warn("invalid appName", appName, "redirecting to chipster home"); this.router.navigateByUrl("/chipster/home"); return false; } } }
import { Injectable } from "@angular/core"; import { CanActivate, Router } from "@angular/router"; import { ActivatedRouteSnapshot } from "@angular/router"; import { RouterStateSnapshot } from "@angular/router"; import log from "loglevel"; import { RouteService } from "../../shared/services/route.service"; /** * */ @Injectable() export class AppNameGuard implements CanActivate { constructor(private router: Router, private routeService: RouteService) {} canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): boolean { const appName = route.url[0].path; if (appName === "chipster" || appName === "mylly") { this.routeService.setBackupAppName(appName); return true; } else { log.warn("invalid appName", appName, "redirecting to chipster home"); this.router.navigateByUrl("/chipster/home"); return false; } } }
Add setBackupAppName to app name guard
Add setBackupAppName to app name guard
TypeScript
mit
chipster/chipster-web,chipster/chipster-web,chipster/chipster-web
--- +++ @@ -3,13 +3,14 @@ import { ActivatedRouteSnapshot } from "@angular/router"; import { RouterStateSnapshot } from "@angular/router"; import log from "loglevel"; +import { RouteService } from "../../shared/services/route.service"; /** * */ @Injectable() export class AppNameGuard implements CanActivate { - constructor(private router: Router) {} + constructor(private router: Router, private routeService: RouteService) {} canActivate( route: ActivatedRouteSnapshot, @@ -17,6 +18,7 @@ ): boolean { const appName = route.url[0].path; if (appName === "chipster" || appName === "mylly") { + this.routeService.setBackupAppName(appName); return true; } else { log.warn("invalid appName", appName, "redirecting to chipster home");
2b5eaa764fc226a87b2d302f6803e1f31faf2bc3
packages/purgecss/__tests__/performance.test.ts
packages/purgecss/__tests__/performance.test.ts
import PurgeCSS from "../src/index"; describe("performance", () => { it("should not suffer from tons of content and css", function () { // TODO Remove this excessive timeout once performance is better. jest.setTimeout(60000); const start = Date.now(); return new PurgeCSS() .purge({ // Use all of the .js files in node_modules to purge all of the .css // files in __tests__/test_examples, including tailwind.css, which is // a whopping 908KB of CSS before purging. content: ["./packages/purgecss/node_modules/**/*.js"], css: [ "./packages/purgecss/__tests__/test_examples/*/*.css", "./packages/purgecss/node_modules/tailwindcss/dist/tailwind.css", ], }) .then((results) => { expect(results.length).toBeGreaterThanOrEqual(1); expect( results.some((result) => { return result.file && result.file.endsWith("/tailwind.css"); }) ).toBe(true); results.forEach((result) => expect(typeof result.css).toBe("string")); console.log("performance test took", Date.now() - start, "ms"); }); }); });
import PurgeCSS from "../src/index"; describe("performance", () => { it("should not suffer from tons of content and css", function () { const start = Date.now(); return new PurgeCSS() .purge({ // Use all of the .js files in node_modules to purge all of the .css // files in __tests__/test_examples, including tailwind.css, which is // a whopping 908KB of CSS before purging. content: ["./packages/purgecss/node_modules/**/*.js"], css: [ "./packages/purgecss/__tests__/test_examples/*/*.css", "./packages/purgecss/node_modules/tailwindcss/dist/tailwind.css", ], }) .then((results) => { expect(results.length).toBeGreaterThanOrEqual(1); expect( results.some((result) => { return result.file && result.file.endsWith("/tailwind.css"); }) ).toBe(true); results.forEach((result) => expect(typeof result.css).toBe("string")); console.log("performance test took", Date.now() - start, "ms"); }); }); });
Remove excessive jest.setTimeout(60000) now that perf is better.
perf: Remove excessive jest.setTimeout(60000) now that perf is better.
TypeScript
mit
FullHuman/purgecss,FullHuman/purgecss,FullHuman/purgecss,FullHuman/purgecss
--- +++ @@ -2,8 +2,6 @@ describe("performance", () => { it("should not suffer from tons of content and css", function () { - // TODO Remove this excessive timeout once performance is better. - jest.setTimeout(60000); const start = Date.now(); return new PurgeCSS() .purge({
1e21cdbf1e9c3f634af5b15e242727054c0fa9f4
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.3.0', RELEASEVERSION: '0.3.0' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.4.0', RELEASEVERSION: '0.4.0' }; export = BaseConfig;
Update release version to 0.4.0
Update release version to 0.4.0
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.3.0', - RELEASEVERSION: '0.3.0' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.4.0', + RELEASEVERSION: '0.4.0' }; export = BaseConfig;
e9404b0d0d8c173b39c9fe664745cb910dcb2ad1
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.2.0', RELEASEVERSION: '0.2.0' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.3.0', RELEASEVERSION: '0.3.0' }; export = BaseConfig;
Update release version and url
Update release version and url
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.2.0', - RELEASEVERSION: '0.2.0' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.3.0', + RELEASEVERSION: '0.3.0' }; export = BaseConfig;
260c4c00b3f39452739578d685466eb0029a7e43
src/elements/declarations/variable-declaration.ts
src/elements/declarations/variable-declaration.ts
import {Container} from '../../collections'; import {any_type} from '../../constants'; import {emit_declaration_name} from '../../helpers/emit-declaration-name'; import {emit_declare} from '../../helpers/emit-declare'; import {emit_optional} from '../../helpers/emit-optional'; import {Declaration, IDeclarationOptionalParameters} from '../declaration'; import {Type} from '../type'; export type VariableKind = 'var' | 'let' | 'const'; // tslint:disable-next-line no-empty-interface export interface IVariableDeclarationRequiredParameters {} export interface IVariableDeclarationOptionalParameters { kind: VariableKind; type: Type; optional: boolean; } export class VariableDeclaration extends Declaration<IVariableDeclarationRequiredParameters, IVariableDeclarationOptionalParameters> { public get default_parameters(): IDeclarationOptionalParameters & IVariableDeclarationOptionalParameters { return Object.assign({}, super.default_declaration_parameters, { kind: 'var' as VariableKind, type: any_type, optional: false, }); } public _emit_raw(container: Container): string { const {kind, type} = this.parameters; const name = emit_declaration_name(this.parameters.name, container); const optional = emit_optional(this.parameters.optional); const declare = emit_declare(container); return `${declare}${kind} ${name}${optional}: ${type._emit(this)};`; } }
import {Container} from '../../collections'; import {any_type} from '../../constants'; import {emit_declaration_name} from '../../helpers/emit-declaration-name'; import {emit_declare} from '../../helpers/emit-declare'; import {emit_optional} from '../../helpers/emit-optional'; import {Declaration, IDeclarationOptionalParameters} from '../declaration'; import {Type} from '../type'; export type VariableKind = 'var' | 'let' | 'const'; export interface IVariableDeclarationRequiredParameters { name: string; } export interface IVariableDeclarationOptionalParameters { kind: VariableKind; type: Type; optional: boolean; } export class VariableDeclaration extends Declaration<IVariableDeclarationRequiredParameters, IVariableDeclarationOptionalParameters> { public get default_parameters(): IDeclarationOptionalParameters & IVariableDeclarationOptionalParameters { return Object.assign({}, super.default_declaration_parameters, { kind: 'var' as VariableKind, type: any_type, optional: false, }); } public _emit_raw(container: Container): string { const {kind, type} = this.parameters; const name = emit_declaration_name(this.parameters.name, container); const optional = emit_optional(this.parameters.optional); const declare = emit_declare(container); return `${declare}${kind} ${name}${optional}: ${type._emit(this)};`; } }
Update VariableDeclaration name should be a string
Update VariableDeclaration name should be a string
TypeScript
mit
ikatyang/dts-element,ikatyang/dts-element
--- +++ @@ -8,8 +8,9 @@ export type VariableKind = 'var' | 'let' | 'const'; -// tslint:disable-next-line no-empty-interface -export interface IVariableDeclarationRequiredParameters {} +export interface IVariableDeclarationRequiredParameters { + name: string; +} export interface IVariableDeclarationOptionalParameters { kind: VariableKind;
681d6f4a31d6a6ee21b4b46a50aca500323448f1
test/conditional-as-property-decorator.spec.ts
test/conditional-as-property-decorator.spec.ts
import * as assert from 'power-assert'; import * as sinon from 'sinon'; import { conditional } from '../src/index'; class TargetClass { } xdescribe('conditional', () => { describe('as a property decorator', () => { describe('(test: boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test is truthy', () => { }); it('doesn\'t decorate if test is falsy', () => { }); }); describe('(test: (target?: Object, key?: string|symbol) => boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test function returns true', () => { }); it('doesn\'t decorate if test function returns false', () => { }); }); }); });
import * as assert from 'power-assert'; import * as sinon from 'sinon'; import { conditional } from '../src/index'; function createPropertyDecorator(spy: Sinon.SinonSpy): PropertyDecorator { return (target?: Object, key?: string|symbol) => spy.apply(spy, arguments); } const spy1 = sinon.spy(); const decor1 = createPropertyDecorator(spy1); const spy2 = sinon.spy(); const decor2 = createPropertyDecorator(spy2); class TargetClass1 { @conditional(true, decor1) name: string; @conditional(false, decor2) age: number; } const spy3 = sinon.spy(); const decor3 = createPropertyDecorator(spy3); const spy4 = sinon.spy(); const decor4 = createPropertyDecorator(spy4); class TargetClass2 { @conditional(testProperty, decor3) name: string; @conditional(testProperty, decor4) age: number; } function testProperty(target?: Object, key?: string|symbol): boolean { return key === 'name'; } describe('conditional', () => { describe('as a property decorator', () => { describe('(test: boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test is truthy', () => { assert(spy1.callCount === 1); assert(spy1.getCall(0).args[0] === TargetClass1.prototype); assert(spy1.getCall(0).args[1] === 'name'); }); it('doesn\'t decorate if test is falsy', () => { assert(spy2.callCount === 0); }); }); describe('(test: (target?: Object, key?: string|symbol) => boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test function returns true', () => { assert(spy3.callCount === 1); assert(spy3.getCall(0).args[0] === TargetClass2.prototype); assert(spy3.getCall(0).args[1] === 'name'); }); it('doesn\'t decorate if test function returns false', () => { assert(spy4.callCount === 0); }); }); }); });
Add test for property decorator
Add test for property decorator
TypeScript
mit
tkqubo/conditional-decorator
--- +++ @@ -2,22 +2,57 @@ import * as sinon from 'sinon'; import { conditional } from '../src/index'; -class TargetClass { +function createPropertyDecorator(spy: Sinon.SinonSpy): PropertyDecorator { + return (target?: Object, key?: string|symbol) => spy.apply(spy, arguments); } -xdescribe('conditional', () => { +const spy1 = sinon.spy(); +const decor1 = createPropertyDecorator(spy1); +const spy2 = sinon.spy(); +const decor2 = createPropertyDecorator(spy2); + +class TargetClass1 { + @conditional(true, decor1) + name: string; + @conditional(false, decor2) + age: number; +} + +const spy3 = sinon.spy(); +const decor3 = createPropertyDecorator(spy3); +const spy4 = sinon.spy(); +const decor4 = createPropertyDecorator(spy4); + +class TargetClass2 { + @conditional(testProperty, decor3) name: string; + @conditional(testProperty, decor4) age: number; +} + +function testProperty(target?: Object, key?: string|symbol): boolean { + return key === 'name'; +} + +describe('conditional', () => { describe('as a property decorator', () => { describe('(test: boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test is truthy', () => { + assert(spy1.callCount === 1); + assert(spy1.getCall(0).args[0] === TargetClass1.prototype); + assert(spy1.getCall(0).args[1] === 'name'); }); it('doesn\'t decorate if test is falsy', () => { + assert(spy2.callCount === 0); }); }); describe('(test: (target?: Object, key?: string|symbol) => boolean, decorator: PropertyDecorator): PropertyDecorator', () => { it('decorates if test function returns true', () => { + assert(spy3.callCount === 1); + assert(spy3.getCall(0).args[0] === TargetClass2.prototype); + assert(spy3.getCall(0).args[1] === 'name'); }); it('doesn\'t decorate if test function returns false', () => { + assert(spy4.callCount === 0); }); }); });
194b444457935a5a9cd65f91f2c897697667f386
options.ts
options.ts
///<reference path="../.d.ts"/> import path = require("path"); import helpers = require("./../common/helpers"); var knownOpts:any = { "log" : String, "verbose" : Boolean, "path" : String, "version": Boolean, "help": Boolean, "json": Boolean, "watch": Boolean }, shorthands = { "v" : "verbose", "p" : "path" }; var parsed = helpers.getParsedOptions(knownOpts, shorthands); Object.keys(parsed).forEach((opt) => exports[opt] = parsed[opt]); exports.knownOpts = knownOpts; declare var exports:any; export = exports;
///<reference path="../.d.ts"/> "use strict"; import path = require("path"); import helpers = require("./../common/helpers"); var knownOpts:any = { "log" : String, "verbose" : Boolean, "path" : String, "version": Boolean, "help": Boolean, "json": Boolean, "watch": Boolean, "avd": String }, shorthands = { "v" : "verbose", "p" : "path" }; var parsed = helpers.getParsedOptions(knownOpts, shorthands); Object.keys(parsed).forEach((opt) => exports[opt] = parsed[opt]); exports.knownOpts = knownOpts; declare var exports:any; export = exports;
Add ability to select a particular avd for $appbuilder emulate android
Add ability to select a particular avd for $appbuilder emulate android Needed to implement http://teampulse.telerik.com/view#item/276157
TypeScript
apache-2.0
telerik/mobile-cli-lib,telerik/mobile-cli-lib
--- +++ @@ -1,5 +1,5 @@ ///<reference path="../.d.ts"/> - +"use strict"; import path = require("path"); import helpers = require("./../common/helpers"); @@ -10,7 +10,8 @@ "version": Boolean, "help": Boolean, "json": Boolean, - "watch": Boolean + "watch": Boolean, + "avd": String }, shorthands = { "v" : "verbose",
68595fe7dc4ba095da9deb627437b0b351400794
test/test-no-metadata.ts
test/test-no-metadata.ts
import {assert} from 'chai'; import * as mm from '../src'; import * as path from 'path'; const t = assert; it("should reject files that can't be parsed", () => { const filePath = path.join(__dirname, 'samples', __filename); // Run with default options return mm.parseFile(filePath).then(result => { throw new Error("Should reject a file which cannot be parsed"); }).catch(err => null); });
import {assert} from 'chai'; import * as mm from '../src'; import * as path from 'path'; const t = assert; it("should reject files that can't be parsed", async () => { const filePath = path.join(__dirname, 'samples', __filename); // Run with default options try { await mm.parseFile(filePath); assert.fail('Should reject a file which cannot be parsed'); } catch(err) { assert.isDefined(err); assert.isDefined(err.message); } });
Remove unused variable, rewrote test case with async/await.
Remove unused variable, rewrote test case with async/await.
TypeScript
mit
Borewit/music-metadata,Borewit/music-metadata
--- +++ @@ -4,12 +4,16 @@ const t = assert; -it("should reject files that can't be parsed", () => { +it("should reject files that can't be parsed", async () => { const filePath = path.join(__dirname, 'samples', __filename); // Run with default options - return mm.parseFile(filePath).then(result => { - throw new Error("Should reject a file which cannot be parsed"); - }).catch(err => null); + try { + await mm.parseFile(filePath); + assert.fail('Should reject a file which cannot be parsed'); + } catch(err) { + assert.isDefined(err); + assert.isDefined(err.message); + } });
0c92b1a772017a55349e6bf7429863aa0fac968d
src/app/common/directives/drag-drop.directive.ts
src/app/common/directives/drag-drop.directive.ts
import { Directive, Output, EventEmitter, HostBinding, HostListener } from '@angular/core'; @Directive({ selector: '[appDragDrop]', }) export class DragDropDirective { @Output() onFileDropped = new EventEmitter<any>(); // @HostBinding('style.background-color') private background = '#f5fcff'; // @HostBinding('style.opacity') private opacity = '1'; // Dragover listener @HostListener('dragover', ['$event']) onDragOver(evt: any) { evt.preventDefault(); evt.stopPropagation(); // this.background = '#9ecbec'; // this.opacity = '0.8'; } // Dragleave listener @HostListener('dragleave', ['$event']) public onDragLeave(evt: any) { evt.preventDefault(); evt.stopPropagation(); // this.background = '#f5fcff'; // this.opacity = '1'; } // Drop listener @HostListener('drop', ['$event']) public ondrop(evt: any) { evt.preventDefault(); evt.stopPropagation(); // this.background = '#f5fcff'; // this.opacity = '1'; const files = evt.dataTransfer.files; if (files.length > 0) { this.onFileDropped.emit(files); } } }
import { Directive, Output, EventEmitter, HostBinding, HostListener } from '@angular/core'; /** * The "appDragDrop" directive can be added to angular components to allow them to act as * a file drag and drop source. This will emit a `onFileDrop` event when files are dropped * onto the component. While a file is being dragged over the component, the dragover css * class will be applied to the element. */ @Directive({ selector: '[appDragDrop]', }) export class DragDropDirective { @Output() onFileDropped = new EventEmitter<any>(); // @HostBinding('style.background-color') private background = '#f5fcff'; // @HostBinding('style.opacity') private opacity = '1'; @HostBinding('class.dragover') private dragOver = false; // Dragover listener @HostListener('dragover', ['$event']) onDragOver(evt: any) { evt.preventDefault(); evt.stopPropagation(); // this.background = '#9ecbec'; // this.opacity = '0.8'; this.dragOver = true; } // Dragleave listener @HostListener('dragleave', ['$event']) public onDragLeave(evt: any) { evt.preventDefault(); evt.stopPropagation(); // this.background = '#f5fcff'; // this.opacity = '1'; this.dragOver = false; } // Drop listener @HostListener('drop', ['$event']) public ondrop(evt: any) { evt.preventDefault(); evt.stopPropagation(); this.dragOver = false; // this.background = '#f5fcff'; // this.opacity = '1'; const files = evt.dataTransfer.files; if (files.length > 0) { this.onFileDropped.emit(files); } } }
Correct issue with drag and drop not showing in comments
FIX: Correct issue with drag and drop not showing in comments
TypeScript
agpl-3.0
doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web
--- +++ @@ -1,5 +1,11 @@ import { Directive, Output, EventEmitter, HostBinding, HostListener } from '@angular/core'; +/** + * The "appDragDrop" directive can be added to angular components to allow them to act as + * a file drag and drop source. This will emit a `onFileDrop` event when files are dropped + * onto the component. While a file is being dragged over the component, the dragover css + * class will be applied to the element. + */ @Directive({ selector: '[appDragDrop]', }) @@ -8,6 +14,7 @@ // @HostBinding('style.background-color') private background = '#f5fcff'; // @HostBinding('style.opacity') private opacity = '1'; + @HostBinding('class.dragover') private dragOver = false; // Dragover listener @HostListener('dragover', ['$event']) onDragOver(evt: any) { @@ -15,6 +22,7 @@ evt.stopPropagation(); // this.background = '#9ecbec'; // this.opacity = '0.8'; + this.dragOver = true; } // Dragleave listener @@ -23,12 +31,14 @@ evt.stopPropagation(); // this.background = '#f5fcff'; // this.opacity = '1'; + this.dragOver = false; } // Drop listener @HostListener('drop', ['$event']) public ondrop(evt: any) { evt.preventDefault(); evt.stopPropagation(); + this.dragOver = false; // this.background = '#f5fcff'; // this.opacity = '1'; const files = evt.dataTransfer.files;
83225a48bbc08d8c0df14c066b8a46b8654c9faa
src/app/marketplace/plugins/plugins.module.ts
src/app/marketplace/plugins/plugins.module.ts
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { LayoutModule } from '../../shared/layout.module'; import { UbuntuConfigComponent } from './ubuntu/ubuntu.component.ts' import { CloudManConfigComponent } from './cloudman/cloudman.component.ts' import { GVLConfigComponent } from './gvl/gvl.component.ts' import { DockerConfigComponent } from './docker/docker.component.ts' import { DockerFileEditorComponent } from './docker/components/docker-file-editor.component.ts' import { SelectModule } from 'ng2-select'; import { MarkdownModule } from 'angular2-markdown'; @NgModule({ imports: [ CommonModule, FormsModule, ReactiveFormsModule, HttpModule, LayoutModule, SelectModule, MarkdownModule ], declarations: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent, DockerFileEditorComponent], exports: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent] }) export class PluginsModule { }
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms'; import { HttpModule } from '@angular/http'; import { LayoutModule } from '../../shared/layout.module'; import { UbuntuConfigComponent } from './ubuntu/ubuntu.component.ts' import { CloudManConfigComponent } from './cloudman/cloudman.component.ts' import { GVLConfigComponent } from './gvl/gvl.component.ts' import { DockerConfigComponent } from './docker/docker.component.ts' import { DockerFileEditorComponent } from './docker/components/docker-file-editor.component.ts' import { SelectModule } from 'ng2-select'; import { MarkdownModule } from 'angular2-markdown'; @NgModule({ imports: [ CommonModule, FormsModule, ReactiveFormsModule, HttpModule, LayoutModule, SelectModule, MarkdownModule ], declarations: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent, DockerFileEditorComponent], exports: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent], entryComponents: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent] }) export class PluginsModule { }
Fix to prevent removal of dynamic components during production builds
Fix to prevent removal of dynamic components during production builds
TypeScript
mit
galaxyproject/cloudlaunch-ui,galaxyproject/cloudlaunch-ui,galaxyproject/cloudlaunch-ui
--- +++ @@ -26,6 +26,8 @@ declarations: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, DockerConfigComponent, DockerFileEditorComponent], exports: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, - DockerConfigComponent] + DockerConfigComponent], + entryComponents: [UbuntuConfigComponent, CloudManConfigComponent, GVLConfigComponent, + DockerConfigComponent] }) export class PluginsModule { }
f98a2299d66d972dbc824a24881a6d89f880b378
src/lib/src/simple-select/component/simple-select.component.ts
src/lib/src/simple-select/component/simple-select.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'ng-simple-select', templateUrl: './simple-select.component.html', styleUrls: ['./simple-select.component.css'] }) export class SimpleSelectComponent { }
import { Component, forwardRef } from '@angular/core'; import { NG_VALUE_ACCESSOR } from '@angular/forms'; const SIMPLE_SELECT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => SimpleSelectComponent), multi: true, }; @Component({ selector: 'ng-simple-select', templateUrl: './simple-select.component.html', styleUrls: ['./simple-select.component.css'], providers: [SIMPLE_SELECT_VALUE_ACCESSOR], }) export class SimpleSelectComponent { private innerValue: any; private onChange = (_: any) => {}; private onTouched = () => {}; get value(): any { return this.innerValue; } set value(value: any) { if (this.innerValue !== value) { this.innerValue = value; this.onChange(value); } } writeValue(value: any) { if (this.innerValue !== value) { this.innerValue = value; } } registerOnChange(fn: (value: any) => void) { this.onChange = fn; } registerOnTouched(fn: () => void) { this.onTouched = fn; } }
Add value accessor to simple select
Add value accessor to simple select
TypeScript
mit
FriOne/ng-selectable,FriOne/ng-selectable,FriOne/ng-selectable
--- +++ @@ -1,10 +1,45 @@ -import { Component } from '@angular/core'; +import { Component, forwardRef } from '@angular/core'; +import { NG_VALUE_ACCESSOR } from '@angular/forms'; + +const SIMPLE_SELECT_VALUE_ACCESSOR = { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => SimpleSelectComponent), + multi: true, +}; @Component({ selector: 'ng-simple-select', templateUrl: './simple-select.component.html', - styleUrls: ['./simple-select.component.css'] + styleUrls: ['./simple-select.component.css'], + providers: [SIMPLE_SELECT_VALUE_ACCESSOR], }) export class SimpleSelectComponent { + private innerValue: any; + private onChange = (_: any) => {}; + private onTouched = () => {}; + get value(): any { + return this.innerValue; + } + + set value(value: any) { + if (this.innerValue !== value) { + this.innerValue = value; + this.onChange(value); + } + } + + writeValue(value: any) { + if (this.innerValue !== value) { + this.innerValue = value; + } + } + + registerOnChange(fn: (value: any) => void) { + this.onChange = fn; + } + + registerOnTouched(fn: () => void) { + this.onTouched = fn; + } }
8ea6bd35665dd958768c133dd5d4fc5d3db292ee
src/app.ts
src/app.ts
import * as errorHandler from './error_handler'; import * as machine from './machine'; var r = require('koa-route'); var bodyParser = require('koa-bodyparser'); var koa = require('koa'); var app = koa(); app.use(errorHandler.handle); app.use(bodyParser()); app.use(require('koa-trie-router')(app)); app.route('/machines') .get(machine.list) .post(machine.create); app.route('/machines/:name') .get(machine.inspect) .post(machine.create) .delete(machine.remove); app.listen(3000);
import * as errorHandler from './error_handler'; import * as machine from './machine'; var router = require('koa-trie-router'); var bodyParser = require('koa-bodyparser'); var koa = require('koa'); var app = koa(); app.use(errorHandler.handle); app.use(bodyParser()); app.use(router(app)); app.route('/machines') .get(machine.list) .post(machine.create); app.route('/machines/:name') .get(machine.inspect) .post(machine.create) .delete(machine.remove); app.listen(3000);
Fix koa-router not found bug
Fix koa-router not found bug
TypeScript
apache-2.0
lawrence0819/neptune-back
--- +++ @@ -1,14 +1,14 @@ import * as errorHandler from './error_handler'; import * as machine from './machine'; -var r = require('koa-route'); +var router = require('koa-trie-router'); var bodyParser = require('koa-bodyparser'); var koa = require('koa'); var app = koa(); app.use(errorHandler.handle); app.use(bodyParser()); -app.use(require('koa-trie-router')(app)); +app.use(router(app)); app.route('/machines') .get(machine.list)
b9f651f39805766a5c6415049a4d4a9ff68b0547
src/app/views/sessions/session/session.resolve.ts
src/app/views/sessions/session/session.resolve.ts
import { Injectable } from '@angular/core'; import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; import {SessionData} from "../../../model/session/session-data"; import SessionResource from "../../../shared/resources/session.resource"; @Injectable() export class SessionResolve implements Resolve<SessionData> { constructor(private sessionResource: SessionResource) {} resolve(route: ActivatedRouteSnapshot) { return this.sessionResource.loadSession(route.params['sessionId']); } }
import { Injectable } from '@angular/core'; import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; import {SessionData} from "../../../model/session/session-data"; import SessionResource from "../../../shared/resources/session.resource"; import SelectionService from "./selection.service"; @Injectable() export class SessionResolve implements Resolve<SessionData> { constructor(private sessionResource: SessionResource, private selectionService: SelectionService) {} resolve(route: ActivatedRouteSnapshot) { this.selectionService.clearSelection(); return this.sessionResource.loadSession(route.params['sessionId']); } }
Clear dataset selection when opening session
Clear dataset selection when opening session
TypeScript
mit
chipster/chipster-web,chipster/chipster-web,chipster/chipster-web
--- +++ @@ -2,13 +2,16 @@ import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; import {SessionData} from "../../../model/session/session-data"; import SessionResource from "../../../shared/resources/session.resource"; +import SelectionService from "./selection.service"; @Injectable() export class SessionResolve implements Resolve<SessionData> { - constructor(private sessionResource: SessionResource) {} + constructor(private sessionResource: SessionResource, + private selectionService: SelectionService) {} resolve(route: ActivatedRouteSnapshot) { + this.selectionService.clearSelection(); return this.sessionResource.loadSession(route.params['sessionId']); } }
c111cf32d216180573393bbed82fc91383b3635e
kspRemoteTechPlannerTest/objects/antennaEdit.ts
kspRemoteTechPlannerTest/objects/antennaEdit.ts
/// <reference path="../references.ts" />
/// <reference path="../references.ts" /> class AntennaEdit { 'use strict'; form: protractor.ElementFinder = element(by.xpath("//form[@name='antennaEditForm']")); name: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='name']")); typeOmni: protractor.ElementFinder = this.form.element(by.xpath(".//select[@ng-model='antennaEdit.editData.type']/option[@value='0']")); typeDish: protractor.ElementFinder = this.form.element(by.xpath(".//select[@ng-model='antennaEdit.editData.type']/option[@value='1']")); range: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='range']")); elcNeeded: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='elcNeeded']")); saveButton: protractor.ElementFinder = this.form.element(by.buttonText("Save")); cancelButton: protractor.ElementFinder = this.form.element(by.buttonText("Cancel")); addButton: protractor.ElementFinder = this.form.element(by.buttonText("Add new")); addAntenna(antenna) { this.addButton.click(); this.name.sendKeys(antenna.name); if (antenna.antennaType == 0) this.typeOmni.click(); else this.typeDish.click(); this.range.sendKeys(antenna.range); this.elcNeeded.sendKeys(antenna.elcNeeded); this.saveButton.click(); } }
Implement Antenna Edit page object.
Implement Antenna Edit page object.
TypeScript
mit
ryohpops/kspRemoteTechPlanner,ryohpops/kspRemoteTechPlanner,ryohpops/kspRemoteTechPlanner
--- +++ @@ -1 +1,28 @@ /// <reference path="../references.ts" /> + +class AntennaEdit { + 'use strict'; + + form: protractor.ElementFinder = element(by.xpath("//form[@name='antennaEditForm']")); + name: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='name']")); + typeOmni: protractor.ElementFinder = this.form.element(by.xpath(".//select[@ng-model='antennaEdit.editData.type']/option[@value='0']")); + typeDish: protractor.ElementFinder = this.form.element(by.xpath(".//select[@ng-model='antennaEdit.editData.type']/option[@value='1']")); + range: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='range']")); + elcNeeded: protractor.ElementFinder = this.form.element(by.xpath(".//input[@name='elcNeeded']")); + + saveButton: protractor.ElementFinder = this.form.element(by.buttonText("Save")); + cancelButton: protractor.ElementFinder = this.form.element(by.buttonText("Cancel")); + addButton: protractor.ElementFinder = this.form.element(by.buttonText("Add new")); + + addAntenna(antenna) { + this.addButton.click(); + this.name.sendKeys(antenna.name); + if (antenna.antennaType == 0) + this.typeOmni.click(); + else + this.typeDish.click(); + this.range.sendKeys(antenna.range); + this.elcNeeded.sendKeys(antenna.elcNeeded); + this.saveButton.click(); + } +}
36af9bfa506262b0dc934e0b4cb1a071862fc287
src/components/occurrence.tsx
src/components/occurrence.tsx
import * as React from 'react' export interface OccurrenceProps { isWriteAccess: boolean, width: number, height: number, top: number, left: number, } const Occurrence = (props: OccurrenceProps) => ( <div style={{ position: 'absolute', background: props.isWriteAccess ? 'rgba(14,99,156,.25)' : 'rgba(173,214,255,.3)', width: props.width, height: props.height, top: props.top, left: props.left }} /> ) export default Occurrence
import * as React from 'react' export interface OccurrenceProps { isWriteAccess: boolean, width: number, height: number, top: number, left: number, } const Occurrence = (props: OccurrenceProps) => ( <div style={{ position: 'absolute', background: props.isWriteAccess ? 'rgba(14,99,156,.4)' : 'rgba(173,214,255,.7)', width: props.width, height: props.height, top: props.top, left: props.left }} /> ) export default Occurrence
Fix colors to make it more highlighted
Fix colors to make it more highlighted
TypeScript
mit
pd4d10/intelli-octo,pd4d10/intelli-octo,pd4d10/intelli-octo
--- +++ @@ -12,7 +12,7 @@ <div style={{ position: 'absolute', - background: props.isWriteAccess ? 'rgba(14,99,156,.25)' : 'rgba(173,214,255,.3)', + background: props.isWriteAccess ? 'rgba(14,99,156,.4)' : 'rgba(173,214,255,.7)', width: props.width, height: props.height, top: props.top,
9e6ae487814a4c8e911b1f4ead25a6357ba4b386
src/browser/ui/dialog/dialog-title.directive.ts
src/browser/ui/dialog/dialog-title.directive.ts
import { Directive, Input, OnInit, Optional } from '@angular/core'; import { DialogRef } from './dialog-ref'; let uniqueId = 0; @Directive({ selector: '[gdDialogTitle]', host: { 'class': 'DialogTitle', }, }) export class DialogTitleDirective implements OnInit { @Input() id = `gd-dialog-title-${uniqueId++}`; constructor(@Optional() private dialogRef: DialogRef<any>) { } ngOnInit(): void { if (this.dialogRef && this.dialogRef.componentInstance) { Promise.resolve().then(() => { const container = this.dialogRef._containerInstance; if (container && !container._ariaLabelledBy) { container._ariaLabelledBy = this.id; } }); } } }
import { Directive, Input, OnInit, Optional } from '@angular/core'; import { DialogRef } from './dialog-ref'; let uniqueId = 0; @Directive({ selector: '[gdDialogTitle]', host: { 'class': 'DialogTitle', '[id]': 'id', }, }) export class DialogTitleDirective implements OnInit { @Input() id = `gd-dialog-title-${uniqueId++}`; constructor(@Optional() private dialogRef: DialogRef<any>) { } ngOnInit(): void { if (this.dialogRef && this.dialogRef.componentInstance) { Promise.resolve().then(() => { const container = this.dialogRef._containerInstance; if (container && !container._ariaLabelledBy) { container._ariaLabelledBy = this.id; } }); } } }
Fix host attribute not assigned
Fix host attribute not assigned
TypeScript
mit
seokju-na/geeks-diary,seokju-na/geeks-diary,seokju-na/geeks-diary
--- +++ @@ -9,6 +9,7 @@ selector: '[gdDialogTitle]', host: { 'class': 'DialogTitle', + '[id]': 'id', }, }) export class DialogTitleDirective implements OnInit {
b08b3d84ba68e26b3c8e5ed310680d57b2bc2e73
extensions/typescript/src/utils/commandManager.ts
extensions/typescript/src/utils/commandManager.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 vscode from 'vscode'; export interface Command { readonly id: string; execute(...args: any[]): void; } export class CommandManager { private readonly commands: vscode.Disposable[] = []; public dispose() { while (this.commands.length) { const obj = this.commands.pop(); if (obj) { obj.dispose(); } } } public registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any) { this.commands.push(vscode.commands.registerCommand(id, impl, thisArg)); } public register(command: Command) { this.registerCommand(command.id, command.execute, command); } }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; export interface Command { readonly id: string; execute(...args: any[]): void; } export class CommandManager { private readonly commands = new Map<string, vscode.Disposable>(); public dispose() { for (const registration of this.commands) { registration[1].dispose(); } this.commands.clear(); } public registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any) { if (this.commands.has(id)) { return; } this.commands.set(id, vscode.commands.registerCommand(id, impl, thisArg)); } public register(command: Command) { this.registerCommand(command.id, command.execute, command); } }
Use map to hold command registrations
Use map to hold command registrations
TypeScript
mit
mjbvz/vscode,rishii7/vscode,Zalastax/vscode,hoovercj/vscode,Zalastax/vscode,rishii7/vscode,microsoft/vscode,the-ress/vscode,Zalastax/vscode,hoovercj/vscode,rishii7/vscode,DustinCampbell/vscode,microlv/vscode,mjbvz/vscode,rishii7/vscode,DustinCampbell/vscode,the-ress/vscode,eamodio/vscode,landonepps/vscode,DustinCampbell/vscode,landonepps/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,veeramarni/vscode,cleidigh/vscode,DustinCampbell/vscode,microlv/vscode,Microsoft/vscode,Microsoft/vscode,rishii7/vscode,stringham/vscode,stringham/vscode,rishii7/vscode,veeramarni/vscode,0xmohit/vscode,DustinCampbell/vscode,microlv/vscode,stringham/vscode,joaomoreno/vscode,Zalastax/vscode,DustinCampbell/vscode,the-ress/vscode,hoovercj/vscode,landonepps/vscode,veeramarni/vscode,the-ress/vscode,microlv/vscode,landonepps/vscode,Microsoft/vscode,0xmohit/vscode,the-ress/vscode,microsoft/vscode,rishii7/vscode,mjbvz/vscode,the-ress/vscode,cleidigh/vscode,cleidigh/vscode,hoovercj/vscode,landonepps/vscode,Microsoft/vscode,0xmohit/vscode,mjbvz/vscode,stringham/vscode,eamodio/vscode,0xmohit/vscode,veeramarni/vscode,joaomoreno/vscode,cleidigh/vscode,rishii7/vscode,Microsoft/vscode,joaomoreno/vscode,microsoft/vscode,rishii7/vscode,stringham/vscode,Microsoft/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,rishii7/vscode,veeramarni/vscode,hoovercj/vscode,Zalastax/vscode,microsoft/vscode,0xmohit/vscode,landonepps/vscode,0xmohit/vscode,cleidigh/vscode,Zalastax/vscode,landonepps/vscode,DustinCampbell/vscode,joaomoreno/vscode,Zalastax/vscode,landonepps/vscode,microlv/vscode,0xmohit/vscode,microlv/vscode,Zalastax/vscode,eamodio/vscode,the-ress/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,rishii7/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,microlv/vscode,landonepps/vscode,eamodio/vscode,the-ress/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,microlv/vscode,Krzysztof-Cieslak/vscode,mjbvz/vscode,mjbvz/vscode,mjbvz/vscode,veeramarni/vscode,veeramarni/vscode,veeramarni/vscode,stringham/vscode,veeramarni/vscode,joaomoreno/vscode,DustinCampbell/vscode,the-ress/vscode,landonepps/vscode,mjbvz/vscode,0xmohit/vscode,cra0zy/VSCode,hoovercj/vscode,microsoft/vscode,microsoft/vscode,cleidigh/vscode,hoovercj/vscode,0xmohit/vscode,veeramarni/vscode,Microsoft/vscode,joaomoreno/vscode,mjbvz/vscode,hoovercj/vscode,microsoft/vscode,0xmohit/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,eamodio/vscode,stringham/vscode,landonepps/vscode,Zalastax/vscode,0xmohit/vscode,eamodio/vscode,stringham/vscode,the-ress/vscode,mjbvz/vscode,Microsoft/vscode,Microsoft/vscode,the-ress/vscode,hoovercj/vscode,stringham/vscode,microlv/vscode,Krzysztof-Cieslak/vscode,stringham/vscode,Microsoft/vscode,hoovercj/vscode,microlv/vscode,joaomoreno/vscode,Zalastax/vscode,joaomoreno/vscode,joaomoreno/vscode,Zalastax/vscode,eamodio/vscode,stringham/vscode,hoovercj/vscode,the-ress/vscode,cleidigh/vscode,microlv/vscode,0xmohit/vscode,veeramarni/vscode,microsoft/vscode,DustinCampbell/vscode,Microsoft/vscode,mjbvz/vscode,landonepps/vscode,DustinCampbell/vscode,mjbvz/vscode,mjbvz/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,veeramarni/vscode,rishii7/vscode,eamodio/vscode,DustinCampbell/vscode,cleidigh/vscode,microsoft/vscode,Zalastax/vscode,Krzysztof-Cieslak/vscode,Zalastax/vscode,DustinCampbell/vscode,joaomoreno/vscode,veeramarni/vscode,0xmohit/vscode,microlv/vscode,DustinCampbell/vscode,microsoft/vscode,Microsoft/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,hoovercj/vscode,hoovercj/vscode,veeramarni/vscode,veeramarni/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,cleidigh/vscode,microlv/vscode,mjbvz/vscode,eamodio/vscode,joaomoreno/vscode,Microsoft/vscode,mjbvz/vscode,joaomoreno/vscode,microlv/vscode,Zalastax/vscode,mjbvz/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,microlv/vscode,eamodio/vscode,DustinCampbell/vscode,cleidigh/vscode,Zalastax/vscode,cleidigh/vscode,Zalastax/vscode,Microsoft/vscode,eamodio/vscode,the-ress/vscode,rishii7/vscode,Microsoft/vscode,eamodio/vscode,stringham/vscode,joaomoreno/vscode,stringham/vscode,Zalastax/vscode,veeramarni/vscode,microsoft/vscode,mjbvz/vscode,hoovercj/vscode,stringham/vscode,stringham/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,microlv/vscode,joaomoreno/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,cleidigh/vscode,cleidigh/vscode,0xmohit/vscode,0xmohit/vscode,eamodio/vscode,0xmohit/vscode,0xmohit/vscode,rishii7/vscode,landonepps/vscode,veeramarni/vscode,microsoft/vscode,the-ress/vscode,the-ress/vscode,landonepps/vscode,rishii7/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,microlv/vscode,Microsoft/vscode,stringham/vscode,joaomoreno/vscode,cleidigh/vscode,eamodio/vscode,DustinCampbell/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,stringham/vscode,Microsoft/vscode
--- +++ @@ -12,19 +12,21 @@ } export class CommandManager { - private readonly commands: vscode.Disposable[] = []; + private readonly commands = new Map<string, vscode.Disposable>(); public dispose() { - while (this.commands.length) { - const obj = this.commands.pop(); - if (obj) { - obj.dispose(); - } + for (const registration of this.commands) { + registration[1].dispose(); } + this.commands.clear(); } public registerCommand(id: string, impl: (...args: any[]) => void, thisArg?: any) { - this.commands.push(vscode.commands.registerCommand(id, impl, thisArg)); + if (this.commands.has(id)) { + return; + } + + this.commands.set(id, vscode.commands.registerCommand(id, impl, thisArg)); } public register(command: Command) {
9a4dfbb1a871a3ece32717fe3d33227d4d5d2569
test/in-memory-dispatcher.ts
test/in-memory-dispatcher.ts
import {Disposable} from 'event-kit' import Dispatcher from '../src/dispatcher' import User from '../src/models/user' import Repository from '../src/models/repository' type State = {users: User[], repositories: Repository[]} export default class InMemoryDispatcher extends Dispatcher { public getUsers(): Promise<User[]> { return Promise.resolve([]) } public getRepositories(): Promise<Repository[]> { return Promise.resolve([]) } public requestOAuth(): Promise<void> { return Promise.resolve() } public onDidUpdate(fn: (state: State) => void): Disposable { return new Disposable(() => {}) } }
import {Disposable} from 'event-kit' import {Dispatcher} from '../src/lib/dispatcher' import User from '../src/models/user' import Repository from '../src/models/repository' type State = {users: User[], repositories: Repository[]} export default class InMemoryDispatcher extends Dispatcher { public getUsers(): Promise<User[]> { return Promise.resolve([]) } public getRepositories(): Promise<Repository[]> { return Promise.resolve([]) } public requestOAuth(): Promise<void> { return Promise.resolve() } public onDidUpdate(fn: (state: State) => void): Disposable { return new Disposable(() => {}) } }
Fix test dispatcher after rename
Fix test dispatcher after rename
TypeScript
mit
say25/desktop,BugTesterTest/desktops,BugTesterTest/desktops,BugTesterTest/desktops,artivilla/desktop,gengjiawen/desktop,desktop/desktop,gengjiawen/desktop,desktop/desktop,desktop/desktop,say25/desktop,j-f1/forked-desktop,desktop/desktop,hjobrien/desktop,BugTesterTest/desktops,hjobrien/desktop,j-f1/forked-desktop,artivilla/desktop,shiftkey/desktop,hjobrien/desktop,kactus-io/kactus,kactus-io/kactus,say25/desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,hjobrien/desktop,j-f1/forked-desktop,say25/desktop,shiftkey/desktop,artivilla/desktop,j-f1/forked-desktop,gengjiawen/desktop,kactus-io/kactus,gengjiawen/desktop,shiftkey/desktop
--- +++ @@ -1,5 +1,5 @@ import {Disposable} from 'event-kit' -import Dispatcher from '../src/dispatcher' +import {Dispatcher} from '../src/lib/dispatcher' import User from '../src/models/user' import Repository from '../src/models/repository'
bf0d95270c0b21eaa9a32a821a7c0e0a9a6c8147
ts/UIUtil/requestAnimationFrame.ts
ts/UIUtil/requestAnimationFrame.ts
/* * Copyright (c) 2015 ARATA Mizuki * This software is released under the MIT license. * See LICENSE.txt. */ module UIUtil { interface RAFWithVendorPrefix extends Window { mozRequestAnimationFrame(callback: FrameRequestCallback): number; webkitRequestAnimationFrame(callback: FrameRequestCallback): number; } if (!('requestAnimationFrame' in window)) { window.requestAnimationFrame = (<RAFWithVendorPrefix>window).mozRequestAnimationFrame || (<RAFWithVendorPrefix>window).webkitRequestAnimationFrame || (<RAFWithVendorPrefix>window).msRequestAnimationFrame; } }
/* * Copyright (c) 2015 ARATA Mizuki * This software is released under the MIT license. * See LICENSE.txt. */ module UIUtil { interface RAFWithVendorPrefix extends Window { mozRequestAnimationFrame(callback: FrameRequestCallback): number; webkitRequestAnimationFrame(callback: FrameRequestCallback): number; msRequestAnimationFrame(callback: FrameRequestCallback): number; } if (!('requestAnimationFrame' in window)) { window.requestAnimationFrame = (<RAFWithVendorPrefix>window).mozRequestAnimationFrame || (<RAFWithVendorPrefix>window).webkitRequestAnimationFrame || (<RAFWithVendorPrefix>window).msRequestAnimationFrame; } }
Add type definition for msRequestAnimationFrame
Add type definition for msRequestAnimationFrame
TypeScript
mit
minoki/singularity
--- +++ @@ -9,6 +9,7 @@ interface RAFWithVendorPrefix extends Window { mozRequestAnimationFrame(callback: FrameRequestCallback): number; webkitRequestAnimationFrame(callback: FrameRequestCallback): number; + msRequestAnimationFrame(callback: FrameRequestCallback): number; } if (!('requestAnimationFrame' in window)) { window.requestAnimationFrame =
5882ff4328bb7ba6a38a89dc3a83bf7e8142f7a4
test/example.mocha.ts
test/example.mocha.ts
/// <reference path="../node_modules/@types/mocha/index.d.ts" /> /// <reference path="../node_modules/@types/chai/index.d.ts" /> /// <reference path="../node_modules/@types/sinon/index.d.ts" /> /** * Module dependencies. */ import * as chai from 'chai'; /** * Globals */ var expect = chai.expect; /** * Unit tests */ describe('User Model Unit Tests:', () => { describe('2 + 4', () => { it('should be 6', (done) => { expect(2+4).to.equals(6); done(); }); it('should not be 7', (done) => { expect(2+4).to.not.equals(7); done(); }); }); });
/** * Module dependencies. */ import * as chai from 'chai'; /** * Globals */ var expect = chai.expect; /** * Unit tests */ describe('User Model Unit Tests:', () => { describe('2 + 4', () => { it('should be 6', (done) => { expect(2+4).to.equals(6); done(); }); it('should not be 7', (done) => { expect(2+4).to.not.equals(7); done(); }); }); });
Remove reference to sinon causing the tests to fail
Remove reference to sinon causing the tests to fail
TypeScript
mit
robertmain/jukebox,robertmain/jukebox
--- +++ @@ -1,7 +1,3 @@ -/// <reference path="../node_modules/@types/mocha/index.d.ts" /> -/// <reference path="../node_modules/@types/chai/index.d.ts" /> -/// <reference path="../node_modules/@types/sinon/index.d.ts" /> - /** * Module dependencies. */
265f0dce760942fa746a5cc9eb60f56e0fc1cc39
packages/@sanity/structure/src/SerializeError.ts
packages/@sanity/structure/src/SerializeError.ts
import {SerializePath} from './StructureNodes' export class SerializeError extends Error { public readonly path: SerializePath public helpId?: HELP_URL constructor( message: string, parentPath: SerializePath, pathSegment: string | number | undefined, hint?: string ) { super(message) const segment = typeof pathSegment === 'undefined' ? '<unknown>' : `${pathSegment}` this.path = parentPath.concat(hint ? `${segment} (${hint})` : segment) } withHelpUrl(id: HELP_URL): SerializeError { this.helpId = id return this } } export enum HELP_URL { ID_REQUIRED = 'structure-node-id-required', TITLE_REQUIRED = 'structure-title-requried', FILTER_REQUIRED = 'structure-filter-required', INVALID_LIST_ITEM = 'structure-invalid-list-item', DOCUMENT_ID_REQUIRED = 'structure-document-id-required', SCHEMA_TYPE_REQUIRED = 'structure-schema-type-required', SCHEMA_TYPE_NOT_FOUND = 'structure-schema-type-not-found', DOCUMENT_TYPE_REQUIRED = 'structure-document-type-required', QUERY_PROVIDED_FOR_FILTER = 'structure-query-provided-for-filter', ACTION_OR_INTENT_REQUIRED = 'structure-action-or-intent-required', ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE = 'structure-action-and-intent-mutually-exclusive' }
import {SerializePath} from './StructureNodes' export class SerializeError extends Error { public readonly path: SerializePath public helpId?: HELP_URL constructor( message: string, parentPath: SerializePath, pathSegment: string | number | undefined, hint?: string ) { super(message) const segment = typeof pathSegment === 'undefined' ? '<unknown>' : `${pathSegment}` this.path = (parentPath || []).concat(hint ? `${segment} (${hint})` : segment) } withHelpUrl(id: HELP_URL): SerializeError { this.helpId = id return this } } export enum HELP_URL { ID_REQUIRED = 'structure-node-id-required', TITLE_REQUIRED = 'structure-title-requried', FILTER_REQUIRED = 'structure-filter-required', INVALID_LIST_ITEM = 'structure-invalid-list-item', DOCUMENT_ID_REQUIRED = 'structure-document-id-required', SCHEMA_TYPE_REQUIRED = 'structure-schema-type-required', SCHEMA_TYPE_NOT_FOUND = 'structure-schema-type-not-found', DOCUMENT_TYPE_REQUIRED = 'structure-document-type-required', QUERY_PROVIDED_FOR_FILTER = 'structure-query-provided-for-filter', ACTION_OR_INTENT_REQUIRED = 'structure-action-or-intent-required', ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE = 'structure-action-and-intent-mutually-exclusive' }
Fix serialization error when parent path is not set
[structure] Fix serialization error when parent path is not set
TypeScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -12,7 +12,7 @@ ) { super(message) const segment = typeof pathSegment === 'undefined' ? '<unknown>' : `${pathSegment}` - this.path = parentPath.concat(hint ? `${segment} (${hint})` : segment) + this.path = (parentPath || []).concat(hint ? `${segment} (${hint})` : segment) } withHelpUrl(id: HELP_URL): SerializeError {
3ccf5afba6637a4df3237176581b3757c0a7545a
app/src/ui/confirm-dialog.tsx
app/src/ui/confirm-dialog.tsx
import * as React from 'react' import { Dispatcher } from '../lib/dispatcher' import { ButtonGroup } from '../ui/lib/button-group' import { Button } from '../ui/lib/button' import { Dialog, DialogContent, DialogFooter } from '../ui/dialog' interface IConfirmDialogProps { readonly dispatcher: Dispatcher readonly title: string readonly message: string readonly onConfirmation: () => void } export class ConfirmDialog extends React.Component<IConfirmDialogProps, void> { public constructor(props: IConfirmDialogProps) { super(props) } private cancel = () => { this.props.dispatcher.closePopup() } private onConfirmed = () => { this.props.onConfirmation() this.props.dispatcher.closePopup() } public render() { return ( <Dialog title={this.props.title} onDismissed={this.cancel} onSubmit={this.onConfirmed} > <DialogContent> {this.props.message} </DialogContent> <DialogFooter> <ButtonGroup> <Button type='submit'>Yes</Button> <Button onClick={this.cancel}>No</Button> </ButtonGroup> </DialogFooter> </Dialog> ) } }
import * as React from 'react' import { ButtonGroup } from '../ui/lib/button-group' import { Button } from '../ui/lib/button' import { Dialog, DialogContent, DialogFooter } from '../ui/dialog' interface IConfirmDialogProps { readonly title: string readonly message: string readonly onConfirmation: () => void readonly onDismissed: () => void } export class ConfirmDialog extends React.Component<IConfirmDialogProps, void> { public constructor(props: IConfirmDialogProps) { super(props) } private cancel = () => { this.props.onDismissed() } private onConfirmed = () => { this.props.onConfirmation() this.props.onDismissed() } public render() { return ( <Dialog title={this.props.title} onDismissed={this.cancel} onSubmit={this.onConfirmed} > <DialogContent> {this.props.message} </DialogContent> <DialogFooter> <ButtonGroup> <Button type='submit'>Yes</Button> <Button onClick={this.cancel}>No</Button> </ButtonGroup> </DialogFooter> </Dialog> ) } }
Remove dependency on dispatcher in favor of event handler
Remove dependency on dispatcher in favor of event handler
TypeScript
mit
BugTesterTest/desktops,say25/desktop,j-f1/forked-desktop,BugTesterTest/desktops,BugTesterTest/desktops,artivilla/desktop,kactus-io/kactus,gengjiawen/desktop,gengjiawen/desktop,shiftkey/desktop,shiftkey/desktop,hjobrien/desktop,hjobrien/desktop,say25/desktop,shiftkey/desktop,artivilla/desktop,BugTesterTest/desktops,desktop/desktop,desktop/desktop,artivilla/desktop,say25/desktop,kactus-io/kactus,kactus-io/kactus,desktop/desktop,say25/desktop,gengjiawen/desktop,hjobrien/desktop,gengjiawen/desktop,desktop/desktop,j-f1/forked-desktop,kactus-io/kactus,shiftkey/desktop,artivilla/desktop,hjobrien/desktop,j-f1/forked-desktop,j-f1/forked-desktop
--- +++ @@ -1,14 +1,13 @@ import * as React from 'react' -import { Dispatcher } from '../lib/dispatcher' import { ButtonGroup } from '../ui/lib/button-group' import { Button } from '../ui/lib/button' import { Dialog, DialogContent, DialogFooter } from '../ui/dialog' interface IConfirmDialogProps { - readonly dispatcher: Dispatcher readonly title: string readonly message: string readonly onConfirmation: () => void + readonly onDismissed: () => void } export class ConfirmDialog extends React.Component<IConfirmDialogProps, void> { @@ -17,12 +16,12 @@ } private cancel = () => { - this.props.dispatcher.closePopup() + this.props.onDismissed() } private onConfirmed = () => { this.props.onConfirmation() - this.props.dispatcher.closePopup() + this.props.onDismissed() } public render() {
65c70eec98424b7a79f03655d5f7b9a4723191bc
ts/gulpbrowser.browserify.ts
ts/gulpbrowser.browserify.ts
/// <reference path="./typings/main.d.ts" /> import plugins = require("./gulpbrowser.plugins"); let browserify = function(transforms) { transforms = transforms || []; if (typeof transforms === 'function') { transforms = [transforms]; } let forEach = function(file, enc, cb){ // do this with every chunk (file in gulp terms) let bundleCallback = function(err, bufferedContent) { // our bundle callback for when browserify is finished if (Buffer.isBuffer(bufferedContent)){ file.contents = bufferedContent; } else { plugins.beautylog.error("gulp-browser: .browserify() " + err.message); cb(new Error(err.message),file); return; } cb(null,file); }; if(file.contents.length > 0){ let browserified = plugins.browserify(file, { basedir: file.base }); transforms.forEach(function (transform) { if (typeof transform === 'function') { browserified.transform(transform); } else { browserified.transform(transform.transform, transform.options); } }); browserified.bundle(bundleCallback); } else { plugins.beautylog.warn("gulp-browser: .browserify() file.contents appears to be empty"); cb(null,file); }; } let atEnd = function(cb){ cb(); } // no need to clean up after ourselves return plugins.through.obj(forEach,atEnd); // this is the through object that gets returned by gulpBrowser.browserify(); }; export = browserify;
/// <reference path="./typings/main.d.ts" /> import plugins = require("./gulpbrowser.plugins"); let browserify = function(transforms) { transforms = transforms || []; if (!Array.isArray(transforms)) { transforms = [transforms]; } let forEach = function(file, enc, cb){ // do this with every chunk (file in gulp terms) let bundleCallback = function(err, bufferedContent) { // our bundle callback for when browserify is finished if (Buffer.isBuffer(bufferedContent)){ file.contents = bufferedContent; } else { plugins.beautylog.error("gulp-browser: .browserify() " + err.message); cb(new Error(err.message),file); return; } cb(null,file); }; if(file.contents.length > 0){ let browserified = plugins.browserify(file, { basedir: file.base }); transforms.forEach(function (transform) { if (typeof transform === 'function') { browserified.transform(transform); } else { browserified.transform(transform.transform, transform.options); } }); browserified.bundle(bundleCallback); } else { plugins.beautylog.warn("gulp-browser: .browserify() file.contents appears to be empty"); cb(null,file); }; } let atEnd = function(cb){ cb(); } // no need to clean up after ourselves return plugins.through.obj(forEach,atEnd); // this is the through object that gets returned by gulpBrowser.browserify(); }; export = browserify;
Fix bug where passing an object with transform options causes an exception.
Fix bug where passing an object with transform options causes an exception.
TypeScript
mit
pushrocks/gulp-browser,pushrocks/gulp-browser
--- +++ @@ -5,7 +5,7 @@ let browserify = function(transforms) { transforms = transforms || []; - if (typeof transforms === 'function') { + if (!Array.isArray(transforms)) { transforms = [transforms]; }
caadf4f3840bf24b3c5c83dc34f570058ef06457
nodetest/index.ts
nodetest/index.ts
import { range } from "linq-to-typescript" const primeNumbers = range(2, 10000) .select((i) => [i, Math.floor(Math.sqrt(i))]) .where(([i, iSq]) => range(2, iSq).all((j) => i % j !== 0)) .select(([prime]) => prime) .toArray() console.log(primeNumbers)
import { range } from "linq-to-typescript" const primeNumbers = range(2, 10000) .select((i) => [i, Math.floor(Math.sqrt(i))]) .where(([i, iSq]) => range(2, iSq).all((j) => i % j !== 0)) .select(([prime]) => prime) .toArray() async function asyncIterable() { for await (const i of range(0, 10).selectAsync(async (x) => x * 2)) { console.log(i) } } asyncIterable() console.log(primeNumbers)
Test async iterable with node test
Test async iterable with node test
TypeScript
mit
arogozine/LinqToTypeScript,arogozine/LinqToTypeScript
--- +++ @@ -7,4 +7,11 @@ .select(([prime]) => prime) .toArray() +async function asyncIterable() { + for await (const i of range(0, 10).selectAsync(async (x) => x * 2)) { + console.log(i) + } +} + +asyncIterable() console.log(primeNumbers)
165dabd09bafcffac50ab33035cc7978feba57d5
source/commands/danger-local.ts
source/commands/danger-local.ts
#! /usr/bin/env node import program from "commander" import setSharedArgs, { SharedCLI } from "./utils/sharedDangerfileArgs" import { runRunner } from "./ci/runner" import { LocalGit } from "../platforms/LocalGit" import { FakeCI } from "../ci_source/providers/Fake" interface App extends SharedCLI { /** What should we compare against? */ base?: string /** Should we run against current staged changes? */ staging?: boolean } program .usage("[options]") // TODO: this option // .option("-s, --staging", "Just use staged changes.") .description("Runs danger without PR metadata, useful for git hooks.") .option("-b, --base [branch_name]", "Use a different base branch") setSharedArgs(program).parse(process.argv) const app = (program as any) as App const base = app.base || "master" const localPlatform = new LocalGit({ base, staged: app.staging }) localPlatform.validateThereAreChanges().then(changes => { if (changes) { const fakeSource = new FakeCI(process.env) // By setting the custom env var we can be sure that the runner doesn't // try to find the CI danger is running on and use that. runRunner(app, { source: fakeSource, platform: localPlatform, additionalEnvVars: { DANGER_LOCAL_NO_CI: "yep" } }) } else { console.log("No git changes detected between head and master.") } })
#! /usr/bin/env node import program from "commander" import setSharedArgs, { SharedCLI } from "./utils/sharedDangerfileArgs" import { runRunner } from "./ci/runner" import { LocalGit } from "../platforms/LocalGit" import { FakeCI } from "../ci_source/providers/Fake" interface App extends SharedCLI { /** What should we compare against? */ base?: string /** Should we run against current staged changes? */ staging?: boolean } program .usage("[options]") // TODO: this option // .option("-s, --staging", "Just use staged changes.") .description("Runs danger without PR metadata, useful for git hooks.") .option("-b, --base [branch_name]", "Use a different base branch") setSharedArgs(program).parse(process.argv) const app = (program as any) as App const base = app.base || "master" const localPlatform = new LocalGit({ base, staged: app.staging }) localPlatform.validateThereAreChanges().then(changes => { if (changes) { const fakeSource = new FakeCI(process.env) // By setting the custom env var we can be sure that the runner doesn't // try to find the CI danger is running on and use that. runRunner(app, { source: fakeSource, platform: localPlatform, additionalEnvVars: { DANGER_LOCAL_NO_CI: "yep" } }) } else { console.log(`No git changes detected between head and ${base}.`) } })
Fix danger local message when branch is not master
Fix danger local message when branch is not master The message when there are no changes had a hardcoded value of `master` instead of using the value of `base`, which coudl have been changed with the command line options.
TypeScript
mit
danger/danger-js,danger/danger-js,danger/danger-js,danger/danger-js
--- +++ @@ -33,6 +33,6 @@ // try to find the CI danger is running on and use that. runRunner(app, { source: fakeSource, platform: localPlatform, additionalEnvVars: { DANGER_LOCAL_NO_CI: "yep" } }) } else { - console.log("No git changes detected between head and master.") + console.log(`No git changes detected between head and ${base}.`) } })
585c7686abd759d2a24a52aeaec4119b3865dd0c
ui/src/shared/documents/DocumentHierarchyHeader.tsx
ui/src/shared/documents/DocumentHierarchyHeader.tsx
import React, { ReactElement } from 'react'; import { Card } from 'react-bootstrap'; import { ResultDocument } from '../../api/result'; import DocumentTeaser from '../document/DocumentTeaser'; export default function DocumentHierarchyHeader({ documents, searchParams } : { documents: ResultDocument[], searchParams: string } ): ReactElement { const firstDoc = documents?.[0]; const project = firstDoc?.project; return documents.length ? <Card.Header className="hierarchy-parent"> <DocumentTeaser project={ project } searchParams={ searchParams } document={ getParentDocument(firstDoc) } hierarchyHeader={ true } /> </Card.Header> : <></>; } const getParentDocument = (doc: ResultDocument): ResultDocument | undefined => doc.resource.relations?.isChildOf[0];
import React, { ReactElement } from 'react'; import { Card } from 'react-bootstrap'; import { ResultDocument } from '../../api/result'; import DocumentTeaser from '../document/DocumentTeaser'; export default function DocumentHierarchyHeader({ documents, searchParams } : { documents: ResultDocument[], searchParams: string } ): ReactElement { const firstDoc = documents?.[0]; const project = firstDoc?.project; return documents.length ? <Card.Header className="hierarchy-parent"> <DocumentTeaser project={ project } searchParams={ searchParams } document={ getParentDocument(firstDoc) } hierarchyHeader={ true } /> </Card.Header> : <></>; } const getParentDocument = (doc: ResultDocument): ResultDocument | undefined => doc.resource.relations?.isChildOf?.[0];
Fix bug in document hierarchy header
Fix bug in document hierarchy header
TypeScript
apache-2.0
dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web
--- +++ @@ -21,4 +21,4 @@ const getParentDocument = (doc: ResultDocument): ResultDocument | undefined => - doc.resource.relations?.isChildOf[0]; + doc.resource.relations?.isChildOf?.[0];
86424db6bd38fa5f200434a3c1a13b8ce5f66181
saleor/static/dashboard-next/components/Money/Money.tsx
saleor/static/dashboard-next/components/Money/Money.tsx
import Typography, { TypographyProps } from "@material-ui/core/Typography"; import * as React from "react"; import { LocaleConsumer } from "../Locale"; export interface MoneyProp { amount: number; currency: string; } interface MoneyProps { moneyDetalis: MoneyProp; typographyProps?: TypographyProps; } export const Money: React.StatelessComponent<MoneyProps> = ({ moneyDetalis, typographyProps }) => ( <LocaleConsumer> {locale => { const money = moneyDetalis.amount.toLocaleString(locale, { currency: moneyDetalis.currency, style: "currency" }); if (typographyProps) { return <Typography {...typographyProps}>{money}</Typography>; } return <>{money}</>; }} </LocaleConsumer> ); export default Money;
import Typography, { TypographyProps } from "@material-ui/core/Typography"; import * as React from "react"; import { LocaleConsumer } from "../Locale"; export interface MoneyProp { amount: number; currency: string; } interface MoneyProps { moneyDetalis: MoneyProp; typographyProps?: TypographyProps; inline?; } export const Money: React.StatelessComponent<MoneyProps> = ({ moneyDetalis, typographyProps, inline }) => ( <LocaleConsumer> {locale => { const money = moneyDetalis.amount.toLocaleString(locale, { currency: moneyDetalis.currency, style: "currency" }); if (typographyProps) { return <Typography {...typographyProps}>{money}</Typography>; } if (inline) { return <span>{money}</span>; } return <>{money}</>; }} </LocaleConsumer> ); export default Money;
Add inline prop for money component
Add inline prop for money component
TypeScript
bsd-3-clause
UITools/saleor,mociepka/saleor,UITools/saleor,mociepka/saleor,maferelo/saleor,mociepka/saleor,maferelo/saleor,UITools/saleor,maferelo/saleor,UITools/saleor,UITools/saleor
--- +++ @@ -10,11 +10,13 @@ interface MoneyProps { moneyDetalis: MoneyProp; typographyProps?: TypographyProps; + inline?; } export const Money: React.StatelessComponent<MoneyProps> = ({ moneyDetalis, - typographyProps + typographyProps, + inline }) => ( <LocaleConsumer> {locale => { @@ -25,6 +27,9 @@ if (typographyProps) { return <Typography {...typographyProps}>{money}</Typography>; } + if (inline) { + return <span>{money}</span>; + } return <>{money}</>; }} </LocaleConsumer>
fc3238a5051e093671232b2ea01a348e654d49e4
app/src/cors.ts
app/src/cors.ts
/**  * @file CORS middleware  * @author Dave Ross <[email protected]>  */ import { Application, Request, Response } from "polka" export default function corsAllowAll(server: Application) { server.use("/graphql", function (req: Request, res: Response, next: Function) { res.setHeader('Access-Control-Allow-Origin', '*') res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS' ) res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept') if (req.method === 'OPTIONS') { res.statusCode = 200 res.end() } else { next() } }); }
/**  * @file CORS middleware  * @author Dave Ross <[email protected]>  */ import { Application, Request, Response } from "polka" export default function corsAllowAll(server: Application) { server.use("/*", function (req: Request, res: Response, next: Function) { res.setHeader('Access-Control-Allow-Origin', '*') res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS' ) res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept') if (req.method === 'OPTIONS') { res.statusCode = 200 res.end() } else { next() } }); }
Apply CORS to all API URLs
Apply CORS to all API URLs
TypeScript
mit
daveross/catalogopolis-api,daveross/catalogopolis-api
--- +++ @@ -7,7 +7,7 @@ export default function corsAllowAll(server: Application) { - server.use("/graphql", function (req: Request, res: Response, next: Function) { + server.use("/*", function (req: Request, res: Response, next: Function) { res.setHeader('Access-Control-Allow-Origin', '*') res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS' ) res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
d2b184b0b1f6da24f944c04e0b8291119d9c5f68
app-frontend/app/src/root.tsx
app-frontend/app/src/root.tsx
import * as React from "react"; import {Home} from "./pages/home/home"; import {Route, BrowserRouter} from "react-router-dom"; import {Switch} from "react-router"; import {Kugs} from "./pages/kugs/Kugs"; import {Articles} from "./pages/articles/articles"; export function Root() { return ( <BrowserRouter> <Switch> <Route exact path="/" component={Home}/> <Route path="/articles" component={Articles}/> <Route path="/kugs" component={Kugs}/> </Switch> </BrowserRouter> ); }
import * as React from "react"; import {Home} from "./pages/home/home"; import {Route, BrowserRouter} from "react-router-dom"; import {Switch} from "react-router"; import {Kugs} from "./pages/kugs/kugs"; import {Articles} from "./pages/articles/articles"; export function Root() { return ( <BrowserRouter> <Switch> <Route exact path="/" component={Home}/> <Route path="/articles" component={Articles}/> <Route path="/kugs" component={Kugs}/> </Switch> </BrowserRouter> ); }
Fix broken build because of macOS case-insensitive FS :(
Fix broken build because of macOS case-insensitive FS :(
TypeScript
apache-2.0
KotlinBy/awesome-kotlin,KotlinBy/awesome-kotlin,KotlinBy/awesome-kotlin,KotlinBy/awesome-kotlin
--- +++ @@ -2,7 +2,7 @@ import {Home} from "./pages/home/home"; import {Route, BrowserRouter} from "react-router-dom"; import {Switch} from "react-router"; -import {Kugs} from "./pages/kugs/Kugs"; +import {Kugs} from "./pages/kugs/kugs"; import {Articles} from "./pages/articles/articles"; export function Root() {
3d9804844291b30584d9b7a0791df762fe3d1ae5
packages/core/src/helperFunctions/KnownValues.ts
packages/core/src/helperFunctions/KnownValues.ts
export default class KnownValues { _knownValues: any = {}; _knownValuesMap = new Map(); constructor() { Object.assign(this._knownValues, { "String.prototype.slice": String.prototype.slice, "String.prototype.substr": String.prototype.substr, "String.prototype.replace": String.prototype.replace, "String.prototype.trim": String.prototype.trim, "Array.prototype.push": Array.prototype.push, "Array.prototype.join": Array.prototype.join, "JSON.parse": JSON.parse, "Object.keys": Object.keys, undefined: undefined, null: null }); var global = Function("return this")(); if (global["localStorage"]) { Object.assign(this._knownValues, { localStorage: global.localStorage, "localStorage.getItem": global.localStorage.getItem }); } Object.keys(this._knownValues).forEach(key => { this._knownValuesMap.set(this._knownValues[key], key); }); } getName(value) { let knownValue = this._knownValuesMap.get(value); if (!knownValue) { knownValue = null; } return knownValue; } getValue(name: string) { return this._knownValues[name]; } }
export default class KnownValues { _knownValues: any = {}; _knownValuesMap = new Map(); constructor() { Object.assign(this._knownValues, { "String.prototype.slice": String.prototype.slice, "String.prototype.substr": String.prototype.substr, "String.prototype.replace": String.prototype.replace, "String.prototype.trim": String.prototype.trim, "Array.prototype.push": Array.prototype.push, "Array.prototype.join": Array.prototype.join, "JSON.parse": JSON.parse, "Object.keys": Object.keys, "Number.prototype.toString": Number.prototype.toString, "Boolean.prototype.toString": Boolean.prototype.toString, "Object.prototype.toString": Object.prototype.toString, "String.prototype.toString": String.prototype.toString, "Date.prototype.getMinutes": Date.prototype.getMinutes, "Date.prototype.getHours": Date.prototype.getHours, undefined: undefined, null: null }); var global = Function("return this")(); if (global["localStorage"]) { Object.assign(this._knownValues, { localStorage: global.localStorage, "localStorage.getItem": global.localStorage.getItem }); } Object.keys(this._knownValues).forEach(key => { this._knownValuesMap.set(this._knownValues[key], key); }); } getName(value) { let knownValue = this._knownValuesMap.get(value); if (!knownValue) { knownValue = null; } return knownValue; } getValue(name: string) { return this._knownValues[name]; } }
Add more known values so their names show up alongside call expressions
Add more known values so their names show up alongside call expressions
TypeScript
mit
mattzeunert/FromJS,mattzeunert/FromJS,mattzeunert/FromJS,mattzeunert/FromJS
--- +++ @@ -12,6 +12,12 @@ "Array.prototype.join": Array.prototype.join, "JSON.parse": JSON.parse, "Object.keys": Object.keys, + "Number.prototype.toString": Number.prototype.toString, + "Boolean.prototype.toString": Boolean.prototype.toString, + "Object.prototype.toString": Object.prototype.toString, + "String.prototype.toString": String.prototype.toString, + "Date.prototype.getMinutes": Date.prototype.getMinutes, + "Date.prototype.getHours": Date.prototype.getHours, undefined: undefined, null: null });
54a93f288fa75e80c33b5d113db224aa6df5891b
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.16.0', RELEASEVERSION: '0.16.0' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.17.0', RELEASEVERSION: '0.17.0' }; export = BaseConfig;
Update release version to 0.17.0.
Update release version to 0.17.0.
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.16.0', - RELEASEVERSION: '0.16.0' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.17.0', + RELEASEVERSION: '0.17.0' }; export = BaseConfig;
0db0aa32f7ec73317db11ab996765db9619f8633
tests/usage.ts
tests/usage.ts
// File for testing typescript usage import { Jomini, toArray } from ".."; (async function () { const jomini = await Jomini.initialize(); let actual = jomini.parseText("a=b"); if (actual["a"] != "b") { throw new Error("unexpected result"); } actual = jomini.parseText("a=b", { encoding: "utf8" }); actual = jomini.parseText("a=b", { encoding: "windows1252" }); actual = jomini.parseText("a=b", {}, (cb) => cb.at("/a")); toArray(actual, "a"); const _out = jomini.write((writer) => { writer.write_integer(1); writer.write_integer(2); writer.write_unquoted("foo"); writer.write_quoted("bar"); }); })();
// File for testing typescript usage import { Jomini, toArray } from ".."; (async function () { const jomini = await Jomini.initialize(); let actual = jomini.parseText("a=b"); if (actual["a"] != "b") { throw new Error("unexpected result"); } actual = jomini.parseText("a=b", { encoding: "utf8" }); actual = jomini.parseText("a=b", { encoding: "windows1252" }); actual = jomini.parseText("a=b", {}, (cb) => cb.at("/a")); toArray(actual, "a"); const _out = jomini.write((writer) => { writer.write_integer(1); writer.write_integer(2); writer.write_unquoted("foo"); writer.write_quoted("bar"); }); Jomini.resetModule(); const wasmModule = null as unknown as WebAssembly.Module; await Jomini.initialize({ wasm: wasmModule, }); })();
Add wasm initialization test case
Add wasm initialization test case
TypeScript
mit
nickbabcock/jomini,nickbabcock/jomini,nickbabcock/jomini
--- +++ @@ -19,4 +19,11 @@ writer.write_unquoted("foo"); writer.write_quoted("bar"); }); + + Jomini.resetModule(); + + const wasmModule = null as unknown as WebAssembly.Module; + await Jomini.initialize({ + wasm: wasmModule, + }); })();
1351967a9949829ecd25c2a9daa7e6d773ee5dc9
packages/delir-core/src/helper/ProjectMigrator.ts
packages/delir-core/src/helper/ProjectMigrator.ts
import * as _ from 'lodash' export default { isMigratable: (project: ProjectScheme) => { return false }, migrate: (project: ProjectScheme) => { return project } }
import * as _ from 'lodash' export default { isMigratable: (project: any) => { return false }, migrate: (project: any) => { return project } }
Remove old version project migration support
Remove old version project migration support
TypeScript
mit
Ragg-/Delir,Ragg-/Delir,Ragg-/Delir,Ragg-/Delir
--- +++ @@ -1,11 +1,11 @@ import * as _ from 'lodash' export default { - isMigratable: (project: ProjectScheme) => { + isMigratable: (project: any) => { return false }, - migrate: (project: ProjectScheme) => { + migrate: (project: any) => { return project } }
c48c7201adba45af5d72922e0aa5dda455548a84
src/background/completion/impl/BookmarkRepositoryImpl.ts
src/background/completion/impl/BookmarkRepositoryImpl.ts
import BookmarkRepository, {BookmarkItem} from "../BookmarkRepository"; import {HistoryItem} from "../HistoryRepository"; import PrefetchAndCache from "./PrefetchAndCache"; const COMPLETION_ITEM_LIMIT = 10; export default class CachedBookmarkRepository implements BookmarkRepository { private bookmarkCache: PrefetchAndCache<BookmarkItem>; constructor() { this.bookmarkCache = new PrefetchAndCache(this.getter, this.filter, 10,); } queryBookmarks(query: string): Promise<BookmarkItem[]> { return this.bookmarkCache.get(query); } private async getter(query: string): Promise<BookmarkItem[]> { const items = await browser.bookmarks.search({query}); return items .filter(item => item.title && item.title.length > 0) .filter(item => item.type === 'bookmark' && item.url) .filter((item) => { let url = undefined; try { url = new URL(item.url!!); } catch (e) { return false; } return url.protocol !== 'place:'; }) .slice(0, COMPLETION_ITEM_LIMIT) .map(item => ({ title: item.title!!, url: item.url!!, })); } private filter(items: HistoryItem[], query: string) { return items.filter(item => { return query.split(' ').some(keyword => { return item.title.toLowerCase().includes(keyword.toLowerCase()) || item.url.includes(keyword) }); }) }; }
import BookmarkRepository, {BookmarkItem} from "../BookmarkRepository"; import {HistoryItem} from "../HistoryRepository"; import PrefetchAndCache from "./PrefetchAndCache"; const COMPLETION_ITEM_LIMIT = 10; export default class CachedBookmarkRepository implements BookmarkRepository { private bookmarkCache: PrefetchAndCache<BookmarkItem>; constructor() { this.bookmarkCache = new PrefetchAndCache(this.getter, this.filter, 10,); } queryBookmarks(query: string): Promise<BookmarkItem[]> { return this.bookmarkCache.get(query); } private async getter(query: string): Promise<BookmarkItem[]> { const items = await browser.bookmarks.search({query}); return items .filter(item => item.title && item.title.length > 0) .filter(item => item.type === 'bookmark' && item.url) .filter((item) => { let url = undefined; try { url = new URL(item.url!!); } catch (e) { return false; } return url.protocol !== 'place:'; }) .slice(0, COMPLETION_ITEM_LIMIT) .map(item => ({ title: item.title!!, url: item.url!!, })); } private filter(items: HistoryItem[], query: string) { return items.filter(item => { return query.split(' ').every(keyword => { return item.title.toLowerCase().includes(keyword.toLowerCase()) || item.url!!.includes(keyword) }); }) }; }
Fix bookmark completion on open command
Fix bookmark completion on open command
TypeScript
mit
ueokande/vim-vixen,ueokande/vim-vixen,ueokande/vim-vixen
--- +++ @@ -38,8 +38,8 @@ private filter(items: HistoryItem[], query: string) { return items.filter(item => { - return query.split(' ').some(keyword => { - return item.title.toLowerCase().includes(keyword.toLowerCase()) || item.url.includes(keyword) + return query.split(' ').every(keyword => { + return item.title.toLowerCase().includes(keyword.toLowerCase()) || item.url!!.includes(keyword) }); }) };
449e62059e9cf6a8391190fdf8103bf044475371
src/components/formComponents/LimitationForm.tsx
src/components/formComponents/LimitationForm.tsx
import React from "react"; import { observer } from "mobx-react"; import { Limitation, Item, LimitFlag } from "../../stores/model"; import Select from "./Select"; import MultiSelect from "./MultiSelect"; interface LimitationProps { label: string; limitation: Limitation; items: Item[]; } class LimitationForm extends React.PureComponent<LimitationProps> { onDelete = (index: number) => { this.props.limitation.list.splice(index, 1); } onAdd = (id: string) => { this.props.limitation.list.push(id); } onFlagChange = (value: string) => { this.props.limitation.flag = value as LimitFlag } onListChange = (values: string[]) => { this.props.limitation.list = values } render() { const { label, limitation, items } = this.props; return ( <div className="field-container"> <div className="label-container"> {label} </div> <div className="value-container"> <Select label={"flag"} onChange={this.onFlagChange} options={["NONE", "WHITELIST", "BLACKLIST"]} value={limitation.flag} /> { (!limitation.flag || limitation.flag !== "NONE") && <MultiSelect label={"list"} onChange={this.onListChange} options={items.map(item => item.id)} values={limitation.list} /> } </div> </div> ); } } export default observer(LimitationForm);
import React from "react"; import { observer } from "mobx-react"; import { Limitation, Item, LimitFlag } from "../../stores/model"; import Select from "./Select"; import MultiSelect from "./MultiSelect"; interface LimitationProps { label: string; limitation: Limitation; items: Item[]; } class LimitationForm extends React.PureComponent<LimitationProps> { onDelete = (index: number) => { this.props.limitation.list.splice(index, 1); } onAdd = (id: string) => { this.props.limitation.list.push(id); } onFlagChange = (value: string) => { this.props.limitation.flag = value as LimitFlag } onListChange = (values: string[]) => { this.props.limitation.list = values } render() { const { label, limitation, items } = this.props; return ( <div className="field-container"> <div className="label-container"> {label} </div> <div className="value-container"> <Select onChange={this.onFlagChange} options={["NONE", "WHITELIST", "BLACKLIST"]} value={limitation.flag} /> { (limitation.flag && limitation.flag !== "NONE") && <MultiSelect onChange={this.onListChange} options={items.map(item => item.id)} values={limitation.list} /> } </div> </div> ); } } export default observer(LimitationForm);
Remove labels of select and multiselect in LimitaionForm
Remove labels of select and multiselect in LimitaionForm
TypeScript
mit
TheIndifferent/jenkins-scm-koji-plugin,judovana/jenkins-scm-koji-plugin,TheIndifferent/jenkins-scm-koji-plugin,judovana/jenkins-scm-koji-plugin,judovana/jenkins-scm-koji-plugin
--- +++ @@ -38,15 +38,13 @@ </div> <div className="value-container"> <Select - label={"flag"} onChange={this.onFlagChange} options={["NONE", "WHITELIST", "BLACKLIST"]} value={limitation.flag} /> { - (!limitation.flag || limitation.flag !== "NONE") && + (limitation.flag && limitation.flag !== "NONE") && <MultiSelect - label={"list"} onChange={this.onListChange} options={items.map(item => item.id)} values={limitation.list} />
d5a427f3c0460ab7fd181e1920affb65d014b9f5
src/services/DeviceService.ts
src/services/DeviceService.ts
import winston from 'winston'; import DeviceModel from '@/models/device'; export default class DeviceService { // region public static methods public static async addDevice(platform: string, mail: string, token: string) { let device = await DeviceModel.findOne({ platform, mail }); if (!device) { device = new DeviceModel({ platform, mail, tokens: [], }); await device.save(); } if (device.tokens.indexOf(token) !== -1) { const errorMessage = `Could not add Device: Device (platform: ${platform}, mail: ${mail}, token: ${token}) already exists.`; winston.error(errorMessage); throw new Error(errorMessage); } device.tokens.push(token); await device.save(); } public static async getDevices(platform: string, mail: string): Promise<string[]> { const device = await DeviceModel.findOne({ platform, mail }); if (!device) { return []; } return device.tokens; } // endregion // region private static methods // endregion // region public members // endregion // region private members // endregion // region constructor // endregion // region public methods // endregion // region private methods // endregion }
import winston from 'winston'; import DeviceModel from '@/models/device'; export default class DeviceService { // region public static methods public static async addDevice(platform: string, mail: string, token: string): Promise<string> { let device = await DeviceModel.findOne({ platform, mail }); if (!device) { device = new DeviceModel({ platform, mail, tokens: [], }); await device.save(); } if (device.tokens.indexOf(token) !== -1) { const errorMessage = `Could not add Device: Device (platform: ${platform}, mail: ${mail}, token: ${token}) already exists.`; winston.error(errorMessage); throw new Error(errorMessage); } device.tokens.push(token); const savedDevice = await device.save(); return savedDevice.id; } public static async getDevices(platform: string, mail: string): Promise<string[]> { const device = await DeviceModel.findOne({ platform, mail }); if (!device) { return []; } return device.tokens; } // endregion // region private static methods // endregion // region public members // endregion // region private members // endregion // region constructor // endregion // region public methods // endregion // region private methods // endregion }
Return device id in device service
Return device id in device service
TypeScript
mit
schulcloud/node-notification-service,schulcloud/node-notification-service,schulcloud/node-notification-service
--- +++ @@ -3,7 +3,7 @@ export default class DeviceService { // region public static methods - public static async addDevice(platform: string, mail: string, token: string) { + public static async addDevice(platform: string, mail: string, token: string): Promise<string> { let device = await DeviceModel.findOne({ platform, mail }); if (!device) { device = new DeviceModel({ @@ -22,7 +22,10 @@ } device.tokens.push(token); - await device.save(); + + const savedDevice = await device.save(); + + return savedDevice.id; } public static async getDevices(platform: string, mail: string): Promise<string[]> {
abd547b29e9e746e6e33d88aa36a63da4850d067
packages/@sanity/field/src/diff/resolve/diffResolver.ts
packages/@sanity/field/src/diff/resolve/diffResolver.ts
import {DatetimeFieldDiff} from '../components/datetime' import {UrlFieldDiff} from '../components/url' import {SlugFieldDiff} from '../components/slug' import {DiffComponentResolver} from '../types' export const diffResolver: DiffComponentResolver = function diffResolver({schemaType}) { // datetime or date if (['datetime', 'date'].includes(schemaType.name)) { return DatetimeFieldDiff } if (schemaType.name === 'url') { return UrlFieldDiff } if (schemaType.name === 'slug') { return SlugFieldDiff } return undefined }
import {DatetimeFieldDiff} from '../components/datetime' import {UrlFieldDiff} from '../components/url' import {SlugFieldDiff} from '../components/slug' import {isPTSchemaType, PTDiff} from '../components/portableText' import {DiffComponentResolver} from '../types' export const diffResolver: DiffComponentResolver = function diffResolver({schemaType}) { // datetime or date if (['datetime', 'date'].includes(schemaType.name)) { return DatetimeFieldDiff } if (schemaType.name === 'url') { return UrlFieldDiff } if (schemaType.name === 'slug') { return SlugFieldDiff } if (isPTSchemaType(schemaType)) { return PTDiff } return undefined }
Add portable text diff resolver
[field] Add portable text diff resolver
TypeScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -1,6 +1,7 @@ import {DatetimeFieldDiff} from '../components/datetime' import {UrlFieldDiff} from '../components/url' import {SlugFieldDiff} from '../components/slug' +import {isPTSchemaType, PTDiff} from '../components/portableText' import {DiffComponentResolver} from '../types' export const diffResolver: DiffComponentResolver = function diffResolver({schemaType}) { @@ -17,5 +18,9 @@ return SlugFieldDiff } + if (isPTSchemaType(schemaType)) { + return PTDiff + } + return undefined }
f7b4c490dfa4d930649a97ca0eaa550dc5da589d
src/app/modules/wallet/components/components/transactions-table/transactions-table.component.ts
src/app/modules/wallet/components/components/transactions-table/transactions-table.component.ts
import { Component, Input } from '@angular/core'; @Component({ selector: 'm-walletTransactionsTable', templateUrl: './transactions-table.component.html', }) export class WalletTransactionsTableComponent { @Input() currency: string; @Input() transactions: any; @Input() filterApplied: boolean = false; typeLabels = { 'offchain:wire': 'Off-Chain Wire', wire: 'On-Chain Wire', reward: 'Reward', token: 'Purchase', withdraw: 'On-Chain Transfer', 'offchain:boost': 'Off-Chain Boost', boost: 'On-Chain Boost', pro_earning: 'Pro Earnings', payout: 'Transfer to Bank Account', }; constructor() {} getTypeLabel(type) { // type or superType - both are used if (this.currency !== 'tokens' && type === 'wire') { return 'Wire'; } else { return this.typeLabels[type]; } } }
import { Component, Input } from '@angular/core'; @Component({ selector: 'm-walletTransactionsTable', templateUrl: './transactions-table.component.html', }) export class WalletTransactionsTableComponent { @Input() currency: string; @Input() transactions: any; @Input() filterApplied: boolean = false; typeLabels = { 'offchain:wire': 'Off-Chain Wire', wire: 'On-Chain Wire', reward: 'Reward', token: 'Purchase', withdraw: 'On-Chain Transfer', 'offchain:boost': 'Off-Chain Boost', 'offchain:Pro Payout': 'Earnings Payout', boost: 'On-Chain Boost', pro_earning: 'Pro Earnings', payout: 'Transfer to Bank Account', }; constructor() {} getTypeLabel(type) { // type or superType - both are used if (this.currency !== 'tokens' && type === 'wire') { return 'Wire'; } else { return this.typeLabels[type]; } } }
Add offchain pro payouts to transactions table
Add offchain pro payouts to transactions table
TypeScript
agpl-3.0
Minds/front,Minds/front,Minds/front,Minds/front
--- +++ @@ -16,6 +16,7 @@ token: 'Purchase', withdraw: 'On-Chain Transfer', 'offchain:boost': 'Off-Chain Boost', + 'offchain:Pro Payout': 'Earnings Payout', boost: 'On-Chain Boost', pro_earning: 'Pro Earnings', payout: 'Transfer to Bank Account',
ec19cfaaac32cec93f1b9ead9a6febcf3813a153
packages/lesswrong/lib/collections/posts/constants.ts
packages/lesswrong/lib/collections/posts/constants.ts
import React from 'react'; import { DatabasePublicSetting } from "../../publicSettings"; import QuestionAnswerIcon from '@material-ui/icons/QuestionAnswer'; import PlayCircleOutlineIcon from '@material-ui/icons/PlayCircleOutline'; import AllInclusiveIcon from '@material-ui/icons/AllInclusive'; import SVGIconProps from '@material-ui/icons' export const postStatuses = { STATUS_PENDING: 1, STATUS_APPROVED: 2, STATUS_REJECTED: 3, STATUS_SPAM: 4, STATUS_DELETED: 5, } // Post statuses export const postStatusLabels = [ { value: 1, label: 'pending' }, { value: 2, label: 'approved' }, { value: 3, label: 'rejected' }, { value: 4, label: 'spam' }, { value: 5, label: 'deleted' } ]; const amaTagIdSetting = new DatabasePublicSetting<string | null>('amaTagId', null) const openThreadTagIdSetting = new DatabasePublicSetting<string | null>('openThreadTagId', null) const startHerePostIdSetting = new DatabasePublicSetting<string | null>('startHerePostId', null) export const tagSettingIcons = new Map<DatabasePublicSetting<string | null>, React.ComponentType<SVGIconProps>>([ [amaTagIdSetting, QuestionAnswerIcon], [openThreadTagIdSetting, AllInclusiveIcon], ]); export const idSettingIcons = new Map([ [startHerePostIdSetting, PlayCircleOutlineIcon] ]);
import React from 'react'; import { DatabasePublicSetting } from "../../publicSettings"; import QuestionAnswerIcon from '@material-ui/icons/QuestionAnswer'; import PlayCircleOutlineIcon from '@material-ui/icons/PlayCircleOutline'; import AllInclusiveIcon from '@material-ui/icons/AllInclusive'; export const postStatuses = { STATUS_PENDING: 1, STATUS_APPROVED: 2, STATUS_REJECTED: 3, STATUS_SPAM: 4, STATUS_DELETED: 5, } // Post statuses export const postStatusLabels = [ { value: 1, label: 'pending' }, { value: 2, label: 'approved' }, { value: 3, label: 'rejected' }, { value: 4, label: 'spam' }, { value: 5, label: 'deleted' } ]; const amaTagIdSetting = new DatabasePublicSetting<string | null>('amaTagId', null) const openThreadTagIdSetting = new DatabasePublicSetting<string | null>('openThreadTagId', null) const startHerePostIdSetting = new DatabasePublicSetting<string | null>('startHerePostId', null) export const tagSettingIcons = new Map<DatabasePublicSetting<string | null>, React.ComponentType<React.SVGProps<SVGElement>>>([ [amaTagIdSetting, QuestionAnswerIcon], [openThreadTagIdSetting, AllInclusiveIcon], ]); export const idSettingIcons = new Map([ [startHerePostIdSetting, PlayCircleOutlineIcon] ]);
Replace SVGIconProps with generic React.SVGProps
Replace SVGIconProps with generic React.SVGProps
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -3,7 +3,6 @@ import QuestionAnswerIcon from '@material-ui/icons/QuestionAnswer'; import PlayCircleOutlineIcon from '@material-ui/icons/PlayCircleOutline'; import AllInclusiveIcon from '@material-ui/icons/AllInclusive'; -import SVGIconProps from '@material-ui/icons' export const postStatuses = { STATUS_PENDING: 1, @@ -42,7 +41,7 @@ const openThreadTagIdSetting = new DatabasePublicSetting<string | null>('openThreadTagId', null) const startHerePostIdSetting = new DatabasePublicSetting<string | null>('startHerePostId', null) -export const tagSettingIcons = new Map<DatabasePublicSetting<string | null>, React.ComponentType<SVGIconProps>>([ +export const tagSettingIcons = new Map<DatabasePublicSetting<string | null>, React.ComponentType<React.SVGProps<SVGElement>>>([ [amaTagIdSetting, QuestionAnswerIcon], [openThreadTagIdSetting, AllInclusiveIcon], ]);
785e2a017bca4a18e142c511e528cdd713b70e2f
app/services/events.service.ts
app/services/events.service.ts
import { Injectable } from "@angular/core"; import { Event } from "./../models/event.model"; import { Http, Response } from "@angular/http"; import { Observable } from "rxjs/Observable"; import "rxjs/add/operator/map"; @Injectable() export class EventsService { baseURLPort: string = "3000"; baseURL: string = "http://cosasextraordinarias.com"; constructor(private _http: Http) { this.baseURL = `${this.baseURL}:${this.baseURLPort}`; } public getEvents(): Observable<Array<Event>> { let serviceURL: string = `${this.baseURL}/events`; console.log(serviceURL); return this._http.get(serviceURL).map((response: Response) => { console.log("-- getEvents() > Response from external service: %o", response.json()); return response.json(); }); } }
import { Injectable } from "@angular/core"; import { Event } from "./../models/event.model"; import { Http, Response } from "@angular/http"; import { Observable } from "rxjs/Observable"; import "rxjs/add/operator/map"; @Injectable() export class EventsService { baseURLPort: string = "3000"; baseURL: string = "http://cosasextraordinarias.com"; baseUrlAPI : string = ""; constructor(private _http: Http) { this.baseUrlAPI = `${this.baseURL}:${this.baseURLPort}`; } public getEvents(): Observable<Array<Event>> { let serviceURL: string = `${this.baseUrlAPI}/events`; return this._http.get(serviceURL).map((response: Response) => { // Fix the URL for images let items = response.json(); items.forEach((event : Event) => { event.thumbnail = `${this.baseURL}/api-images/${event.thumbnail.replace("/img/", "")}`; }); console.log("-- getEvents() > Response from external service: %o", items); return items; }); } }
Add example of pre-processing of data
Add example of pre-processing of data
TypeScript
mit
alex-arriaga/angular-conference-sgvirtual-2016,alex-arriaga/angular-conference-sgvirtual-2016,alex-arriaga/angular-conference-sgvirtual-2016
--- +++ @@ -9,17 +9,23 @@ baseURLPort: string = "3000"; baseURL: string = "http://cosasextraordinarias.com"; + baseUrlAPI : string = ""; constructor(private _http: Http) { - this.baseURL = `${this.baseURL}:${this.baseURLPort}`; + this.baseUrlAPI = `${this.baseURL}:${this.baseURLPort}`; } public getEvents(): Observable<Array<Event>> { - let serviceURL: string = `${this.baseURL}/events`; - console.log(serviceURL); + let serviceURL: string = `${this.baseUrlAPI}/events`; + return this._http.get(serviceURL).map((response: Response) => { - console.log("-- getEvents() > Response from external service: %o", response.json()); - return response.json(); + // Fix the URL for images + let items = response.json(); + items.forEach((event : Event) => { + event.thumbnail = `${this.baseURL}/api-images/${event.thumbnail.replace("/img/", "")}`; + }); + console.log("-- getEvents() > Response from external service: %o", items); + return items; }); } }
2230360e7ea01b97b2a46a545500f7b582c3c768
src/api/models/drive-file.ts
src/api/models/drive-file.ts
import db from '../../db/mongodb'; export default db.get('drive_files') as any; // fuck type definition export function validateFileName(name: string): boolean { return ( (name.trim().length > 0) && (name.length <= 200) && (name.indexOf('\\') === -1) && (name.indexOf('/') === -1) && (name.indexOf('..') === -1) ); }
import db from '../../db/mongodb'; const collection = db.get('drive_files'); (collection as any).index('hash'); // fuck type definition export default collection as any; // fuck type definition export function validateFileName(name: string): boolean { return ( (name.trim().length > 0) && (name.length <= 200) && (name.indexOf('\\') === -1) && (name.indexOf('/') === -1) && (name.indexOf('..') === -1) ); }
Add 'hash' index to the drive_files collection
[Server] Add 'hash' index to the drive_files collection
TypeScript
mit
Tosuke/misskey,Tosuke/misskey,Tosuke/misskey,syuilo/Misskey,armchair-philosophy/misskey,Tosuke/misskey,armchair-philosophy/misskey,ha-dai/Misskey,armchair-philosophy/misskey,Tosuke/misskey,syuilo/Misskey,armchair-philosophy/misskey,ha-dai/Misskey
--- +++ @@ -1,6 +1,10 @@ import db from '../../db/mongodb'; -export default db.get('drive_files') as any; // fuck type definition +const collection = db.get('drive_files'); + +(collection as any).index('hash'); // fuck type definition + +export default collection as any; // fuck type definition export function validateFileName(name: string): boolean { return (
d6702e8c84be23f753f4321e40cf76e1b5d6de7f
src/npm-client.ts
src/npm-client.ts
import axios from 'axios' const client = axios.create({ baseURL: 'https://registry.npmjs.org', }) /** * Simple wrapper around the NPM API. */ export const npmClient = { getPackageManifest: async (name: string) => client.get(name).then((r) => r.data), }
import axios from 'axios' import child from 'child_process' import { promisify } from 'util' import { memoizeAsync } from './util' const execAsync = promisify(child.exec) /** * Read registry from npm config. */ export async function getNpmRegistry() { const { stdout } = await execAsync('npm config get registry') /* istanbul ignore next */ return stdout.trim() || 'https://registry.npmjs.org' } const getClient = memoizeAsync(async () => { const registryUrl = await getNpmRegistry() return axios.create({ baseURL: registryUrl }) }) /** * Simple wrapper around the NPM API. */ export const npmClient = { getPackageManifest: async (name: string) => { const client = await getClient() return client.get(name).then((r) => r.data) }, }
Read registry from npm config
feat: Read registry from npm config
TypeScript
mit
jeffijoe/typesync,jeffijoe/typesync
--- +++ @@ -1,13 +1,30 @@ import axios from 'axios' +import child from 'child_process' +import { promisify } from 'util' +import { memoizeAsync } from './util' -const client = axios.create({ - baseURL: 'https://registry.npmjs.org', +const execAsync = promisify(child.exec) + +/** + * Read registry from npm config. + */ +export async function getNpmRegistry() { + const { stdout } = await execAsync('npm config get registry') + /* istanbul ignore next */ + return stdout.trim() || 'https://registry.npmjs.org' +} + +const getClient = memoizeAsync(async () => { + const registryUrl = await getNpmRegistry() + return axios.create({ baseURL: registryUrl }) }) /** * Simple wrapper around the NPM API. */ export const npmClient = { - getPackageManifest: async (name: string) => - client.get(name).then((r) => r.data), + getPackageManifest: async (name: string) => { + const client = await getClient() + return client.get(name).then((r) => r.data) + }, }
19458f9bab3d5e303f074a7bd641ef90491795e6
src/sortablejs-options.ts
src/sortablejs-options.ts
export interface SortablejsOptions { group?: string | { name?: string; pull?: boolean | 'clone' | Function; put?: boolean | string[] | Function; revertClone?: boolean; }; sort?: boolean; delay?: number; disabled?: boolean; store?: { get: (sortable: any) => any[]; set: (sortable: any) => any; }; animation?: number; handle?: string; filter?: any; draggable?: string; ghostClass?: string; chosenClass?: string; dataIdAttr?: string; forceFallback?: boolean; fallbackClass?: string; fallbackOnBody?: boolean; scroll?: boolean | HTMLElement; scrollSensitivity?: number; scrollSpeed?: number; preventOnFilter?: boolean; dragClass?: string; fallbackTolerance?: number; setData?: (dataTransfer: any, draggedElement: any) => any; onStart?: (event: any) => any; onEnd?: (event: any) => any; onAdd?: (event: any) => any; onAddOriginal?: (event: any) => any; onUpdate?: (event: any) => any; onSort?: (event: any) => any; onRemove?: (event: any) => any; onFilter?: (event: any) => any; onMove?: (event: any) => boolean; scrollFn?: (offsetX: any, offsetY: any, originalEvent: any) => any; onChoose?: (event: any) => any; onClone?: (event: any) => any; }
export interface SortablejsOptions { group?: string | { name?: string; pull?: boolean | 'clone' | Function; put?: boolean | string[] | Function; revertClone?: boolean; }; sort?: boolean; delay?: number; disabled?: boolean; store?: { get: (sortable: any) => any[]; set: (sortable: any) => any; }; animation?: number; handle?: string; filter?: any; draggable?: string; ghostClass?: string; chosenClass?: string; dataIdAttr?: string; forceFallback?: boolean; fallbackClass?: string; fallbackOnBody?: boolean; scroll?: boolean | HTMLElement; scrollSensitivity?: number; scrollSpeed?: number; preventOnFilter?: boolean; dragClass?: string; fallbackTolerance?: number; setData?: (dataTransfer: any, draggedElement: any) => any; onStart?: (event: any) => any; onEnd?: (event: any) => any; onAdd?: (event: any) => any; onAddOriginal?: (event: any) => any; onUpdate?: (event: any) => any; onSort?: (event: any) => any; onRemove?: (event: any) => any; onFilter?: (event: any) => any; onMove?: (event: any) => boolean; scrollFn?: (offsetX: any, offsetY: any, originalEvent: any) => any; onChoose?: (event: any) => any; onUnchoose?: (event: any) => any; onClone?: (event: any) => any; }
Add onUnchoose method to options interface.
Add onUnchoose method to options interface. Related PR: https://github.com/RubaXa/Sortable/pull/1033
TypeScript
mit
SortableJS/angular-sortablejs
--- +++ @@ -40,5 +40,6 @@ onMove?: (event: any) => boolean; scrollFn?: (offsetX: any, offsetY: any, originalEvent: any) => any; onChoose?: (event: any) => any; + onUnchoose?: (event: any) => any; onClone?: (event: any) => any; }
d2f47826315dbeb9f8fc712f41bb18599e5d5caf
src/utils/index.ts
src/utils/index.ts
import { Grid, Row, Column, Diagonal } from '../definitions'; export function getRows(grid: Grid): Row[] { const length = Math.sqrt(grid.length); const copy = grid.concat([]); return getArray(length).map(() => copy.splice(0, length)); } export function getColumns(grid: Grid): Column[] { return getRows(transpose(grid)); } export function getDiagonals(grid: Grid): Diagonal[] { // TODO: Make it work return []; } function getArray(length: number) { return Array.apply(null, { length }).map(Number.call, Number); } export function transpose<T>(grid: Array<T>): Array<T> { const size = Math.sqrt(grid.length); var transposed = grid.filter(() => false); for (let j = 0; j < size; ++j) { for (let i = 0; i < size; ++i) { transposed.push(grid[j + (i * size)]); } } return transposed; }
import { Grid, Row, Column, Diagonal } from '../definitions'; export function getRows(grid: Grid): Row[] { const length = Math.sqrt(grid.length); const copy = grid.concat([]); return getArray(length).map(() => copy.splice(0, length)); } export function getColumns(grid: Grid): Column[] { return getRows(transpose(grid)); } export function getDiagonals(grid: Grid): Diagonal[] { // TODO: Make it work return []; } function getArray(length: number) { return Array.apply(null, { length }).map(Number.call, Number); } export function transpose<T>(grid: Array<T>): Array<T> { const size = Math.sqrt(grid.length); const transposed = grid.filter(() => false); for (let j = 0; j < size; ++j) { for (let i = 0; i < size; ++i) { transposed.push(grid[j + (i * size)]); } } return transposed; }
Use const instead of var
Use const instead of var
TypeScript
mit
artfuldev/tictactoe-ai,artfuldev/tictactoe-ai
--- +++ @@ -21,7 +21,7 @@ export function transpose<T>(grid: Array<T>): Array<T> { const size = Math.sqrt(grid.length); - var transposed = grid.filter(() => false); + const transposed = grid.filter(() => false); for (let j = 0; j < size; ++j) { for (let i = 0; i < size; ++i) { transposed.push(grid[j + (i * size)]);
cf508c10d2e682230600f1d97d05c4054b8959e4
src/Parsing/Outline/isLineFancyOutlineConvention.ts
src/Parsing/Outline/isLineFancyOutlineConvention.ts
import { tryToParseUnorderedList } from './tryToParseUnorderedList' import { trytoParseOrderedList } from './tryToParseOrderedList' import { tryToParseThematicBreakStreak } from './tryToParseThematicBreakStreak' import { tryToParseBlockquote } from './tryToParseBlockquote' import { tryToParseCodeBlock } from './tryToParseCodeBlock' import { HeadingLeveler } from './HeadingLeveler' import { Settings } from '../../Settings' const OUTLINE_CONVENTIONS_POSSIBLY_ONE_LINE_LONG = [ tryToParseUnorderedList, trytoParseOrderedList, tryToParseThematicBreakStreak, tryToParseBlockquote, tryToParseCodeBlock ] // We don't care about heading levels or source line numbers! We only care whether or not // the line is a regular paragraph. const DUMMY_HEADING_LEVELER = new HeadingLeveler() const DUMMY_SOURCE_LINE_NUMBER = 1 // If `line` would be considered anything but a regular paragraph, it's considered fancy. export function isLineFancyOutlineConvention(markupLine: string, settings: Settings.Parsing): boolean { const markupLines = [markupLine] return OUTLINE_CONVENTIONS_POSSIBLY_ONE_LINE_LONG.some( parse => parse({ markupLines, settings, sourceLineNumber: DUMMY_SOURCE_LINE_NUMBER, headingLeveler: DUMMY_HEADING_LEVELER, then: () => { /* Do nothing */ } })) }
import { tryToParseUnorderedList } from './tryToParseUnorderedList' import { trytoParseOrderedList } from './tryToParseOrderedList' import { tryToParseThematicBreakStreak } from './tryToParseThematicBreakStreak' import { tryToParseBlockquote } from './tryToParseBlockquote' import { tryToParseCodeBlock } from './tryToParseCodeBlock' import { HeadingLeveler } from './HeadingLeveler' import { Settings } from '../../Settings' const OUTLINE_CONVENTIONS_POSSIBLY_ONE_LINE_LONG = [ tryToParseUnorderedList, trytoParseOrderedList, tryToParseThematicBreakStreak, tryToParseBlockquote, tryToParseCodeBlock ] // We don't care about heading levels or source line numbers! We only care whether or not // the line is a regular paragraph. const DUMMY_HEADING_LEVELER = new HeadingLeveler() const DUMMY_SOURCE_LINE_NUMBER = 1 // If `markupLine` would be considered anything but a regular paragraph, it's considered fancy. export function isLineFancyOutlineConvention(markupLine: string, settings: Settings.Parsing): boolean { const markupLines = [markupLine] return OUTLINE_CONVENTIONS_POSSIBLY_ONE_LINE_LONG.some( parse => parse({ markupLines, settings, sourceLineNumber: DUMMY_SOURCE_LINE_NUMBER, headingLeveler: DUMMY_HEADING_LEVELER, then: () => { /* Do nothing */ } })) }
Update argument name in comment
Update argument name in comment
TypeScript
mit
start/up,start/up
--- +++ @@ -22,7 +22,7 @@ const DUMMY_SOURCE_LINE_NUMBER = 1 -// If `line` would be considered anything but a regular paragraph, it's considered fancy. +// If `markupLine` would be considered anything but a regular paragraph, it's considered fancy. export function isLineFancyOutlineConvention(markupLine: string, settings: Settings.Parsing): boolean { const markupLines = [markupLine]
2687111bfccfeef1086578d39698fa22726324a0
app/src/ui/diff/image-diffs/render-image.tsx
app/src/ui/diff/image-diffs/render-image.tsx
import * as React from 'react' import { Image } from '../../../models/diff' export function renderImage( image: Image | undefined, props?: { style?: {} onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void } ) { if (!image) { return null } const imageSource = `data:${image.mediaType};base64,${image.contents}` return <img src={imageSource} {...props} /> }
import * as React from 'react' import { Image } from '../../../models/diff' interface IRenderImageOptions { readonly style?: {} readonly onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void } export function renderImage( image: Image | undefined, options?: IRenderImageOptions ) { if (!image) { return null } const imageSource = `data:${image.mediaType};base64,${image.contents}` return <img src={imageSource} {...options} /> }
Split these out into their own type
Split these out into their own type
TypeScript
mit
gengjiawen/desktop,hjobrien/desktop,kactus-io/kactus,artivilla/desktop,desktop/desktop,hjobrien/desktop,say25/desktop,artivilla/desktop,j-f1/forked-desktop,say25/desktop,shiftkey/desktop,shiftkey/desktop,say25/desktop,gengjiawen/desktop,kactus-io/kactus,gengjiawen/desktop,artivilla/desktop,shiftkey/desktop,desktop/desktop,artivilla/desktop,desktop/desktop,shiftkey/desktop,kactus-io/kactus,say25/desktop,hjobrien/desktop,j-f1/forked-desktop,hjobrien/desktop,j-f1/forked-desktop,j-f1/forked-desktop,gengjiawen/desktop,desktop/desktop,kactus-io/kactus
--- +++ @@ -2,12 +2,14 @@ import { Image } from '../../../models/diff' +interface IRenderImageOptions { + readonly style?: {} + readonly onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void +} + export function renderImage( image: Image | undefined, - props?: { - style?: {} - onLoad?: (e: React.SyntheticEvent<HTMLImageElement>) => void - } + options?: IRenderImageOptions ) { if (!image) { return null @@ -15,5 +17,5 @@ const imageSource = `data:${image.mediaType};base64,${image.contents}` - return <img src={imageSource} {...props} /> + return <img src={imageSource} {...options} /> }
404b3a03eb1f343db4040f160fefe91d94f79930
app/factory-virtualmachine/model/virtual-machine.ts
app/factory-virtualmachine/model/virtual-machine.ts
export class VirtualMachine { }
export class VirtualMachine { id: number; code: string; ipAddress: string; dns: string; osPlatform: string; ram: number; diskSpace: number; manufacturer: string; model: string; yearOfService : number; condition: string; constructor (id: number, code: string, ipAddress: string, dns: string, osPlatform: string, ram: number, diskSpace: number, manufacturer: string, model: string, yearOfService: number, condition: string) { this.id = id; this.code = code; this.ipAddress = ipAddress; this.dns = dns; this.osPlatform = osPlatform; this.ram = ram; this.diskSpace = diskSpace; this.manufacturer = manufacturer; this.model = model; this.yearOfService = yearOfService; this.condition = condition; } }
Add properties to virtual machine class
Add properties to virtual machine class
TypeScript
mit
railsstudent/angular2-appcheck,railsstudent/angular2-appcheck,railsstudent/angular2-appcheck
--- +++ @@ -1,5 +1,33 @@ - export class VirtualMachine { + id: number; + code: string; + ipAddress: string; + dns: string; + osPlatform: string; + ram: number; + diskSpace: number; + manufacturer: string; + model: string; + yearOfService : number; + condition: string; + + constructor (id: number, code: string, ipAddress: string, dns: string, + osPlatform: string, ram: number, diskSpace: number, + manufacturer: string, model: string, yearOfService: number, + condition: string) { + this.id = id; + this.code = code; + this.ipAddress = ipAddress; + this.dns = dns; + this.osPlatform = osPlatform; + this.ram = ram; + this.diskSpace = diskSpace; + this.manufacturer = manufacturer; + this.model = model; + this.yearOfService = yearOfService; + this.condition = condition; + } + }
6013bd6f9de17f35884e59eade39fbdc6e766f55
types/gulp-jsonmin/index.d.ts
types/gulp-jsonmin/index.d.ts
// Type definitions for gulp-jsonmin 1.1 // Project: https://github.com/englercj/gulp-jsonmin // Definitions by: Romain Faust <https://github.com/romain-faust> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// <reference types="node" /> import { Transform } from 'stream'; declare function GulpJsonmin(options?: GulpJsonmin.Options): Transform; declare namespace GulpJsonmin { interface Options { verbose?: boolean; } } export = GulpJsonmin;
// Type definitions for gulp-jsonmin 1.1 // Project: https://github.com/englercj/gulp-jsonmin // Definitions by: Romain Faust <https://github.com/romain-faust> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// <reference types="node" /> import { Transform } from 'stream'; declare function gulpJsonmin(options?: gulpJsonmin.Options): Transform; declare namespace gulpJsonmin { interface Options { verbose?: boolean; } } export = gulpJsonmin;
Change the export case to be more semantically correct
Change the export case to be more semantically correct
TypeScript
mit
dsebastien/DefinitelyTyped,dsebastien/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,mcliment/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,markogresak/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped
--- +++ @@ -7,12 +7,12 @@ import { Transform } from 'stream'; -declare function GulpJsonmin(options?: GulpJsonmin.Options): Transform; +declare function gulpJsonmin(options?: gulpJsonmin.Options): Transform; -declare namespace GulpJsonmin { +declare namespace gulpJsonmin { interface Options { verbose?: boolean; } } -export = GulpJsonmin; +export = gulpJsonmin;
bdbcd6081e633de18a68919ee75fa382940043ec
src/app/partner/coach/view/coach-view.component.ts
src/app/partner/coach/view/coach-view.component.ts
import { Component } from '@angular/core'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { Coach } from '../../../models/index'; import { CoachService } from '../../../_services/index'; @Component({ selector: 'coach-view', templateUrl: 'coach-view.component.html' }) export class CoachViewComponent { public coach: Coach = new Coach(); constructor( private coachService: CoachService, private route: ActivatedRoute, private router: Router ) { this.route.params .switchMap( (params: Params) => this.coachService.getById(+params['id'])) .subscribe( (coach) => { this.coach = coach; }); } public deleteCoach() { if (confirm('Êtes vous sur de vouloir supprimer ce coach ?')) { this.coachService.delete(this.coach.id).subscribe( (data) => { this.router.navigate(['/partner/coach/dashboard']); }); } } }
import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { Coach } from '../../../models/index'; import { CoachService } from '../../../_services/index'; @Component({ selector: 'coach-view', templateUrl: 'coach-view.component.html' }) export class CoachViewComponent implements OnInit { public coach: Coach = new Coach(); constructor( private coachService: CoachService, private route: ActivatedRoute, private router: Router ) { } public ngOnInit() { this.route.params .switchMap( (params: Params) => this.coachService.getById(+params['id'])) .subscribe( (coach) => { this.coach = coach; }); } public deleteCoach() { if (confirm('Êtes vous sur de vouloir supprimer ce coach ?')) { this.coachService.delete(this.coach.id).subscribe( (data) => { this.router.navigate(['/partner/coach/dashboard']); }); } } }
Move service call in OnInit
Move service call in OnInit
TypeScript
mit
XavierGuichet/bemoove-front,XavierGuichet/bemoove-front,XavierGuichet/bemoove-front
--- +++ @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { Coach } from '../../../models/index'; @@ -10,19 +10,21 @@ templateUrl: 'coach-view.component.html' }) -export class CoachViewComponent { +export class CoachViewComponent implements OnInit { public coach: Coach = new Coach(); constructor( private coachService: CoachService, private route: ActivatedRoute, private router: Router - ) { - this.route.params - .switchMap( (params: Params) => this.coachService.getById(+params['id'])) - .subscribe( (coach) => { - this.coach = coach; - }); + ) { } + + public ngOnInit() { + this.route.params + .switchMap( (params: Params) => this.coachService.getById(+params['id'])) + .subscribe( (coach) => { + this.coach = coach; + }); } public deleteCoach() {
26f099e882d9216bfaf666f22f8c433fb72039b0
demo/client.tsx
demo/client.tsx
import * as React from "react"; import { render } from "react-dom"; import { App } from "./App"; import "../node_modules/normalize.css/normalize.css"; import "../node_modules/draft-js/dist/Draft.css"; import "../src/styles/react-mde-all.scss"; import "./styles/demo.scss"; import "./styles/variables.scss"; render( <App />, document.getElementById("#app_container"), );
import * as React from "react"; import { render } from "react-dom"; import { App } from "./App"; import "../node_modules/normalize.css/normalize.css"; import "../src/styles/react-mde-all.scss"; import "./styles/demo.scss"; import "./styles/variables.scss"; render( <App />, document.getElementById("#app_container"), );
Remove draft.css from the demo
Remove draft.css from the demo
TypeScript
mit
andrerpena/react-mde,andrerpena/react-mde,andrerpena/react-mde
--- +++ @@ -3,7 +3,6 @@ import { App } from "./App"; import "../node_modules/normalize.css/normalize.css"; -import "../node_modules/draft-js/dist/Draft.css"; import "../src/styles/react-mde-all.scss"; import "./styles/demo.scss"; import "./styles/variables.scss";
bf8410fc6cd55c5816bf478e5c31c967fc70ebbf
build/azure-pipelines/publish-types/check-version.ts
build/azure-pipelines/publish-types/check-version.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; import * as cp from 'child_process'; let tag = ''; try { tag = cp .execSync('git describe --tags `git rev-list --tags --max-count=1`') .toString() .trim(); if (!isValidTag(tag)) { throw Error(`Invalid tag ${tag}`); } } catch (err) { console.error(err); console.error('Failed to update types'); process.exit(1); } function isValidTag(t: string) { if (t.split('.').length !== 3) { return false; } const [major, minor, bug] = t.split('.'); // Only release for tags like 1.34.0 if (bug !== '0') { return false; } if (parseInt(major, 10) === NaN || parseInt(minor, 10) === NaN) { return false; } return true; }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; import * as cp from 'child_process'; let tag = ''; try { tag = cp .execSync('git describe --tags `git rev-list --tags --max-count=1`') .toString() .trim(); if (!isValidTag(tag)) { throw Error(`Invalid tag ${tag}`); } } catch (err) { console.error(err); console.error('Failed to update types'); process.exit(1); } function isValidTag(t: string) { if (t.split('.').length !== 3) { return false; } const [major, minor, bug] = t.split('.'); // Only release for tags like 1.34.0 if (bug !== '0') { return false; } if (isNaN(parseInt(major, 10)) || isNaN(parseInt(minor, 10))) { return false; } return true; }
Use isNaN instead of === NaN
Use isNaN instead of === NaN
TypeScript
mit
hoovercj/vscode,eamodio/vscode,joaomoreno/vscode,microsoft/vscode,microsoft/vscode,hoovercj/vscode,the-ress/vscode,eamodio/vscode,joaomoreno/vscode,hoovercj/vscode,hoovercj/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,hoovercj/vscode,Microsoft/vscode,the-ress/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,joaomoreno/vscode,eamodio/vscode,Microsoft/vscode,the-ress/vscode,Microsoft/vscode,the-ress/vscode,eamodio/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,eamodio/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,the-ress/vscode,eamodio/vscode,microsoft/vscode,the-ress/vscode,Microsoft/vscode,the-ress/vscode,Microsoft/vscode,hoovercj/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,Microsoft/vscode,joaomoreno/vscode,eamodio/vscode,the-ress/vscode,the-ress/vscode,the-ress/vscode,microsoft/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,Microsoft/vscode,eamodio/vscode,joaomoreno/vscode,microsoft/vscode,microsoft/vscode,joaomoreno/vscode,eamodio/vscode,the-ress/vscode,microsoft/vscode,joaomoreno/vscode,joaomoreno/vscode,hoovercj/vscode,the-ress/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,microsoft/vscode,eamodio/vscode,hoovercj/vscode,the-ress/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,joaomoreno/vscode,eamodio/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,hoovercj/vscode,Microsoft/vscode,Microsoft/vscode,Krzysztof-Cieslak/vscode,joaomoreno/vscode,Microsoft/vscode,microsoft/vscode,hoovercj/vscode,joaomoreno/vscode,eamodio/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,hoovercj/vscode,joaomoreno/vscode,hoovercj/vscode,hoovercj/vscode,the-ress/vscode,eamodio/vscode,eamodio/vscode,hoovercj/vscode,Microsoft/vscode,Microsoft/vscode,the-ress/vscode
--- +++ @@ -35,7 +35,7 @@ return false; } - if (parseInt(major, 10) === NaN || parseInt(minor, 10) === NaN) { + if (isNaN(parseInt(major, 10)) || isNaN(parseInt(minor, 10))) { return false; }
441474b9118279902eda690ea31b491b7a2a12ed
packages/universal-cookie/src/types.ts
packages/universal-cookie/src/types.ts
export type Cookie = any; export interface CookieGetOptions { doNotParse?: boolean; } export interface CookieSetOptions { path?: string; expires?: Date; maxAge?: number; domain?: string; secure?: boolean; httpOnly?: boolean; } export interface CookieChangeOptions { name: string; value?: any, options?: CookieSetOptions } export type CookieChangeListener = (options: CookieChangeOptions) => void;
export type Cookie = any; export interface CookieGetOptions { doNotParse?: boolean; } export interface CookieSetOptions { path?: string; expires?: Date; maxAge?: number; domain?: string; secure?: boolean; httpOnly?: boolean; sameSite?: boolean | string; } export interface CookieChangeOptions { name: string; value?: any, options?: CookieSetOptions } export type CookieChangeListener = (options: CookieChangeOptions) => void;
Add sameSite attribute for cookies
Add sameSite attribute for cookies
TypeScript
mit
reactivestack/cookies,reactivestack/cookies,reactivestack/cookies,eXon/react-cookie
--- +++ @@ -11,6 +11,7 @@ domain?: string; secure?: boolean; httpOnly?: boolean; + sameSite?: boolean | string; } export interface CookieChangeOptions { name: string;
a516ff81c97259dd19b48ceb037a7896f4624c9e
public/app/features/panel/GeneralTabCtrl.ts
public/app/features/panel/GeneralTabCtrl.ts
import coreModule from 'app/core/core_module'; const obj2string = obj => { return Object.keys(obj) .reduce((acc, curr) => acc.concat(curr + '=' + obj[curr]), []) .join(); }; export class GeneralTabCtrl { panelCtrl: any; /** @ngInject */ constructor($scope) { this.panelCtrl = $scope.ctrl; const updatePanel = () => { console.log('panel.render()'); this.panelCtrl.panel.render(); }; const generateValueFromPanel = scope => { const { panel } = scope.ctrl; const panelPropsToTrack = ['title', 'description', 'transparent', 'repeat', 'repeatDirection', 'minSpan']; const panelPropsString = panelPropsToTrack .map(prop => (panel[prop] && panel[prop].toString ? panel[prop].toString() : panel[prop])) .join(); const panelLinks = panel.links; const panelLinksString = panelLinks.map(obj2string).join(); return panelPropsString + panelLinksString; }; $scope.$watch(generateValueFromPanel, updatePanel, true); } } /** @ngInject */ export function generalTab() { 'use strict'; return { restrict: 'E', templateUrl: 'public/app/features/panel/partials/general_tab.html', controller: GeneralTabCtrl, }; } coreModule.directive('panelGeneralTab', generalTab);
import coreModule from 'app/core/core_module'; const obj2string = obj => { return Object.keys(obj) .reduce((acc, curr) => acc.concat(curr + '=' + obj[curr]), []) .join(); }; export class GeneralTabCtrl { panelCtrl: any; /** @ngInject */ constructor($scope) { this.panelCtrl = $scope.ctrl; const updatePanel = () => { console.log('panel.render()'); this.panelCtrl.panel.render(); }; const generateValueFromPanel = scope => { const { panel } = scope.ctrl; const panelPropsToTrack = ['title', 'description', 'transparent', 'repeat', 'repeatDirection', 'minSpan']; const panelPropsString = panelPropsToTrack .map(prop => prop + '=' + (panel[prop] && panel[prop].toString ? panel[prop].toString() : panel[prop])) .join(); const panelLinks = panel.links; const panelLinksString = panelLinks.map(obj2string).join(); return panelPropsString + panelLinksString; }; $scope.$watch(generateValueFromPanel, updatePanel, true); } } /** @ngInject */ export function generalTab() { 'use strict'; return { restrict: 'E', templateUrl: 'public/app/features/panel/partials/general_tab.html', controller: GeneralTabCtrl, }; } coreModule.directive('panelGeneralTab', generalTab);
Add prop key to panelPropsString to avoid a bug when changing another value and the render doesnt trigger
Add prop key to panelPropsString to avoid a bug when changing another value and the render doesnt trigger
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -22,7 +22,7 @@ const { panel } = scope.ctrl; const panelPropsToTrack = ['title', 'description', 'transparent', 'repeat', 'repeatDirection', 'minSpan']; const panelPropsString = panelPropsToTrack - .map(prop => (panel[prop] && panel[prop].toString ? panel[prop].toString() : panel[prop])) + .map(prop => prop + '=' + (panel[prop] && panel[prop].toString ? panel[prop].toString() : panel[prop])) .join(); const panelLinks = panel.links; const panelLinksString = panelLinks.map(obj2string).join();
f6ce230fb40f6a7d6fa312d49f92d3c79b9ba73f
src/hooks/api/getters/useStrategies/useStrategies.ts
src/hooks/api/getters/useStrategies/useStrategies.ts
import useSWR, { mutate } from 'swr'; import { useEffect, useState } from 'react'; import { formatApiPath } from '../../../../utils/format-path'; import { IStrategy } from '../../../../interfaces/strategy'; import handleErrorResponses from '../httpErrorResponseHandler'; export const STRATEGIES_CACHE_KEY = 'api/admin/strategies'; const useStrategies = () => { const fetcher = () => { const path = formatApiPath(`api/admin/strategies`); return fetch(path, { method: 'GET', credentials: 'include', }).then(handleErrorResponses('Strategies')).then(res => res.json()); }; const { data, error } = useSWR<{ strategies: IStrategy[] }>( STRATEGIES_CACHE_KEY, fetcher ); const [loading, setLoading] = useState(!error && !data); const refetch = () => { mutate(STRATEGIES_CACHE_KEY); }; useEffect(() => { setLoading(!error && !data); }, [data, error]); return { strategies: data?.strategies || [], error, loading, refetch, }; }; export default useStrategies;
import useSWR, { mutate } from 'swr'; import { useEffect, useState } from 'react'; import { formatApiPath } from '../../../../utils/format-path'; import { IStrategy } from '../../../../interfaces/strategy'; import handleErrorResponses from '../httpErrorResponseHandler'; export const STRATEGIES_CACHE_KEY = 'api/admin/strategies'; const flexibleRolloutStrategy: IStrategy = { deprecated: false, name: 'flexibleRollout', displayName: 'Gradual rollout', editable: false, description: 'Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.', parameters: [{ name: 'rollout', type: 'percentage', description: '', required: false }, { name: 'stickiness', type: 'string', description: 'Used to defined stickiness', required: true }, { name: 'groupId', type: 'string', description: '', required: true }] }; const useStrategies = () => { const fetcher = () => { const path = formatApiPath(`api/admin/strategies`); return fetch(path, { method: 'GET', credentials: 'include' }).then(handleErrorResponses('Strategies')).then(res => res.json()); }; const { data, error } = useSWR<{ strategies: IStrategy[] }>( STRATEGIES_CACHE_KEY, fetcher ); const [loading, setLoading] = useState(!error && !data); const refetch = () => { mutate(STRATEGIES_CACHE_KEY); }; useEffect(() => { setLoading(!error && !data); }, [data, error]); return { strategies: data?.strategies || [flexibleRolloutStrategy], error, loading, refetch }; }; export default useStrategies;
Add default strategy type to strategy hook
Add default strategy type to strategy hook - Fixes the missing sidebar while loading the strategy types Trello: https://trello.com/c/WJk8bI8l/490-feature-strategies-loading-state
TypeScript
apache-2.0
Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend,Unleash/unleash-frontend
--- +++ @@ -6,13 +6,29 @@ export const STRATEGIES_CACHE_KEY = 'api/admin/strategies'; +const flexibleRolloutStrategy: IStrategy = { + deprecated: false, + name: 'flexibleRollout', + displayName: 'Gradual rollout', + editable: false, + description: 'Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.', + parameters: [{ + name: 'rollout', type: 'percentage', description: '', required: false + }, { + name: 'stickiness', + type: 'string', + description: 'Used to defined stickiness', + required: true + }, { name: 'groupId', type: 'string', description: '', required: true }] +}; + const useStrategies = () => { const fetcher = () => { const path = formatApiPath(`api/admin/strategies`); return fetch(path, { method: 'GET', - credentials: 'include', + credentials: 'include' }).then(handleErrorResponses('Strategies')).then(res => res.json()); }; @@ -31,10 +47,10 @@ }, [data, error]); return { - strategies: data?.strategies || [], + strategies: data?.strategies || [flexibleRolloutStrategy], error, loading, - refetch, + refetch }; };
2c0b34f4e740e7d26d26d38298fc2e685d46d286
client/Reducers/EncounterActions.tsx
client/Reducers/EncounterActions.tsx
import { CombatantState } from "../../common/CombatantState"; import { StatBlock } from "../../common/StatBlock"; export type Action = | AddCombatantFromState | AddCombatantFromStatBlock | RemoveCombatant | StartEncounter | EndEncounter; type AddCombatantFromState = { type: "AddCombatantFromState"; payload: { combatantState: CombatantState; }; }; type AddCombatantFromStatBlock = { type: "AddCombatantFromStatBlock"; payload: { combatantId: string; statBlock: StatBlock; rolledHP?: number; }; }; type RemoveCombatant = { type: "RemoveCombatant"; payload: { combatantId: string; }; }; type StartEncounter = { type: "StartEncounter"; payload: { initiativesByCombatantId: Record<string, number>; }; }; type EndEncounter = { type: "EndEncounter"; }; /* TODO: >EncounterActions ClearEncounter CleanEncounter RestoreAllPlayerCharacterHP ApplyInitiativesAndResetRound (for round-to-round encounter reroll) >CombatantActions SetStatBlock ApplyDamage ApplyHealing ApplyTemporaryHP SetInitiative LinkInitiative AddTag RemoveTag UpdateNotes SetAlias ToggleHidden ToggleRevealedAC MoveDown MoveUp */
import { CombatantState } from "../../common/CombatantState"; import { StatBlock } from "../../common/StatBlock"; export type Action = | AddCombatantFromState | AddCombatantFromStatBlock | RemoveCombatant | StartEncounter | EndEncounter | NextTurn | PreviousTurn; type AddCombatantFromState = { type: "AddCombatantFromState"; payload: { combatantState: CombatantState; }; }; type AddCombatantFromStatBlock = { type: "AddCombatantFromStatBlock"; payload: { combatantId: string; statBlock: StatBlock; rolledHP?: number; }; }; type RemoveCombatant = { type: "RemoveCombatant"; payload: { combatantId: string; }; }; type StartEncounter = { type: "StartEncounter"; payload: { initiativesByCombatantId: Record<string, number>; }; }; type EndEncounter = { type: "EndEncounter"; }; type NextTurn = { type: "NextTurn"; }; type PreviousTurn = { type: "PreviousTurn"; }; /* TODO: >EncounterActions ClearEncounter CleanEncounter RestoreAllPlayerCharacterHP ApplyInitiativesAndResetRound (for round-to-round encounter reroll) >CombatantActions SetStatBlock ApplyDamage ApplyHealing ApplyTemporaryHP SetInitiative LinkInitiative AddTag RemoveTag UpdateNotes SetAlias ToggleHidden ToggleRevealedAC MoveDown MoveUp */
Add NextTurn and PreviousTurn actions
Add NextTurn and PreviousTurn actions
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -6,7 +6,9 @@ | AddCombatantFromStatBlock | RemoveCombatant | StartEncounter - | EndEncounter; + | EndEncounter + | NextTurn + | PreviousTurn; type AddCombatantFromState = { type: "AddCombatantFromState"; @@ -42,6 +44,14 @@ type: "EndEncounter"; }; +type NextTurn = { + type: "NextTurn"; +}; + +type PreviousTurn = { + type: "PreviousTurn"; +}; + /* TODO: >EncounterActions
964ebdeaf942bf9d0e107f5655aa3df25b696683
src/app/core/app.component.ts
src/app/core/app.component.ts
import { Component, OnInit } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent implements OnInit { navOpen: boolean = false; constructor(private router: Router) { } ngOnInit() { this.router.events.subscribe(event => { if (event instanceof NavigationStart && this.navOpen) { this.navOpen = false; } }); } navToggleHandler() { this.navOpen = !this.navOpen; } }
import { Component, OnInit } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent implements OnInit { navOpen: boolean; constructor(private router: Router) { } ngOnInit() { this.router.events.subscribe(event => { if (event instanceof NavigationStart && this.navOpen) { this.navOpen = false; } }); } navToggleHandler($event: boolean) { this.navOpen = $event; } }
Use event on navToggleHandler for value instead of toggling local member.
Use event on navToggleHandler for value instead of toggling local member.
TypeScript
mit
auth0-blog/ng2-dinos,kmaida/ng2-dinos,auth0-blog/ng2-dinos,kmaida/ng2-dinos,auth0-blog/ng2-dinos,kmaida/ng2-dinos
--- +++ @@ -6,7 +6,7 @@ templateUrl: './app.component.html' }) export class AppComponent implements OnInit { - navOpen: boolean = false; + navOpen: boolean; constructor(private router: Router) { } @@ -18,7 +18,7 @@ }); } - navToggleHandler() { - this.navOpen = !this.navOpen; + navToggleHandler($event: boolean) { + this.navOpen = $event; } }
a9e9b061600aae14ac902dc9dad4f2fb58b20503
projects/core/src/lib/interfaces/wp-user.interface.ts
projects/core/src/lib/interfaces/wp-user.interface.ts
export interface WpUser { id?: string; name?: string; url?: string; description?: string; slug?: string; avatar_urls?: { 24?: string, 48?: string, 96?: string }; _links?: any; }
export interface WpUser { id?: string | number; name?: string; url?: string; link?: string; description?: string; slug?: string; avatar_urls?: { 24?: string, 48?: string, 96?: string }; meta?: any[]; _links?: any; }
Add link and meta properties
core: Add link and meta properties
TypeScript
mit
MurhafSousli/ng2-wp-api,MurhafSousli/ng2-wp-api
--- +++ @@ -1,7 +1,8 @@ export interface WpUser { - id?: string; + id?: string | number; name?: string; url?: string; + link?: string; description?: string; slug?: string; avatar_urls?: { @@ -9,5 +10,6 @@ 48?: string, 96?: string }; + meta?: any[]; _links?: any; }
276afa826b7328ae8ebc2fb096aa87963318ae87
SSHServerNodeJS/SSHServerNodeJS/Ciphers/TripleDESCBC.ts
SSHServerNodeJS/SSHServerNodeJS/Ciphers/TripleDESCBC.ts
import { ICipher } from "./ICipher"; import crypto = require("crypto"); export class TripleDESCBC implements ICipher { private m_3DES: crypto.Cipher; public getName(): string { return "3des-cbc"; } public getBlockSize(): number { return 8; } public getKeySize(): number { return 24; } public encrypt(data: Buffer): Buffer { return this.m_3DES.update(data); } public decrypt(data: Buffer): Buffer { return this.m_3DES.update(data); } public setKey(key: Buffer, iv: Buffer): void { this.m_3DES = crypto.createCipheriv("des3", key, iv); } }
import { ICipher } from "./ICipher"; import crypto = require("crypto"); export class TripleDESCBC implements ICipher { private m_Encryptor: crypto.Cipher; private m_Decryptor: crypto.Decipher; public getName(): string { return "3des-cbc"; } public getBlockSize(): number { return 8; } public getKeySize(): number { return 24; } public encrypt(data: Buffer): Buffer { return this.m_Encryptor.update(data); } public decrypt(data: Buffer): Buffer { return this.m_Decryptor.update(data); } public setKey(key: Buffer, iv: Buffer): void { this.m_Encryptor = crypto.createCipheriv("DES-EDE3-CBC", key, iv); this.m_Encryptor.setAutoPadding(false); this.m_Decryptor = crypto.createDecipheriv("DES-EDE3-CBC", key, iv); this.m_Decryptor.setAutoPadding(false); } }
Fix Triple DES to use decryptor for NodeJS
Fix Triple DES to use decryptor for NodeJS
TypeScript
mit
TyrenDe/SSHServer,TyrenDe/SSHServer
--- +++ @@ -3,7 +3,8 @@ import crypto = require("crypto"); export class TripleDESCBC implements ICipher { - private m_3DES: crypto.Cipher; + private m_Encryptor: crypto.Cipher; + private m_Decryptor: crypto.Decipher; public getName(): string { return "3des-cbc"; @@ -18,14 +19,18 @@ } public encrypt(data: Buffer): Buffer { - return this.m_3DES.update(data); + return this.m_Encryptor.update(data); } public decrypt(data: Buffer): Buffer { - return this.m_3DES.update(data); + return this.m_Decryptor.update(data); } public setKey(key: Buffer, iv: Buffer): void { - this.m_3DES = crypto.createCipheriv("des3", key, iv); + this.m_Encryptor = crypto.createCipheriv("DES-EDE3-CBC", key, iv); + this.m_Encryptor.setAutoPadding(false); + + this.m_Decryptor = crypto.createDecipheriv("DES-EDE3-CBC", key, iv); + this.m_Decryptor.setAutoPadding(false); } }
171ef8a0970555e942250036e7c03234c215ff9f
bids-validator/src/fulltest.ts
bids-validator/src/fulltest.ts
/** Adapter to run Node.js bids-validator fullTest with minimal changes from Deno */ import { ValidatorOptions } from './setup/options.ts' import { FileTree, BIDSFile } from './files/filetree.ts' import { walkFileTree } from './schema/walk.ts' import { Issue } from './types/issues.ts' import validate from '../dist/esm/index.js' class AdapterFile { private _file: BIDSFile path: string webkitRelativePath: string constructor(file: BIDSFile) { this._file = file this.path = file.name this.webkitRelativePath = file.name } } export async function fullTestAdapter( tree: FileTree, options: ValidatorOptions, ) { const fileList: Array<AdapterFile> = [] for await (const context of walkFileTree(tree)) { fileList.push(new AdapterFile(context.file)) } validate.BIDS(fileList, options, (issues: Issue[], summary: Record<string, any>) => { console.log(issues) console.log(summary) }) }
/** Adapter to run Node.js bids-validator fullTest with minimal changes from Deno */ import { ValidatorOptions } from './setup/options.ts' import { FileTree, BIDSFile } from './files/filetree.ts' import { walkFileTree } from './schema/walk.ts' import { Issue } from './types/issues.ts' import validate from '../dist/esm/index.js' class AdapterFile { name: string webkitRelativePath: string constructor(path: string, file: BIDSFile) { // JS validator expects dataset-dir/contents filenames this.name = `${path}/${file.name}` this.webkitRelativePath = this.name } } export async function fullTestAdapter( tree: FileTree, options: ValidatorOptions, ) { const fileList: Array<AdapterFile> = [] for await (const context of walkFileTree(tree)) { fileList.push(new AdapterFile(tree.name, context.file)) } console.log(fileList) validate.BIDS(fileList, options, (issues: Issue[], summary: Record<string, any>) => { console.log(issues) console.log(summary) }) }
Add dataset dir prefix to AdapterFile mapping
Add dataset dir prefix to AdapterFile mapping
TypeScript
mit
nellh/bids-validator,nellh/bids-validator,nellh/bids-validator
--- +++ @@ -6,13 +6,12 @@ import validate from '../dist/esm/index.js' class AdapterFile { - private _file: BIDSFile - path: string + name: string webkitRelativePath: string - constructor(file: BIDSFile) { - this._file = file - this.path = file.name - this.webkitRelativePath = file.name + constructor(path: string, file: BIDSFile) { + // JS validator expects dataset-dir/contents filenames + this.name = `${path}/${file.name}` + this.webkitRelativePath = this.name } } @@ -22,8 +21,10 @@ ) { const fileList: Array<AdapterFile> = [] for await (const context of walkFileTree(tree)) { - fileList.push(new AdapterFile(context.file)) + fileList.push(new AdapterFile(tree.name, context.file)) } + + console.log(fileList) validate.BIDS(fileList, options, (issues: Issue[], summary: Record<string, any>) => { console.log(issues)
d66250f0700a4e641836e25ce286828e032d72ce
src/sanitizer/index.ts
src/sanitizer/index.ts
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. import * as sanitize from 'sanitize-html'; /** * A class to sanitize HTML strings. * * #### Notes * This class should not ordinarily need to be instantiated by user code. * Instead, the `defaultSanitizer` instance should be used. */ export class Sanitizer { /** * Sanitize an HTML string. */ sanitize(dirty: string): string { return sanitize(dirty, this._options); } private _options: sanitize.IOptions = { allowedTags: sanitize.defaults.allowedTags.concat('img'), allowedAttributes: { // Allow the "rel" attribute for <a> tags. 'a': sanitize.defaults.allowedAttributes['a'].concat('rel') }, transformTags: { // Set the "rel" attribute for <a> tags to "nofollow". 'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }) } }; } /** * The default instance of the `Sanitizer` class meant for use by user code. */ export const defaultSanitizer = new Sanitizer();
// Copyright (c) Jupyter Development Team. // Distributed under the terms of the Modified BSD License. import * as sanitize from 'sanitize-html'; /** * A class to sanitize HTML strings. * * #### Notes * This class should not ordinarily need to be instantiated by user code. * Instead, the `defaultSanitizer` instance should be used. */ export class Sanitizer { /** * Sanitize an HTML string. */ sanitize(dirty: string): string { return sanitize(dirty, this._options); } private _options: sanitize.IOptions = { allowedTags: sanitize.defaults.allowedTags.concat('img'), allowedAttributes: { // Allow the "rel" attribute for <a> tags. 'a': sanitize.defaults.allowedAttributes['a'].concat('rel'), // Allow the "src" attribute for <img> tags. 'img': ['src'] }, transformTags: { // Set the "rel" attribute for <a> tags to "nofollow". 'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }) } }; } /** * The default instance of the `Sanitizer` class meant for use by user code. */ export const defaultSanitizer = new Sanitizer();
Allow "src" attribute for <img> tags.
Allow "src" attribute for <img> tags.
TypeScript
bsd-3-clause
charnpreetsingh185/jupyterlab,charnpreetsingh185/jupyterlab,TypeFox/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,TypeFox/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,TypeFox/jupyterlab,TypeFox/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,TypeFox/jupyterlab
--- +++ @@ -23,7 +23,9 @@ allowedTags: sanitize.defaults.allowedTags.concat('img'), allowedAttributes: { // Allow the "rel" attribute for <a> tags. - 'a': sanitize.defaults.allowedAttributes['a'].concat('rel') + 'a': sanitize.defaults.allowedAttributes['a'].concat('rel'), + // Allow the "src" attribute for <img> tags. + 'img': ['src'] }, transformTags: { // Set the "rel" attribute for <a> tags to "nofollow".
0ea3e3343b136d5ca1dca3afec1dc628379c72ba
src/utils/telemetry.ts
src/utils/telemetry.ts
'use strict'; import * as appInsights from "applicationinsights"; import packageLockJson from '../../package-lock.json'; import packageJson from '../../package.json'; import * as Constants from '../common/constants'; import { RestClientSettings } from '../models/configurationSettings'; appInsights.setup(Constants.AiKey) .setAutoCollectConsole(false) .setAutoCollectDependencies(false) .setAutoCollectExceptions(false) .setAutoCollectPerformance(false) .setAutoCollectRequests(false) .setAutoDependencyCorrelation(false) .setUseDiskRetryCaching(true) .start(); export class Telemetry { private static readonly restClientSettings: RestClientSettings = RestClientSettings.Instance; private static defaultClient: appInsights.TelemetryClient; public static initialize() { Telemetry.defaultClient = appInsights.defaultClient; const context = Telemetry.defaultClient.context; context.tags[context.keys.applicationVersion] = packageJson.version; context.tags[context.keys.internalSdkVersion] = `node:${packageLockJson.dependencies.applicationinsights.version}`; } public static sendEvent(eventName: string, properties?: { [key: string]: string }) { try { if (Telemetry.restClientSettings.enableTelemetry) { appInsights.defaultClient.trackEvent({name: eventName, properties}); } } catch { } } } Telemetry.initialize();
'use strict'; import * as appInsights from "applicationinsights"; import packageLockJson from '../../package-lock.json'; import packageJson from '../../package.json'; import * as Constants from '../common/constants'; import { RestClientSettings } from '../models/configurationSettings'; appInsights.setup(Constants.AiKey) .setAutoCollectConsole(false) .setAutoCollectDependencies(false) .setAutoCollectExceptions(false) .setAutoCollectPerformance(false) .setAutoCollectRequests(false) .setAutoDependencyCorrelation(false) .setUseDiskRetryCaching(true) .start(); export class Telemetry { private static readonly restClientSettings: RestClientSettings = RestClientSettings.Instance; private static defaultClient: appInsights.TelemetryClient; public static initialize() { Telemetry.defaultClient = appInsights.defaultClient; const context = Telemetry.defaultClient.context; context.tags[context.keys.applicationVersion] = packageJson.version; context.tags[context.keys.internalSdkVersion] = `node:${packageLockJson.dependencies.applicationinsights.version}`; } public static sendEvent(eventName: string, properties?: { [key: string]: string }) { try { if (Telemetry.restClientSettings.enableTelemetry) { Telemetry.defaultClient.trackEvent({ name: eventName, properties }); } } catch { } } } Telemetry.initialize();
Use default client initialized in Telemetry
Use default client initialized in Telemetry
TypeScript
mit
Huachao/vscode-restclient,Huachao/vscode-restclient
--- +++ @@ -31,7 +31,7 @@ public static sendEvent(eventName: string, properties?: { [key: string]: string }) { try { if (Telemetry.restClientSettings.enableTelemetry) { - appInsights.defaultClient.trackEvent({name: eventName, properties}); + Telemetry.defaultClient.trackEvent({ name: eventName, properties }); } } catch { }
e74c03aca3e44419c301b526b8b7a0277cc6811b
tests/cases/fourslash/tsxCompletionNonTagLessThan.ts
tests/cases/fourslash/tsxCompletionNonTagLessThan.ts
/// <reference path='fourslash.ts'/> ////var x: Array<numb/*a*/; ////[].map<numb/*b*/; ////1 < Infini/*c*/; for (const marker of ["a", "b"]) { goTo.marker(marker); verify.completionListContains("number"); verify.not.completionListContains("SVGNumber"); }; goTo.marker("c"); verify.completionListContains("Infinity");
/// <reference path='fourslash.ts'/> // @Filename: /a.tsx ////var x: Array<numb/*a*/; ////[].map<numb/*b*/; ////1 < Infini/*c*/; for (const marker of ["a", "b"]) { goTo.marker(marker); verify.completionListContains("number"); verify.not.completionListContains("SVGNumber"); }; goTo.marker("c"); verify.completionListContains("Infinity");
Add missing filename to tsx test
Add missing filename to tsx test
TypeScript
apache-2.0
kpreisser/TypeScript,TukekeSoft/TypeScript,mihailik/TypeScript,DLehenbauer/TypeScript,TukekeSoft/TypeScript,weswigham/TypeScript,minestarks/TypeScript,jwbay/TypeScript,TukekeSoft/TypeScript,minestarks/TypeScript,mihailik/TypeScript,RyanCavanaugh/TypeScript,erikmcc/TypeScript,SaschaNaz/TypeScript,DLehenbauer/TypeScript,nojvek/TypeScript,synaptek/TypeScript,kitsonk/TypeScript,SaschaNaz/TypeScript,alexeagle/TypeScript,DLehenbauer/TypeScript,nojvek/TypeScript,basarat/TypeScript,weswigham/TypeScript,kitsonk/TypeScript,jwbay/TypeScript,Microsoft/TypeScript,microsoft/TypeScript,microsoft/TypeScript,weswigham/TypeScript,donaldpipowitch/TypeScript,DLehenbauer/TypeScript,Microsoft/TypeScript,synaptek/TypeScript,synaptek/TypeScript,donaldpipowitch/TypeScript,erikmcc/TypeScript,kpreisser/TypeScript,Eyas/TypeScript,basarat/TypeScript,jwbay/TypeScript,donaldpipowitch/TypeScript,Eyas/TypeScript,mihailik/TypeScript,chuckjaz/TypeScript,mihailik/TypeScript,basarat/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,donaldpipowitch/TypeScript,kpreisser/TypeScript,chuckjaz/TypeScript,kitsonk/TypeScript,nojvek/TypeScript,alexeagle/TypeScript,SaschaNaz/TypeScript,Eyas/TypeScript,erikmcc/TypeScript,Eyas/TypeScript,erikmcc/TypeScript,microsoft/TypeScript,synaptek/TypeScript,SaschaNaz/TypeScript,chuckjaz/TypeScript,RyanCavanaugh/TypeScript,RyanCavanaugh/TypeScript,nojvek/TypeScript,basarat/TypeScript,chuckjaz/TypeScript,jwbay/TypeScript,alexeagle/TypeScript
--- +++ @@ -1,5 +1,6 @@ /// <reference path='fourslash.ts'/> +// @Filename: /a.tsx ////var x: Array<numb/*a*/; ////[].map<numb/*b*/; ////1 < Infini/*c*/;
5ca5c1f7dbb6a1bf85a3aa6f61352af49d3c784a
test/run-test.ts
test/run-test.ts
import * as path from 'path'; import { runTests } from 'vscode-test'; async function main() { try { const extensionDevelopmentPath = path.resolve(__dirname, '../../'); const extensionTestsPath = path.resolve(__dirname, './test-main'); const testWorkspacePath = path.resolve(__dirname, "../../templates"); const options = { extensionDevelopmentPath, extensionTestsPath, launchArgs: [ testWorkspacePath ] }; console.log("Running tests with the following options", options); // Download VS Code, unzip it and run the integration test await runTests(options); } catch (err) { console.error('Failed to run tests'); process.exit(1); } } main();
import * as path from 'path'; import { runTests } from 'vscode-test'; async function main() { try { const extensionDevelopmentPath = path.resolve(__dirname, '../../'); const extensionTestsPath = path.resolve(__dirname, './test-main'); const testWorkspacePath = path.resolve(__dirname, "../../templates"); const options = { extensionDevelopmentPath, extensionTestsPath, launchArgs: [ testWorkspacePath ] }; console.log("Running tests with the following options", options); // Download VS Code, unzip it and run the integration test await runTests(options); } catch (err) { console.error('Failed to run tests', err); process.exit(1); } } main();
Add more logging when running tests
Add more logging when running tests
TypeScript
mpl-2.0
hashicorp/vscode-terraform,mauve/vscode-terraform,hashicorp/vscode-terraform,mauve/vscode-terraform,mauve/vscode-terraform,mauve/vscode-terraform,hashicorp/vscode-terraform
--- +++ @@ -22,7 +22,7 @@ // Download VS Code, unzip it and run the integration test await runTests(options); } catch (err) { - console.error('Failed to run tests'); + console.error('Failed to run tests', err); process.exit(1); } }
8fec88ffa8b4728f833d9d112bff58726e62bf0a
packages/components/components/pagination/usePagination.ts
packages/components/components/pagination/usePagination.ts
import { useState, useEffect } from 'react'; const usePagination = <T>(initialList: T[] = [], initialPage = 1, limit = 10) => { const [page, setPage] = useState(initialPage); const onNext = () => setPage(page + 1); const onPrevious = () => setPage(page - 1); const onSelect = (p: number) => setPage(p); const list = [...initialList].splice((page - 1) * limit, limit); useEffect(() => { const lastPage = Math.ceil(initialList.length / limit); if (lastPage && page > lastPage) { onSelect(lastPage); } }, [initialList.length]); return { page, list, onNext, onPrevious, onSelect, }; }; export default usePagination;
import { useState, useEffect } from 'react'; const usePagination = <T>(initialList: T[] = [], initialPage = 1, limit = 10) => { const [page, setPage] = useState(initialPage); const onNext = () => setPage(page + 1); const onPrevious = () => setPage(page - 1); const onSelect = (p: number) => setPage(p); const list = [...initialList].splice((page - 1) * limit, limit); const lastPage = Math.ceil(initialList.length / limit); const isLastPage = page === lastPage; useEffect(() => { if (lastPage && page > lastPage) { onSelect(lastPage); } }, [initialList.length]); return { page, isLastPage, list, onNext, onPrevious, onSelect, }; }; export default usePagination;
Use sorted list for next item
Use sorted list for next item
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -6,9 +6,10 @@ const onPrevious = () => setPage(page - 1); const onSelect = (p: number) => setPage(p); const list = [...initialList].splice((page - 1) * limit, limit); + const lastPage = Math.ceil(initialList.length / limit); + const isLastPage = page === lastPage; useEffect(() => { - const lastPage = Math.ceil(initialList.length / limit); if (lastPage && page > lastPage) { onSelect(lastPage); } @@ -16,6 +17,7 @@ return { page, + isLastPage, list, onNext, onPrevious,
af2c9720b2d623af313a15ce03e72ab8c58c1590
src/app/shared/http.service.ts
src/app/shared/http.service.ts
import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import { environment } from '../index'; @Injectable() export class HttpService { protected headers: Headers = new Headers(); constructor(private http: Http) { this.headers.append('Content-Type', 'application/json'); this.headers.append('Accept', 'application/json'); } get(url: string) { return this.http.get(environment.endpoint + url, {headers: this.headers, withCredentials: true}).map(res => res.json()) } post(url: string, object: any) { return this.http.post(environment.endpoint + url, JSON.stringify(object), {headers: this.headers, withCredentials: true}).map(res => res.json()); } }
import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import { environment } from '../index'; import { Observable } from 'rxjs/Rx'; @Injectable() export class HttpService { protected headers: Headers = new Headers(); protected $observables: {[id: string]: Observable<any>} = {}; protected data: {[id: string]: Observable<any>} = {}; constructor(private http: Http) { this.headers.append('Content-Type', 'application/json'); this.headers.append('Accept', 'application/json'); } get(url: string) { if (this.data.hasOwnProperty(url)) { return Observable.of(this.data[url]); } else if (this.$observables.hasOwnProperty(url)) { return this.$observables[url]; } else { this.$observables[url] = this.http.get(environment.endpoint + url, { headers: this.headers, withCredentials: true }) .map(res => res.json()) .do(val => { this.data[url] = val; delete this.$observables[url]; }) // .catch(() => { // delete this.data[url]; // delete this.$observables[url]; // }) .share(); return this.$observables[url]; } } post(url: string, object: any) { return this.http.post(environment.endpoint + url, JSON.stringify(object), { headers: this.headers, withCredentials: true }).map(res => res.json()); } }
Add cache to prevent multiple server requests
[TASK] Add cache to prevent multiple server requests
TypeScript
mit
t3dd/T3DD16.Frontend,t3dd/T3DD16.Frontend,t3dd/T3DD16.Frontend
--- +++ @@ -1,11 +1,14 @@ import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import { environment } from '../index'; +import { Observable } from 'rxjs/Rx'; @Injectable() export class HttpService { protected headers: Headers = new Headers(); + protected $observables: {[id: string]: Observable<any>} = {}; + protected data: {[id: string]: Observable<any>} = {}; constructor(private http: Http) { this.headers.append('Content-Type', 'application/json'); @@ -13,11 +16,34 @@ } get(url: string) { - return this.http.get(environment.endpoint + url, {headers: this.headers, withCredentials: true}).map(res => res.json()) + if (this.data.hasOwnProperty(url)) { + return Observable.of(this.data[url]); + } else if (this.$observables.hasOwnProperty(url)) { + return this.$observables[url]; + } else { + this.$observables[url] = this.http.get(environment.endpoint + url, { + headers: this.headers, + withCredentials: true + }) + .map(res => res.json()) + .do(val => { + this.data[url] = val; + delete this.$observables[url]; + }) + // .catch(() => { + // delete this.data[url]; + // delete this.$observables[url]; + // }) + .share(); + return this.$observables[url]; + } } post(url: string, object: any) { - return this.http.post(environment.endpoint + url, JSON.stringify(object), {headers: this.headers, withCredentials: true}).map(res => res.json()); + return this.http.post(environment.endpoint + url, JSON.stringify(object), { + headers: this.headers, + withCredentials: true + }).map(res => res.json()); } }
65641bffe84ad6ed10428401d3ae0de48c53546d
packages/@glimmer/application/src/helpers/user-helper.ts
packages/@glimmer/application/src/helpers/user-helper.ts
import { Dict, Opaque } from '@glimmer/util'; import { PathReference, TagWrapper, RevisionTag } from "@glimmer/reference"; import { Arguments, CapturedArguments, Helper as GlimmerHelper, VM } from "@glimmer/runtime"; import { RootReference } from '@glimmer/component'; export type UserHelper = (args: ReadonlyArray<Opaque>, named: Dict<Opaque>) => any; export default function buildUserHelper(helperFunc): GlimmerHelper { return (_vm: VM, args: Arguments) => new HelperReference(helperFunc, args); } export class HelperReference implements PathReference<Opaque> { private helper: UserHelper; private args: CapturedArguments; public tag: TagWrapper<RevisionTag>; constructor(helper: UserHelper, args: Arguments) { this.helper = helper; this.tag = args.tag; this.args = args.capture(); } value() { let { helper, args } = this; return helper(args.positional.value(), args.named.value()); } get(): RootReference { return new RootReference(this); } }
import { Dict, Opaque } from '@glimmer/util'; import { TagWrapper, RevisionTag } from "@glimmer/reference"; import { Arguments, CapturedArguments, Helper as GlimmerHelper, VM } from "@glimmer/runtime"; import { CachedReference } from '@glimmer/component'; export type UserHelper = (args: ReadonlyArray<Opaque>, named: Dict<Opaque>) => any; export default function buildUserHelper(helperFunc): GlimmerHelper { return (_vm: VM, args: Arguments) => new HelperReference(helperFunc, args); } export class HelperReference extends CachedReference<Opaque> { public tag: TagWrapper<RevisionTag>; private args: CapturedArguments; constructor(private helper: UserHelper, args: Arguments) { super(); this.tag = args.tag; this.args = args.capture(); } compute() { let { helper, args } = this; return helper(args.positional.value(), args.named.value()); } }
Make user helper references cached
Make user helper references cached Recent changes in the Glimmer VM cause references to be reified (i.e. have their value() method called) multiple times per invocation, which is potentially expensive as well as very surprising to users. Users have an intuition that helper calls are functions calls, and a single invocation of the helper should produce a single invocation of the function. While this is something we may want to try to address in the VM, by reifying the helper value once per invocation and pushing that value on to the stack, ultimately Glimmer’s model is that references should be cheap to reify, and those that are not are responsible for implementing their own caching or other optimizations. This commit applies a blunt force fix to the problem of HelperReference reification being user visible by making them cached. With this change, the return value from a helper is saved and re-used unless the tags of the helper inputs are invalid. This at least allows the tests to pass with the current release version of Glimmer VM, at the cost of extra memory consumption. If we can get more reliable tests in the VM to prevent unnecessary reification of helper references, we can consider reverting this change in the future.
TypeScript
mit
glimmerjs/glimmer.js,glimmerjs/glimmer.js,glimmerjs/glimmer.js,glimmerjs/glimmer.js
--- +++ @@ -4,7 +4,6 @@ } from '@glimmer/util'; import { - PathReference, TagWrapper, RevisionTag } from "@glimmer/reference"; @@ -17,7 +16,7 @@ } from "@glimmer/runtime"; import { - RootReference + CachedReference } from '@glimmer/component'; export type UserHelper = (args: ReadonlyArray<Opaque>, named: Dict<Opaque>) => any; @@ -26,24 +25,20 @@ return (_vm: VM, args: Arguments) => new HelperReference(helperFunc, args); } -export class HelperReference implements PathReference<Opaque> { - private helper: UserHelper; +export class HelperReference extends CachedReference<Opaque> { + public tag: TagWrapper<RevisionTag>; private args: CapturedArguments; - public tag: TagWrapper<RevisionTag>; - constructor(helper: UserHelper, args: Arguments) { - this.helper = helper; + constructor(private helper: UserHelper, args: Arguments) { + super(); + this.tag = args.tag; this.args = args.capture(); } - value() { + compute() { let { helper, args } = this; return helper(args.positional.value(), args.named.value()); } - - get(): RootReference { - return new RootReference(this); - } }
168aaad17fb630fca6ccb23f5fee3e2c3adc5d98
functions/index.ts
functions/index.ts
import * as functions from "firebase-functions"; import * as _ from "lodash"; const maxTasks = 64; interface ITask { key?: string; updatedAt: number; } export const truncateTasks = functions.database.ref("users/{userId}/tasks/{state}/{taskId}").onCreate( async ({ data: { ref: { parent } } }) => { const snapshot = await parent.once("value"); if (snapshot.numChildren() >= maxTasks) { const tasks = snapshot.val(); for (const task of extractOldTasks(tasks)) { _.remove(tasks, task); } await parent.set(tasks); } }); function extractOldTasks(tasks: ITask[]): ITask[] { return _.sortBy(tasks, ({ updatedAt }) => -updatedAt).slice(maxTasks); }
import * as functions from "firebase-functions"; import * as _ from "lodash"; const maxTasks = 64; interface ITask { key?: string; updatedAt: number; } export const truncateTasks = functions.database.ref("users/{userId}/tasks/{state}/{taskId}").onCreate( async ({ data: { ref: { parent } } }) => { const snapshot = await parent.once("value"); if (snapshot.numChildren() > maxTasks) { const tasks = snapshot.val(); for (const task of extractOldTasks(tasks)) { _.remove(tasks, task); } await parent.set(tasks); } }); function extractOldTasks(tasks: ITask[]): ITask[] { return _.sortBy(tasks, ({ updatedAt }) => -updatedAt).slice(maxTasks); }
Fix check of number of tasks
Fix check of number of tasks
TypeScript
mit
raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d
--- +++ @@ -12,7 +12,7 @@ async ({ data: { ref: { parent } } }) => { const snapshot = await parent.once("value"); - if (snapshot.numChildren() >= maxTasks) { + if (snapshot.numChildren() > maxTasks) { const tasks = snapshot.val(); for (const task of extractOldTasks(tasks)) {
e8b471ea65e3f58a77333dcd8685f74033f4ce74
test/e2e/assertion/assertion_test.ts
test/e2e/assertion/assertion_test.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {assert} from 'chai'; import {expectedErrors} from '../../conductor/hooks.js'; import {getBrowserAndPages, goToResource, step} from '../../shared/helper.js'; import {describe, it} from '../../shared/mocha-extensions.js'; describe('Assertions', async function() { it('console.assert', async () => { const {frontend} = getBrowserAndPages(); await step('Check the evaluation results from console', async () => { frontend.evaluate(() => { console.assert(false, 'expected failure 1'); }); }); await goToResource('cross_tool/default.html'); assert.strictEqual(expectedErrors.length, 1); assert.ok(expectedErrors[0].includes('expected failure 1')); }); it('console.error', async () => { const {frontend} = getBrowserAndPages(); await step('Check the evaluation results from console', async () => { frontend.evaluate(() => { function foo() { console.error('expected failure 2'); } foo(); }); }); await goToResource('cross_tool/default.html'); assert.strictEqual(expectedErrors.length, 2); assert.ok(expectedErrors[1].includes('expected failure 2')); }); });
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import {assert} from 'chai'; import {expectedErrors} from '../../conductor/hooks.js'; import {getBrowserAndPages, goToResource, step} from '../../shared/helper.js'; import {describe, it} from '../../shared/mocha-extensions.js'; describe('Assertions', async function() { it('console.assert', async () => { const {frontend} = getBrowserAndPages(); await step('Check the evaluation results from console', async () => { frontend.evaluate(() => { console.assert(false, 'expected failure 1'); }); }); await goToResource('cross_tool/default.html'); assert.strictEqual(expectedErrors.length, 1); assert.ok(expectedErrors[0].includes('expected failure 1')); }); // Suspected flaky console.errors are persisting from previous e2e-tests it.skip('[crbug.com/1145969]: console.error', async () => { const {frontend} = getBrowserAndPages(); await step('Check the evaluation results from console', async () => { frontend.evaluate(() => { function foo() { console.error('expected failure 2'); } foo(); }); }); await goToResource('cross_tool/default.html'); assert.strictEqual(expectedErrors.length, 2); assert.ok(expectedErrors[1].includes('expected failure 2')); }); });
Disable flaky console.error assertion test
Disable flaky console.error assertion test This is a revival of https://crrev.com/c/2520821 because we are still seeing the same build failures. Bug: 1145969 Change-Id: I999682502dbda10c515c6339078a43c8b1ce7dcd Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2529349 Reviewed-by: Yang Guo <[email protected]> Commit-Queue: Wolfgang Beyer <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -21,7 +21,8 @@ assert.ok(expectedErrors[0].includes('expected failure 1')); }); - it('console.error', async () => { + // Suspected flaky console.errors are persisting from previous e2e-tests + it.skip('[crbug.com/1145969]: console.error', async () => { const {frontend} = getBrowserAndPages(); await step('Check the evaluation results from console', async () => { frontend.evaluate(() => {
fe3a7d8dfa3e3ea014aeade51587f0d848f54f92
src/client/app/watchlist/sidebar/search/search-api.service.ts
src/client/app/watchlist/sidebar/search/search-api.service.ts
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Config, CoreApiResponseService } from '../../../core/index'; import { SearchStateService } from './state/index'; import { WatchlistStateService } from '../../state/watchlist-state.service'; declare let _:any; @Injectable() export class SearchApiService extends CoreApiResponseService { private favorites:string[] = []; private stock:string; constructor(public http:Http, private watchlistState:WatchlistStateService, private searchState:SearchStateService) { super(http, searchState); this.watchlistState.favorites$.subscribe( favorites => this.favorites = favorites ); } load(stock:string) { this.stock = stock; this.searchState.fetchLoader(true); if(Config.env === 'PROD') { this.post(Config.paths.proxy, 'url=' + encodeURIComponent(Config.paths.search.replace('$stock', encodeURIComponent(stock)))) .subscribe( data => this.complete(this.transform(data)), () => this.failed() ); } else { this.get(Config.paths.search) .subscribe( data => this.complete(this.transform(data)), () => this.failed() ); } } reload() { this.load(this.stock); } private transform(data:any):any[] { return _.get(data, 'data.items', []).filter((item:any) => { return this.favorites.indexOf(item.symbol) === -1; }); } }
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Config, CoreApiResponseService } from '../../../core/index'; import { SearchStateService } from './state/index'; import { WatchlistStateService } from '../../state/watchlist-state.service'; declare let _:any; @Injectable() export class SearchApiService extends CoreApiResponseService { private favorites:string[] = []; private stock:string; constructor(public http:Http, private watchlistState:WatchlistStateService, private searchState:SearchStateService) { super(http, searchState); this.watchlistState.favorites$.subscribe( favorites => this.favorites = favorites ); } load(stock:string) { this.stock = stock; this.searchState.fetchLoader(true); if(Config.env === 'PROD') { this.post(Config.paths.proxy, 'url=' + encodeURIComponent(Config.paths.search.replace('$stock', encodeURIComponent(stock)))) .subscribe( data => this.complete(this.transform(data)), () => this.failed() ); } else { this.get(Config.paths.search) .subscribe( data => this.complete(this.transform(data)), () => this.failed() ); } } reload() { this.load(this.stock); } private transform(data:any):any[] { return _.get(data, 'data.items', []); } }
Remove filter logic from the search results.
Remove filter logic from the search results.
TypeScript
mit
mpetkov/ng2-finance,mpetkov/ng2-finance,mpetkov/ng2-finance
--- +++ @@ -44,8 +44,6 @@ } private transform(data:any):any[] { - return _.get(data, 'data.items', []).filter((item:any) => { - return this.favorites.indexOf(item.symbol) === -1; - }); + return _.get(data, 'data.items', []); } }
5a32f27d66d871af5ab111fd03b34ecdef42576e
test/syntax/eval-pipe-spec.ts
test/syntax/eval-pipe-spec.ts
import { expect } from "chai"; import * as frame from "../../src/frames"; import * as lex from "../../src/syntax/lex-pipe"; import * as parse from "../../src/syntax/parse"; import { EvalPipe } from "../../src/syntax/eval-pipe"; describe("EvalPipe", () => { let out: frame.FrameArray; let pipe: EvalPipe; beforeEach(() => { out = new frame.FrameArray([]); pipe = new EvalPipe(out); }); it("is exported", () => { expect(EvalPipe).to.be.ok; }); it("is constructed from an out parameter", () => { expect(pipe).to.be.ok; }); it("evaluates arguments", () => { const strA = new frame.FrameString("A"); const strB = new frame.FrameString("B"); const expr = new frame.FrameExpr([strA, strB]); const result = pipe.call(expr); expect(result.toString()).to.equal("“AB”"); }); });
import { expect } from "chai"; import * as frame from "../../src/frames"; import * as lex from "../../src/syntax/lex-pipe"; import * as parse from "../../src/syntax/parse"; import { EvalPipe } from "../../src/syntax/eval-pipe"; describe("EvalPipe", () => { const strA = new frame.FrameString("A"); const strB = new frame.FrameString("B"); const expr = new frame.FrameExpr([strA, strB]); let out: frame.FrameArray; let pipe: EvalPipe; beforeEach(() => { out = new frame.FrameArray([]); pipe = new EvalPipe(out); }); it("is exported", () => { expect(EvalPipe).to.be.ok; }); it("is constructed from an out parameter", () => { expect(pipe).to.be.ok; }); it("evaluates arguments", () => { const result = pipe.call(expr); expect(result.toString()).to.equal("“AB”"); }); it("stores result in out", () => { expect(out.size()).to.equal(0); const result = pipe.call(expr); expect(out.size()).to.equal(1); expect(out.at(0)).to.equal(result); }); });
Check array out on EvalPipe
Check array out on EvalPipe
TypeScript
mit
TheSwanFactory/hclang,TheSwanFactory/maml,TheSwanFactory/hclang,TheSwanFactory/maml
--- +++ @@ -6,6 +6,9 @@ import { EvalPipe } from "../../src/syntax/eval-pipe"; describe("EvalPipe", () => { + const strA = new frame.FrameString("A"); + const strB = new frame.FrameString("B"); + const expr = new frame.FrameExpr([strA, strB]); let out: frame.FrameArray; let pipe: EvalPipe; @@ -23,10 +26,14 @@ }); it("evaluates arguments", () => { - const strA = new frame.FrameString("A"); - const strB = new frame.FrameString("B"); - const expr = new frame.FrameExpr([strA, strB]); const result = pipe.call(expr); expect(result.toString()).to.equal("“AB”"); }); + + it("stores result in out", () => { + expect(out.size()).to.equal(0); + const result = pipe.call(expr); + expect(out.size()).to.equal(1); + expect(out.at(0)).to.equal(result); + }); });
153c954b5d1013759134d03a688435fe57e5e84b
packages/rev-forms-redux-mui/src/fields/BooleanField.tsx
packages/rev-forms-redux-mui/src/fields/BooleanField.tsx
import * as React from 'react'; import MUICheckbox from 'material-ui/Checkbox'; import { IRevFieldTypeProps } from './types'; export default function BooleanField(props: IRevFieldTypeProps) { const onCheck = (event: any, isInputChecked: boolean) => { props.input.onChange(isInputChecked); }; let checked = props.input.value ? true : false; return ( <div style={{width: 250, paddingTop: 15, paddingBottom: 15}}> <MUICheckbox name={props.field.name} label={props.field.label} checked={checked} onCheck={onCheck} onFocus={props.input.onFocus} onBlur={props.input.onBlur} /> </div> ); }
import * as React from 'react'; import MUICheckbox from 'material-ui/Checkbox'; import { IRevFieldTypeProps } from './types'; export default function BooleanField(props: IRevFieldTypeProps) { const onCheck = (event: any, isInputChecked: boolean) => { props.input.onChange(isInputChecked); }; let checked = props.input.value ? true : false; const styles = { checkbox: { marginTop: 16, marginBottom: 5, textAlign: 'left' }, label: { } }; return ( <MUICheckbox name={props.field.name} label={props.field.label} checked={checked} onCheck={onCheck} onFocus={props.input.onFocus} onBlur={props.input.onBlur} style={styles.checkbox} labelStyle={styles.label} /> ); }
Fix layout issue with checkbox control (text-align)
Fix layout issue with checkbox control (text-align)
TypeScript
mit
RevFramework/rev-framework,RevFramework/rev-framework
--- +++ @@ -13,16 +13,26 @@ let checked = props.input.value ? true : false; + const styles = { + checkbox: { + marginTop: 16, + marginBottom: 5, + textAlign: 'left' + }, + label: { + } + }; + return ( - <div style={{width: 250, paddingTop: 15, paddingBottom: 15}}> - <MUICheckbox - name={props.field.name} - label={props.field.label} - checked={checked} - onCheck={onCheck} - onFocus={props.input.onFocus} - onBlur={props.input.onBlur} - /> - </div> + <MUICheckbox + name={props.field.name} + label={props.field.label} + checked={checked} + onCheck={onCheck} + onFocus={props.input.onFocus} + onBlur={props.input.onBlur} + style={styles.checkbox} + labelStyle={styles.label} + /> ); }
e1ba7432bc929fed4087b992c7906b380867d314
src/marketplace/offerings/actions/ActionsDropdown.tsx
src/marketplace/offerings/actions/ActionsDropdown.tsx
import * as React from 'react'; import * as Dropdown from 'react-bootstrap/lib/Dropdown'; import { translate } from '@waldur/i18n'; import { OfferingAction } from './types'; interface ActionsDropdownProps { actions?: OfferingAction[]; } export const ActionsDropdown = ({ actions }: ActionsDropdownProps) => ( <Dropdown id="offering-actions"> <Dropdown.Toggle className="btn-sm"> {translate('Actions')} </Dropdown.Toggle> <Dropdown.Menu> {actions.length === 0 && <li role="presentation"> <a>{translate('There are no actions.')}</a> </li> } {actions.map((action, index) => ( <li key={index} className="cursor-pointer" role="presentation"> <a onClick={action.handler} role="menuitem" tabIndex={-1}> {action.label} </a> </li> ))} </Dropdown.Menu> </Dropdown> );
import * as React from 'react'; import * as Dropdown from 'react-bootstrap/lib/Dropdown'; import { translate } from '@waldur/i18n'; import { OfferingAction } from './types'; interface ActionsDropdownProps { actions: OfferingAction[]; } export const ActionsDropdown = ({ actions }: ActionsDropdownProps) => ( <Dropdown id="offering-actions"> <Dropdown.Toggle className="btn-sm"> {translate('Actions')} </Dropdown.Toggle> <Dropdown.Menu> {actions.length === 0 && <li role="presentation"> <a>{translate('There are no actions.')}</a> </li> } {actions.map((action, index) => ( <li key={index} className="cursor-pointer" role="presentation"> <a onClick={action.handler} role="menuitem" tabIndex={-1}> {action.label} </a> </li> ))} </Dropdown.Menu> </Dropdown> );
Improve typing for offering actions.
Improve typing for offering actions.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -6,7 +6,7 @@ import { OfferingAction } from './types'; interface ActionsDropdownProps { - actions?: OfferingAction[]; + actions: OfferingAction[]; } export const ActionsDropdown = ({ actions }: ActionsDropdownProps) => (
db603354921de7360a1d27bf406c37790c439d34
examples/parties/client/party-details/party-details.ts
examples/parties/client/party-details/party-details.ts
/// <reference path="../../typings/all.d.ts" /> import {Component, View, Inject} from 'angular2/angular2'; import {ROUTER_DIRECTIVES, RouteParams} from 'angular2/router'; import {MeteorComponent} from 'angular2-meteor'; import {Parties} from 'collections/parties'; @Component({ selector: 'party-details' }) @View({ templateUrl: 'client/party-details/party-details.ng.html', directives: [ROUTER_DIRECTIVES] }) export class PartyDetailsCmp extends MeteorComponent { party: Party = { name: '' }; constructor(@Inject(RouteParams) routeParams: RouteParams) { super(); var partyId = routeParams.params['partyId']; this.subscribe('party', partyId, () => { this.party = Parties.findOne(partyId); }); } }
/// <reference path="../../typings/all.d.ts" /> import {Component, View, Inject} from 'angular2/angular2'; import {ROUTER_DIRECTIVES, RouteParams} from 'angular2/router'; import {MeteorComponent} from 'angular2-meteor'; import {Parties} from 'collections/parties'; @Component({ selector: 'party-details' }) @View({ templateUrl: 'client/party-details/party-details.ng.html', directives: [ROUTER_DIRECTIVES] }) export class PartyDetailsCmp extends MeteorComponent { party: Party = { name: '' }; constructor(@Inject(RouteParams) routeParams: RouteParams) { super(); var partyId = routeParams.params['partyId']; this.subscribe('party', partyId, () => { this.party = Parties.findOne(partyId); }, true); } }
Update example with new subscribtion overloading
Update example with new subscribtion overloading
TypeScript
mit
DAB0mB/angular-meteor,davidyaha/angular-meteor,sebakerckhof/angular-meteor,sebakerckhof/angular-meteor,barbatus/angular-meteor,kamilkisiela/angular-meteor,sebakerckhof/angular-meteor,davidyaha/angular-meteor,Urigo/angular-meteor,davidyaha/angular-meteor,barbatus/angular-meteor,kamilkisiela/angular-meteor,DAB0mB/angular-meteor,barbatus/angular-meteor,DAB0mB/angular-meteor,kamilkisiela/angular-meteor,darkbasic/angular-meteor
--- +++ @@ -23,6 +23,6 @@ var partyId = routeParams.params['partyId']; this.subscribe('party', partyId, () => { this.party = Parties.findOne(partyId); - }); + }, true); } }
4fe755eb776835e01eaa279b0ef53294493d715a
src/containers/About/index.tsx
src/containers/About/index.tsx
import * as React from 'react'; import { Headline, Markdown, Image, Paragraph, Avatar, Anchor, Article, } from 'components'; const { Container, AboutSection, AboutSectionInner, StyledHr, AvatarContainer, Div, Divider, Github, Card, CardFooter, } = require('./styles'); const about = require('./about').default; import contributors from './contributors'; class About extends React.Component<any, any> { public render() { return ( <Container> <AboutSection id="about-section-1"> <Headline textAlign="left"> About <StyledHr /> </Headline> <AboutSectionInner> <Article content={`${about.aboutContent}`} /> </AboutSectionInner> </AboutSection> <AboutSection id="about-section-two" padBottom> <Headline> Team Members <StyledHr/> </Headline> <AboutSectionInner> {contributors.map(contributor => <Card> <AvatarContainer> <Avatar name={contributor.name} avatarUrl={contributor.avatar} /> <Div> <Markdown content={contributor.bio} /> </Div> <CardFooter> <Anchor href={contributor.github}> <Github /> </Anchor> </CardFooter> </AvatarContainer> </Card> )} </AboutSectionInner> </AboutSection> </Container> ); } } export default About;
import * as React from 'react'; import { Headline, Markdown, Image, Paragraph, Avatar, Anchor, Article, } from 'components'; const { Container, AboutSection, AboutSectionInner, StyledHr, AvatarContainer, Div, Divider, Github, Card, CardFooter, } = require('./styles'); const about = require('./about').default; import contributors from './contributors'; class About extends React.Component<any, any> { public render() { return ( <Container> <AboutSection id="about-section-1"> <Headline textAlign="left"> About <StyledHr /> </Headline> <AboutSectionInner> <Article content={`${about.aboutContent}`} /> </AboutSectionInner> </AboutSection> <AboutSection id="about-section-two" padBottom> <Headline> Team Members <StyledHr/> </Headline> <AboutSectionInner> {contributors.map((contributor, index) => <Card key = {index}> <AvatarContainer> <Avatar name={contributor.name} avatarUrl={contributor.avatar} /> <Div> <Markdown content={contributor.bio} /> </Div> <CardFooter> <Anchor href={contributor.github}> <Github /> </Anchor> </CardFooter> </AvatarContainer> </Card> )} </AboutSectionInner> </AboutSection> </Container> ); } } export default About;
Add key to the map function
Fix: Add key to the map function
TypeScript
mit
scalable-react/scalable-react-typescript-boilerplate,scalable-react/scalable-react-typescript-boilerplate,scalable-react/scalable-react-typescript-boilerplate
--- +++ @@ -44,8 +44,8 @@ <StyledHr/> </Headline> <AboutSectionInner> - {contributors.map(contributor => - <Card> + {contributors.map((contributor, index) => + <Card key = {index}> <AvatarContainer> <Avatar name={contributor.name}
c23d19a5ce307725533b4c6296ca54ba7082c802
web-ng/src/app/services/router/router.service.spec.ts
web-ng/src/app/services/router/router.service.spec.ts
/** * Copyright 2020 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { TestBed } from '@angular/core/testing'; import { RouterService } from './router.service'; import { Router } from '@angular/router'; import { AngularFireModule } from '@angular/fire'; describe('RouterService', () => { let service: RouterService; beforeEach(() => { TestBed.configureTestingModule({ imports: [AngularFireModule.initializeApp({})], providers: [{ provide: Router, useValue: {} }], }); service = TestBed.inject(RouterService); }); it('should be created', () => { expect(service).toBeTruthy(); }); });
/** * Copyright 2020 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { TestBed } from '@angular/core/testing'; import { RouterService } from './router.service'; import { Router } from '@angular/router'; import { AngularFireModule } from '@angular/fire'; describe('RouterService', () => { let service: RouterService; beforeEach(() => { TestBed.configureTestingModule({ imports: [AngularFireModule.initializeApp({ projectId: '' })], providers: [{ provide: Router, useValue: {} }], }); service = TestBed.inject(RouterService); }); it('should be created', () => { expect(service).toBeTruthy(); }); });
Add project in firestub test
Add project in firestub test
TypeScript
apache-2.0
google/ground-platform,google/ground-platform,google/ground-platform,google/ground-platform
--- +++ @@ -25,7 +25,7 @@ beforeEach(() => { TestBed.configureTestingModule({ - imports: [AngularFireModule.initializeApp({})], + imports: [AngularFireModule.initializeApp({ projectId: '' })], providers: [{ provide: Router, useValue: {} }], }); service = TestBed.inject(RouterService);
9ec3aebc65a10b5664afbbb99c226009edd14856
front_end/component_docs/linear_memory_inspector/basic.ts
front_end/component_docs/linear_memory_inspector/basic.ts
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // TODO(crbug.com/1146002): Replace this import as soon as // we are able to use `import as * ...` across the codebase // in the following files: // LinearMemoryNavigator.ts // LinearMemoryValueInterpreter.ts import '../../ui/components/Icon.js'; import * as ComponentHelpers from '../../component_helpers/component_helpers.js'; import * as LinearMemoryInspector from '../../linear_memory_inspector/linear_memory_inspector.js'; await ComponentHelpers.ComponentServerSetup.setup(); const array = []; const string = 'Hello this is a string from the memory buffer!'; for (let i = 0; i < string.length; ++i) { array.push(string.charCodeAt(i)); } for (let i = -1000; i < 1000; ++i) { array.push(i); } const memory = new Uint8Array(array); const memoryInspector = new LinearMemoryInspector.LinearMemoryInspector.LinearMemoryInspector(); document.getElementById('container')?.appendChild(memoryInspector); memoryInspector.data = { memory: memory, address: 0, memoryOffset: 0, outerMemoryLength: memory.length, };
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import * as ComponentHelpers from '../../component_helpers/component_helpers.js'; import * as LinearMemoryInspector from '../../linear_memory_inspector/linear_memory_inspector.js'; await ComponentHelpers.ComponentServerSetup.setup(); const array = []; const string = 'Hello this is a string from the memory buffer!'; for (let i = 0; i < string.length; ++i) { array.push(string.charCodeAt(i)); } for (let i = -1000; i < 1000; ++i) { array.push(i); } const memory = new Uint8Array(array); const memoryInspector = new LinearMemoryInspector.LinearMemoryInspector.LinearMemoryInspector(); document.getElementById('container')?.appendChild(memoryInspector); memoryInspector.data = { memory: memory, address: 0, memoryOffset: 0, outerMemoryLength: memory.length, };
Remove old TODO from linear_memory_inspector example
Remove old TODO from linear_memory_inspector example This TODO is not required any more; the source files do declare a dep on the UI Components folder which house the icon. The associated bug should remain open as there is more work to do to make declaring component dependencies easier (LitHtml 2 should help here). Change-Id: I9375e2dc8dbd781be86522daaa3023699942e52b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2617788 Commit-Queue: Jack Franklin <[email protected]> Reviewed-by: Kim-Anh Tran <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -2,12 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(crbug.com/1146002): Replace this import as soon as -// we are able to use `import as * ...` across the codebase -// in the following files: -// LinearMemoryNavigator.ts -// LinearMemoryValueInterpreter.ts -import '../../ui/components/Icon.js'; import * as ComponentHelpers from '../../component_helpers/component_helpers.js'; import * as LinearMemoryInspector from '../../linear_memory_inspector/linear_memory_inspector.js';
261f57be7d7dff0a213ad2af3cfd3757cfefe9d1
src/app/config/constants/constants.ts
src/app/config/constants/constants.ts
import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import apiURL from 'src/app/config/constants/apiURL'; interface externalNameResponseFormat { externalName: String; }; @Injectable({ providedIn: 'root', }) export class DoubtfireConstants { constructor(private httpClient: HttpClient) { console.log("getting api url"); httpClient.get(`${this.apiURL}/settings`).toPromise().then((response: externalNameResponseFormat) => { this.externalName = response.externalName; }) } public mainContributors: Array<string> = [ 'macite', // Andrew Cain 'alexcu', // Alex Cummaudo 'jakerenzella' ]; public apiURL = apiURL; public externalName: String = "Loading..."; }
import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import apiURL from 'src/app/config/constants/apiURL'; interface externalNameResponseFormat { externalName: String; }; @Injectable({ providedIn: 'root', }) export class DoubtfireConstants { constructor(private httpClient: HttpClient) { httpClient.get(`${this.apiURL}/settings`).toPromise().then((response: externalNameResponseFormat) => { this.externalName = response.externalName; }) } public mainContributors: string[] = [ 'macite', // Andrew Cain 'alexcu', // Alex Cummaudo 'jakerenzella' // Jake Renzella ]; public apiURL = apiURL; public externalName: String = "Loading..."; }
Remove log and fix type of array
ENHANCE: Remove log and fix type of array
TypeScript
agpl-3.0
doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web
--- +++ @@ -11,15 +11,14 @@ }) export class DoubtfireConstants { constructor(private httpClient: HttpClient) { - console.log("getting api url"); httpClient.get(`${this.apiURL}/settings`).toPromise().then((response: externalNameResponseFormat) => { this.externalName = response.externalName; }) } - public mainContributors: Array<string> = [ + public mainContributors: string[] = [ 'macite', // Andrew Cain 'alexcu', // Alex Cummaudo - 'jakerenzella' + 'jakerenzella' // Jake Renzella ]; public apiURL = apiURL; public externalName: String = "Loading...";
459b8ffcff638967c9254b4d958620f1c9f166c0
html-formatter/javascript/src/main.tsx
html-formatter/javascript/src/main.tsx
import { messages } from '@cucumber/messages' import { GherkinDocumentList, QueriesWrapper } from '@cucumber/react' import { Query as GherkinQuery } from '@cucumber/gherkin' import { Query as CucumberQuery } from '@cucumber/query' import React from 'react' import ReactDOM from 'react-dom' declare global { interface Window { CUCUMBER_MESSAGES: messages.IEnvelope[] } } const gherkinQuery = new GherkinQuery() const cucumberQuery = new CucumberQuery() for (const envelopeObject of window.CUCUMBER_MESSAGES) { const envelope = messages.Envelope.fromObject(envelopeObject) gherkinQuery.update(envelope) cucumberQuery.update(envelope) } const app = ( <QueriesWrapper gherkinQuery={gherkinQuery} cucumberQuery={cucumberQuery}> <GherkinDocumentList /> </QueriesWrapper> ) ReactDOM.render(app, document.getElementById('content'))
import { messages } from '@cucumber/messages' import { GherkinDocumentList, QueriesWrapper, EnvelopesQuery, } from '@cucumber/react' import { Query as GherkinQuery } from '@cucumber/gherkin' import { Query as CucumberQuery } from '@cucumber/query' import React from 'react' import ReactDOM from 'react-dom' declare global { interface Window { CUCUMBER_MESSAGES: messages.IEnvelope[] } } const gherkinQuery = new GherkinQuery() const cucumberQuery = new CucumberQuery() const envelopesQuery = new EnvelopesQuery() for (const envelopeObject of window.CUCUMBER_MESSAGES) { const envelope = messages.Envelope.fromObject(envelopeObject) gherkinQuery.update(envelope) cucumberQuery.update(envelope) envelopesQuery.update(envelope) } const app = ( <QueriesWrapper gherkinQuery={gherkinQuery} cucumberQuery={cucumberQuery} envelopesQuery={envelopesQuery} > <GherkinDocumentList /> </QueriesWrapper> ) ReactDOM.render(app, document.getElementById('content'))
Update after react API update
Update after react API update
TypeScript
mit
cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber,cucumber/cucumber
--- +++ @@ -1,5 +1,9 @@ import { messages } from '@cucumber/messages' -import { GherkinDocumentList, QueriesWrapper } from '@cucumber/react' +import { + GherkinDocumentList, + QueriesWrapper, + EnvelopesQuery, +} from '@cucumber/react' import { Query as GherkinQuery } from '@cucumber/gherkin' import { Query as CucumberQuery } from '@cucumber/query' import React from 'react' @@ -13,15 +17,21 @@ const gherkinQuery = new GherkinQuery() const cucumberQuery = new CucumberQuery() +const envelopesQuery = new EnvelopesQuery() for (const envelopeObject of window.CUCUMBER_MESSAGES) { const envelope = messages.Envelope.fromObject(envelopeObject) gherkinQuery.update(envelope) cucumberQuery.update(envelope) + envelopesQuery.update(envelope) } const app = ( - <QueriesWrapper gherkinQuery={gherkinQuery} cucumberQuery={cucumberQuery}> + <QueriesWrapper + gherkinQuery={gherkinQuery} + cucumberQuery={cucumberQuery} + envelopesQuery={envelopesQuery} + > <GherkinDocumentList /> </QueriesWrapper> )
a0f1aab048462a96861697013097eff47ba0b473
cypress/integration/shows.spec.ts
cypress/integration/shows.spec.ts
/* eslint-disable jest/expect-expect */ import { visitWithStatusRetries } from "../helpers/visitWithStatusRetries" describe("Shows", () => { it("/shows", () => { visitWithStatusRetries("shows") cy.get("h1").should("contain", "Featured Shows") cy.title().should("eq", "Art Gallery Shows and Museum Exhibitions | Artsy") visitWithStatusRetries("shows2") cy.get("h1").should("contain", "Featured Shows") cy.title().should("eq", "Art Gallery Shows and Museum Exhibitions | Artsy") }) })
/* eslint-disable jest/expect-expect */ import { visitWithStatusRetries } from "../helpers/visitWithStatusRetries" describe("Shows", () => { it("/shows", () => { visitWithStatusRetries("shows") cy.get("h1").should("contain", "Featured Shows") cy.title().should("eq", "Art Gallery Shows and Museum Exhibitions | Artsy") visitWithStatusRetries("shows2") cy.get("h1").should("contain", "Featured Shows") cy.title().should("eq", "Art Gallery Shows and Museum Exhibitions | Artsy") // follow link to individual show const showLink = cy.get('a[href*="/show/"]:first') showLink.click() cy.url().should("contain", "/show/") cy.contains("Presented by") }) })
Add assertion about visiting individual show page
Add assertion about visiting individual show page
TypeScript
mit
artsy/force,artsy/force,artsy/force-public,artsy/force-public,artsy/force,artsy/force
--- +++ @@ -10,5 +10,11 @@ visitWithStatusRetries("shows2") cy.get("h1").should("contain", "Featured Shows") cy.title().should("eq", "Art Gallery Shows and Museum Exhibitions | Artsy") + + // follow link to individual show + const showLink = cy.get('a[href*="/show/"]:first') + showLink.click() + cy.url().should("contain", "/show/") + cy.contains("Presented by") }) })
4a450786f119a9819ed3186a400b3d997672d043
showcase/setup/setup.module.ts
showcase/setup/setup.module.ts
import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {SetupComponent} from './setup.component'; import {SetupRoutingModule} from './setup-routing.module'; @NgModule({ imports: [ CommonModule, SetupRoutingModule ], declarations: [ SetupComponent ] }) export class SetupModule {}
import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {SetupComponent} from './setup.component'; import {SetupRoutingModule} from './setup-routing.module'; import {CodeHighlighterModule} from '../../components/codehighlighter/codehighlighter'; @NgModule({ imports: [ CommonModule, CodeHighlighterModule, SetupRoutingModule ], declarations: [ SetupComponent ] }) export class SetupModule {}
Add codehighlight to setup doc
Add codehighlight to setup doc
TypeScript
mit
donriver/primeng,pauly815/primeng,donriver/primeng,sourabh8003/ultimate-primeNg,sourabh8003/ultimate-primeNg,ConradSchmidt/primeng,WebRota/primeng,kcjonesevans/primeng,311devs/primeng,carlosearaujo/primeng,sourabh8003/ultimate-primeNg,aaraggornn/primeng,donriver/primeng,sourabh8003/ultimate-primeNg,davidkirolos/primeng,WebRota/primeng,danielkay/primeng,aaraggornn/primeng,pecko/primeng,fusion-ffn/primeng,aaraggornn/primeng,carlosearaujo/primeng,primefaces/primeng,mmercan/primeng,nhnb/primeng,gabriel17carmo/primeng,davidkirolos/primeng,primefaces/primeng,gilhanan/primeng,kojisaiki/primeng,laserus/primeng,primefaces/primeng,carlosearaujo/primeng,danielkay/primeng,hryktrd/primeng,kcjonesevans/primeng,311devs/primeng,gabriel17carmo/primeng,kojisaiki/primeng,pauly815/primeng,kojisaiki/primeng,gilhanan/primeng,laserus/primeng,gabriel17carmo/primeng,howlettt/primeng,311devs/primeng,WebRota/primeng,hryktrd/primeng,hryktrd/primeng,odedolive/primeng,gabriel17carmo/primeng,ConradSchmidt/primeng,mmercan/primeng,nhnb/primeng,davidkirolos/primeng,pecko/primeng,kcjonesevans/primeng,howlettt/primeng,odedolive/primeng,danielkay/primeng,pecko/primeng,mmercan/primeng,ConradSchmidt/primeng,nhnb/primeng,laserus/primeng,mmercan/primeng,pecko/primeng,odedolive/primeng,nhnb/primeng,kcjonesevans/primeng,WebRota/primeng,pauly815/primeng,fusion-ffn/primeng,311devs/primeng,primefaces/primeng,aclarktcc/primeng,gilhanan/primeng,odedolive/primeng,howlettt/primeng,aaraggornn/primeng,donriver/primeng,laserus/primeng,gilhanan/primeng,aclarktcc/primeng,kojisaiki/primeng,fusion-ffn/primeng,ConradSchmidt/primeng,aclarktcc/primeng,pauly815/primeng,davidkirolos/primeng,carlosearaujo/primeng,hryktrd/primeng,aclarktcc/primeng
--- +++ @@ -2,10 +2,12 @@ import {CommonModule} from '@angular/common'; import {SetupComponent} from './setup.component'; import {SetupRoutingModule} from './setup-routing.module'; +import {CodeHighlighterModule} from '../../components/codehighlighter/codehighlighter'; @NgModule({ imports: [ CommonModule, + CodeHighlighterModule, SetupRoutingModule ], declarations: [
36470bce52fb29eb63c516653cbb835a27b86655
components/Board/IconButton.tsx
components/Board/IconButton.tsx
import { IconDefinition } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ButtonHTMLAttributes, DetailedHTMLProps } from "react"; type Props = DetailedHTMLProps< ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement > & { icon: IconDefinition; }; const IconButton = ({ icon, children, ...props }: Props) => ( <button {...props}> <span className="icon"> <FontAwesomeIcon icon={icon} /> </span> <span>{children}</span> </button> ); export default IconButton;
import type { IconDefinition } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ButtonHTMLAttributes, DetailedHTMLProps } from "react"; type Props = DetailedHTMLProps< ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement > & { icon: IconDefinition; }; const IconButton = ({ icon, children, ...props }: Props) => ( <button {...props}> <span className="icon"> <FontAwesomeIcon icon={icon} /> </span> <span>{children}</span> </button> ); export default IconButton;
Use 'import type' to import type
Use 'import type' to import type
TypeScript
mit
nownabe/brainfuck-board,nownabe/brainfuck-board
--- +++ @@ -1,4 +1,4 @@ -import { IconDefinition } from "@fortawesome/free-solid-svg-icons"; +import type { IconDefinition } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ButtonHTMLAttributes, DetailedHTMLProps } from "react";
e361e655ce913a175b6cf4234f509b0f22ed6e44
packages/@sanity/field/src/diff/changes/GroupChange.tsx
packages/@sanity/field/src/diff/changes/GroupChange.tsx
import * as React from 'react' import {GroupChangeNode} from '../types' import {ChangeBreadcrumb} from './ChangeBreadcrumb' import {ChangeResolver} from './ChangeResolver' import {RevertChangesButton} from './RevertChangesButton' import styles from './GroupChange.css' export function GroupChange({change: group}: {change: GroupChangeNode}) { const {titlePath, changes} = group return ( <div className={styles.groupChange}> <div className={styles.changeHeader}> <ChangeBreadcrumb titlePath={titlePath} /> </div> <div className={styles.changeList}> {changes.map(change => ( <ChangeResolver key={change.key} change={change} /> ))} </div> <div> <RevertChangesButton /> </div> </div> ) }
import * as React from 'react' import {GroupChangeNode} from '../types' import {ChangeBreadcrumb} from './ChangeBreadcrumb' import {ChangeResolver} from './ChangeResolver' import styles from './GroupChange.css' export function GroupChange({change: group}: {change: GroupChangeNode}) { const {titlePath, changes} = group return ( <div className={styles.groupChange}> <div className={styles.changeHeader}> <ChangeBreadcrumb titlePath={titlePath} /> </div> <div className={styles.changeList}> {changes.map(change => ( <ChangeResolver key={change.key} change={change} /> ))} </div> </div> ) }
Remove revert changes button from groups
[field] Remove revert changes button from groups
TypeScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -2,7 +2,6 @@ import {GroupChangeNode} from '../types' import {ChangeBreadcrumb} from './ChangeBreadcrumb' import {ChangeResolver} from './ChangeResolver' -import {RevertChangesButton} from './RevertChangesButton' import styles from './GroupChange.css' @@ -19,10 +18,6 @@ <ChangeResolver key={change.key} change={change} /> ))} </div> - - <div> - <RevertChangesButton /> - </div> </div> ) }
9fcc084bb3508ee09f946f23f85d1108b305282f
packages/components/components/sidebar/SidebarBackButton.tsx
packages/components/components/sidebar/SidebarBackButton.tsx
import React from 'react'; import SidebarPrimaryButton from './SidebarPrimaryButton'; import { Props as ButtonProps } from '../button/Button'; const SidebarBackButton = ({ children, ...rest }: ButtonProps) => { return <SidebarPrimaryButton {...rest}>{children}</SidebarPrimaryButton>; }; export default SidebarBackButton;
import React from 'react'; import Button, { Props as ButtonProps } from '../button/Button'; const SidebarBackButton = ({ children, ...rest }: ButtonProps) => { return ( <Button className="pm-button--primaryborder-dark pm-button--large bold mt0-25 w100" {...rest}> {children} </Button> ); }; export default SidebarBackButton;
Update sidebar back button style
Update sidebar back button style
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,10 +1,13 @@ import React from 'react'; -import SidebarPrimaryButton from './SidebarPrimaryButton'; -import { Props as ButtonProps } from '../button/Button'; +import Button, { Props as ButtonProps } from '../button/Button'; const SidebarBackButton = ({ children, ...rest }: ButtonProps) => { - return <SidebarPrimaryButton {...rest}>{children}</SidebarPrimaryButton>; + return ( + <Button className="pm-button--primaryborder-dark pm-button--large bold mt0-25 w100" {...rest}> + {children} + </Button> + ); }; export default SidebarBackButton;
d57b8183bf347392208d2f5eda45179273340efd
projects/hslayers/src/components/sidebar/button.interface.ts
projects/hslayers/src/components/sidebar/button.interface.ts
export interface HsButton { fits: boolean; panel?; module?: string; order?: number; title?; description?; icon?: string; condition?: boolean; content?; important?: boolean; click?; visible?: boolean; }
export interface HsButton { fits?: boolean; panel?; module?: string; order?: number; title?; description?; icon?: string; condition?: boolean; content?; important?: boolean; click?; visible?: boolean; }
Make button fits property optional
Make button fits property optional
TypeScript
mit
hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng
--- +++ @@ -1,5 +1,5 @@ export interface HsButton { - fits: boolean; + fits?: boolean; panel?; module?: string; order?: number;
71430a5211300ef132d86fd093b8d8147168083a
src/SyntaxNodes/HeadingNode.ts
src/SyntaxNodes/HeadingNode.ts
import { InlineSyntaxNode } from './InlineSyntaxNode' import { OutlineSyntaxNode } from './OutlineSyntaxNode' import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer' export class HeadingNode extends InlineSyntaxNodeContainer implements OutlineSyntaxNode { constructor(public children: InlineSyntaxNode[], public level?: number) { super(children) } OUTLINE_SYNTAX_NODE(): void { } }
import { InlineSyntaxNode } from './InlineSyntaxNode' import { OutlineSyntaxNode } from './OutlineSyntaxNode' import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer' export class HeadingNode extends InlineSyntaxNodeContainer implements OutlineSyntaxNode { constructor(public children: InlineSyntaxNode[], public level: number) { super(children) } OUTLINE_SYNTAX_NODE(): void { } }
Make heading constructor require level
Make heading constructor require level
TypeScript
mit
start/up,start/up
--- +++ @@ -4,7 +4,7 @@ export class HeadingNode extends InlineSyntaxNodeContainer implements OutlineSyntaxNode { - constructor(public children: InlineSyntaxNode[], public level?: number) { + constructor(public children: InlineSyntaxNode[], public level: number) { super(children) }