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
05e92d2080b5098e7eea0c1e136af75fd565c4d7
source/scripts/setup-plugins.ts
source/scripts/setup-plugins.ts
import * as child_process from "child_process" import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" if (process.env.NO_RECURSE) { process.exit(0) } const log = console.log const go = async () => { // Download settings const db = jsonDatabase(DATABASE_JSON_FILE) await db.setup() const installation = await db.getInstallation(0) if (!installation) { return } // Look for plugins if (installation.settings.plugins && installation.settings.plugins.length !== 0) { const plugins = installation.settings.plugins log("Installing: " + plugins.join(", ")) // This will call `yarn build` which will call this, so we // bypass that by providing no ENV - which means `DATABASE_JSON_FILE` // won't exist. const ls = child_process.spawn("yarn", ["add", ...plugins], { env: { ...process.env, NO_RECURSE: "YES" } }) ls.stdout.on("data", data => log(`-> : ${data}`)) ls.stderr.on("data", data => log(`! -> : ${data}`)) } else { log("Not adding any plugins") } } go()
import * as child_process from "child_process" import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" const log = console.log const go = async () => { // Download settings const db = jsonDatabase(DATABASE_JSON_FILE) await db.setup() const installation = await db.getInstallation(0) if (!installation) { return } // Look for plugins if (installation.settings.plugins && installation.settings.plugins.length !== 0) { const plugins = installation.settings.plugins log("Installing: " + plugins.join(", ")) const yarn = child_process.spawn("yarn", ["add", ...plugins, "--ignore-scripts"], { env: { ...process.env, NO_RECURSE: "YES" }, }) yarn.stdout.on("data", data => log(`-> : ${data}`)) yarn.stderr.on("data", data => log(`! -> : ${data}`)) yarn.on("close", code => { log(`child process exited with code ${code}`) }) } else { log("Not adding any plugins") } } go()
Make yarn not run build scripts
Make yarn not run build scripts
TypeScript
mit
danger/peril,danger/peril,danger/peril,danger/peril,danger/peril
--- +++ @@ -2,10 +2,6 @@ import jsonDatabase from "../db/json" import { DATABASE_JSON_FILE } from "../globals" - -if (process.env.NO_RECURSE) { - process.exit(0) -} const log = console.log @@ -23,13 +19,16 @@ const plugins = installation.settings.plugins log("Installing: " + plugins.join(", ")) - // This will call `yarn build` which will call this, so we - // bypass that by providing no ENV - which means `DATABASE_JSON_FILE` - // won't exist. - const ls = child_process.spawn("yarn", ["add", ...plugins], { env: { ...process.env, NO_RECURSE: "YES" } }) + const yarn = child_process.spawn("yarn", ["add", ...plugins, "--ignore-scripts"], { + env: { ...process.env, NO_RECURSE: "YES" }, + }) - ls.stdout.on("data", data => log(`-> : ${data}`)) - ls.stderr.on("data", data => log(`! -> : ${data}`)) + yarn.stdout.on("data", data => log(`-> : ${data}`)) + yarn.stderr.on("data", data => log(`! -> : ${data}`)) + + yarn.on("close", code => { + log(`child process exited with code ${code}`) + }) } else { log("Not adding any plugins") }
2bcb76339897101fcac845fb6c5b3c9507dbb0c7
jade/jade-tests.ts
jade/jade-tests.ts
/// <reference path="jade.d.ts"/> import jade = require('jade'); jade.compile("b")(); jade.compileFile("foo.jade", {})(); jade.compileClient("a")({ a: 1 }); jade.compileClientWithDependenciesTracked("test").body(); jade.render("h1",{}); jade.renderFile("foo.jade");
/// <reference path="jade.d.ts"/> import * as jade from 'jade'; jade.compile("b")(); jade.compileFile("foo.jade", {})(); jade.compileClient("a")({ a: 1 }); jade.compileClientWithDependenciesTracked("test").body(); jade.render("h1",{}); jade.renderFile("foo.jade");
Make use of es6 import
Make use of es6 import
TypeScript
mit
shlomiassaf/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,jimthedev/DefinitelyTyped,jraymakers/DefinitelyTyped,georgemarshall/DefinitelyTyped,schmuli/DefinitelyTyped,chbrown/DefinitelyTyped,Pro/DefinitelyTyped,damianog/DefinitelyTyped,benishouga/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,ryan10132/DefinitelyTyped,minodisk/DefinitelyTyped,alexdresko/DefinitelyTyped,alvarorahul/DefinitelyTyped,YousefED/DefinitelyTyped,musicist288/DefinitelyTyped,borisyankov/DefinitelyTyped,pocesar/DefinitelyTyped,esperco/DefinitelyTyped,zuzusik/DefinitelyTyped,nainslie/DefinitelyTyped,UzEE/DefinitelyTyped,donnut/DefinitelyTyped,schmuli/DefinitelyTyped,esperco/DefinitelyTyped,axelcostaspena/DefinitelyTyped,nitintutlani/DefinitelyTyped,HPFOD/DefinitelyTyped,trystanclarke/DefinitelyTyped,OpenMaths/DefinitelyTyped,Pro/DefinitelyTyped,paulmorphy/DefinitelyTyped,florentpoujol/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,scriby/DefinitelyTyped,mcliment/DefinitelyTyped,frogcjn/DefinitelyTyped,frogcjn/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,syuilo/DefinitelyTyped,RX14/DefinitelyTyped,ashwinr/DefinitelyTyped,mattblang/DefinitelyTyped,sledorze/DefinitelyTyped,Dominator008/DefinitelyTyped,bennett000/DefinitelyTyped,smrq/DefinitelyTyped,yuit/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,nfriend/DefinitelyTyped,emanuelhp/DefinitelyTyped,mcrawshaw/DefinitelyTyped,aciccarello/DefinitelyTyped,abbasmhd/DefinitelyTyped,benliddicott/DefinitelyTyped,glenndierckx/DefinitelyTyped,EnableSoftware/DefinitelyTyped,arma-gast/DefinitelyTyped,reppners/DefinitelyTyped,use-strict/DefinitelyTyped,arusakov/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,RX14/DefinitelyTyped,psnider/DefinitelyTyped,benishouga/DefinitelyTyped,martinduparc/DefinitelyTyped,philippstucki/DefinitelyTyped,Litee/DefinitelyTyped,isman-usoh/DefinitelyTyped,amanmahajan7/DefinitelyTyped,martinduparc/DefinitelyTyped,nobuoka/DefinitelyTyped,arusakov/DefinitelyTyped,wilfrem/DefinitelyTyped,sledorze/DefinitelyTyped,magny/DefinitelyTyped,Litee/DefinitelyTyped,johan-gorter/DefinitelyTyped,chrismbarr/DefinitelyTyped,tan9/DefinitelyTyped,gcastre/DefinitelyTyped,mareek/DefinitelyTyped,mhegazy/DefinitelyTyped,MugeSo/DefinitelyTyped,rschmukler/DefinitelyTyped,chrootsu/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,hellopao/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,nakakura/DefinitelyTyped,alextkachman/DefinitelyTyped,Zzzen/DefinitelyTyped,QuatroCode/DefinitelyTyped,benishouga/DefinitelyTyped,yuit/DefinitelyTyped,florentpoujol/DefinitelyTyped,arma-gast/DefinitelyTyped,donnut/DefinitelyTyped,shlomiassaf/DefinitelyTyped,applesaucers/lodash-invokeMap,MugeSo/DefinitelyTyped,syuilo/DefinitelyTyped,flyfishMT/DefinitelyTyped,stephenjelfs/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,greglo/DefinitelyTyped,psnider/DefinitelyTyped,arusakov/DefinitelyTyped,onecentlin/DefinitelyTyped,psnider/DefinitelyTyped,newclear/DefinitelyTyped,UzEE/DefinitelyTyped,jasonswearingen/DefinitelyTyped,ajtowf/DefinitelyTyped,EnableSoftware/DefinitelyTyped,mareek/DefinitelyTyped,dsebastien/DefinitelyTyped,martinduparc/DefinitelyTyped,Penryn/DefinitelyTyped,pocesar/DefinitelyTyped,damianog/DefinitelyTyped,ajtowf/DefinitelyTyped,chrootsu/DefinitelyTyped,paulmorphy/DefinitelyTyped,ashwinr/DefinitelyTyped,tan9/DefinitelyTyped,gandjustas/DefinitelyTyped,zuzusik/DefinitelyTyped,gandjustas/DefinitelyTyped,Zzzen/DefinitelyTyped,abbasmhd/DefinitelyTyped,stacktracejs/DefinitelyTyped,Dashlane/DefinitelyTyped,raijinsetsu/DefinitelyTyped,sclausen/DefinitelyTyped,mhegazy/DefinitelyTyped,flyfishMT/DefinitelyTyped,onecentlin/DefinitelyTyped,daptiv/DefinitelyTyped,pwelter34/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,zuzusik/DefinitelyTyped,rcchen/DefinitelyTyped,nycdotnet/DefinitelyTyped,progre/DefinitelyTyped,reppners/DefinitelyTyped,rcchen/DefinitelyTyped,AgentME/DefinitelyTyped,pocesar/DefinitelyTyped,danfma/DefinitelyTyped,philippstucki/DefinitelyTyped,OpenMaths/DefinitelyTyped,rolandzwaga/DefinitelyTyped,markogresak/DefinitelyTyped,jimthedev/DefinitelyTyped,schmuli/DefinitelyTyped,Dashlane/DefinitelyTyped,chrismbarr/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,subash-a/DefinitelyTyped,AgentME/DefinitelyTyped,alexdresko/DefinitelyTyped,aciccarello/DefinitelyTyped,minodisk/DefinitelyTyped,jasonswearingen/DefinitelyTyped,xStrom/DefinitelyTyped,glenndierckx/DefinitelyTyped,stephenjelfs/DefinitelyTyped,smrq/DefinitelyTyped,optical/DefinitelyTyped,use-strict/DefinitelyTyped,rolandzwaga/DefinitelyTyped,Ptival/DefinitelyTyped,applesaucers/lodash-invokeMap,hellopao/DefinitelyTyped,georgemarshall/DefinitelyTyped,behzad888/DefinitelyTyped,borisyankov/DefinitelyTyped,gyohk/DefinitelyTyped,magny/DefinitelyTyped,mcrawshaw/DefinitelyTyped,jraymakers/DefinitelyTyped,AgentME/DefinitelyTyped,amanmahajan7/DefinitelyTyped,micurs/DefinitelyTyped,abner/DefinitelyTyped,QuatroCode/DefinitelyTyped,dsebastien/DefinitelyTyped,jimthedev/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,progre/DefinitelyTyped,one-pieces/DefinitelyTyped,subash-a/DefinitelyTyped,danfma/DefinitelyTyped,johan-gorter/DefinitelyTyped,YousefED/DefinitelyTyped,optical/DefinitelyTyped,alvarorahul/DefinitelyTyped,vagarenko/DefinitelyTyped,nainslie/DefinitelyTyped,sclausen/DefinitelyTyped,emanuelhp/DefinitelyTyped,nycdotnet/DefinitelyTyped,AgentME/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,eugenpodaru/DefinitelyTyped,rschmukler/DefinitelyTyped,bennett000/DefinitelyTyped,stacktracejs/DefinitelyTyped,Penryn/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,newclear/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,wilfrem/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,vagarenko/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,Ptival/DefinitelyTyped,HPFOD/DefinitelyTyped,behzad888/DefinitelyTyped,mattblang/DefinitelyTyped,xStrom/DefinitelyTyped,trystanclarke/DefinitelyTyped,pwelter34/DefinitelyTyped,nitintutlani/DefinitelyTyped,nakakura/DefinitelyTyped,gyohk/DefinitelyTyped,amir-arad/DefinitelyTyped,Zorgatone/DefinitelyTyped,Dominator008/DefinitelyTyped,gcastre/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,scriby/DefinitelyTyped,aciccarello/DefinitelyTyped,georgemarshall/DefinitelyTyped,raijinsetsu/DefinitelyTyped,abner/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,greglo/DefinitelyTyped,georgemarshall/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,nobuoka/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,alextkachman/DefinitelyTyped,hellopao/DefinitelyTyped,isman-usoh/DefinitelyTyped,Zorgatone/DefinitelyTyped
--- +++ @@ -1,6 +1,6 @@ /// <reference path="jade.d.ts"/> -import jade = require('jade'); +import * as jade from 'jade'; jade.compile("b")(); jade.compileFile("foo.jade", {})();
3f88134dc331b319cecd4c4ddc2ab5c994563774
types/components/CollectionItem.d.ts
types/components/CollectionItem.d.ts
import * as React from 'react'; import { SharedBasic } from './utils'; export interface CollectionItemProps extends SharedBasic { active?: boolean; href: string; } /** * React Materialize: CollectionItem */ declare const CollectionItem: React.FC<CollectionItemProps> export default CollectionItem;
import * as React from 'react'; import { SharedBasic } from './utils'; export interface CollectionItemProps extends SharedBasic { active?: boolean; href?: string; } /** * React Materialize: CollectionItem */ declare const CollectionItem: React.FC<CollectionItemProps> export default CollectionItem;
Fix href requirement in CollectionItem's typings
Fix href requirement in CollectionItem's typings
TypeScript
mit
react-materialize/react-materialize,react-materialize/react-materialize,react-materialize/react-materialize
--- +++ @@ -3,7 +3,7 @@ export interface CollectionItemProps extends SharedBasic { active?: boolean; - href: string; + href?: string; } /**
b2cca406bb679fb21eb956a47eec883bc08b48de
src/app/projects/projects.module.ts
src/app/projects/projects.module.ts
import { NgModule, Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule, Routes, Route } from '@angular/router'; import { SharedModule } from '../shared/shared.module'; import { DisambiguationPageComponent } from './disambiguation-page/disambiguation-page.component'; import { environment } from '../../environments/environment.prod'; const sectionId = 3.0; const routes: Routes = [ { path: 'projects/code', loadChildren: '../code/code.module#CodeModule' }, { path: 'code', redirectTo: 'projects/code' } ]; if (environment.featureToggles.includes('newProjectStructure')) { routes.push(...[ { path: 'projects/recipes', loadChildren: '../recipes/recipes.module#RecipesModule' }, { path: 'projects', component: DisambiguationPageComponent, pathMatch: 'full', data: { sectionId: sectionId } } ]); } else { routes.push(...[ { path: 'projects', redirectTo: 'projects/code', pathMatch: 'full' } ]); } @NgModule({ imports: [ CommonModule, RouterModule.forChild(routes), SharedModule ], declarations: [DisambiguationPageComponent] }) export class ProjectsModule { }
import { NgModule, Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule, Routes, Route } from '@angular/router'; import { SharedModule } from '../shared/shared.module'; import { DisambiguationPageComponent } from './disambiguation-page/disambiguation-page.component'; import { environment } from '../../environments/environment.prod'; import { FEATURE_TOGGLES } from '../shared/feature-toggles'; const sectionId = 3.0; const routes: Routes = [ { path: 'projects/code', loadChildren: '../code/code.module#CodeModule' }, { path: 'code', redirectTo: 'projects/code' } ]; if (environment.featureToggles.includes(FEATURE_TOGGLES.improvedProjectOutline)) { routes.push(...[ { path: 'projects/recipes', loadChildren: '../recipes/recipes.module#RecipesModule' }, { path: 'projects', component: DisambiguationPageComponent, pathMatch: 'full', data: { sectionId: sectionId } } ]); } else { routes.push(...[ { path: 'projects', redirectTo: 'projects/code', pathMatch: 'full' } ]); } @NgModule({ imports: [ CommonModule, RouterModule.forChild(routes), SharedModule ], declarations: [DisambiguationPageComponent] }) export class ProjectsModule { }
Use constants instead of magic strings for feature toggles
Use constants instead of magic strings for feature toggles
TypeScript
apache-2.0
jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog
--- +++ @@ -6,6 +6,7 @@ import { DisambiguationPageComponent } from './disambiguation-page/disambiguation-page.component'; import { environment } from '../../environments/environment.prod'; +import { FEATURE_TOGGLES } from '../shared/feature-toggles'; const sectionId = 3.0; @@ -14,7 +15,7 @@ { path: 'code', redirectTo: 'projects/code' } ]; -if (environment.featureToggles.includes('newProjectStructure')) { +if (environment.featureToggles.includes(FEATURE_TOGGLES.improvedProjectOutline)) { routes.push(...[ { path: 'projects/recipes', loadChildren: '../recipes/recipes.module#RecipesModule' }, { path: 'projects', component: DisambiguationPageComponent, pathMatch: 'full', data: { sectionId: sectionId } }
3f9d4dbc3ed6a1a395763085b8393e58618fc0cc
game/hordetest/hud/src/components/HUD/ActiveObjectives/index.tsx
game/hordetest/hud/src/components/HUD/ActiveObjectives/index.tsx
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import React, { useContext } from 'react'; import { styled } from '@csegames/linaria/react'; import { ActiveObjectivesContext } from 'components/context/ActiveObjectivesContext'; import { ActiveObjective } from './ActiveObjective'; const Container = styled.div` display: flex; flex-direction: column; align-items: flex-end; `; export interface Props { } export interface State { } export function ActiveObjectives() { const activeObjectivesContext = useContext(ActiveObjectivesContext); function getColor(objective: ActiveObjective) { const objectiveColor = activeObjectivesContext.colorAssign[objective.entityState.entityID]; if (!objectiveColor) { // We should not get here. Choose unique color that stands out if we do. return 'pink'; } return objectiveColor.color; } return ( <Container> {activeObjectivesContext.activeObjectives.map((objective) => { return ( <ActiveObjective key={objective.entityState.entityID} activeObjective={objective} color={getColor(objective)} /> ); })} </Container> ); }
/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import React, { useContext } from 'react'; import { styled } from '@csegames/linaria/react'; import { ActiveObjectivesContext } from 'components/context/ActiveObjectivesContext'; import { ActiveObjective } from './ActiveObjective'; const Container = styled.div` display: flex; flex-direction: column; align-items: flex-end; `; export interface Props { } export interface State { } export function ActiveObjectives() { const activeObjectivesContext = useContext(ActiveObjectivesContext); function getColor(objective: ActiveObjective) { const objectiveColor = activeObjectivesContext.colorAssign[objective.entityState.entityID]; if (!objectiveColor) { // We should not get here. Choose unique color that stands out if we do. return 'pink'; } return objectiveColor.color; } const sortedObjectives = activeObjectivesContext.activeObjectives.sort((a, b) => a.entityState.entityID.localeCompare(b.entityState.entityID)); return ( <Container> {sortedObjectives.map((objective) => { return ( <ActiveObjective key={objective.entityState.entityID} activeObjective={objective} color={getColor(objective)} /> ); })} </Container> ); }
Sort objectives by entity id
Sort objectives by entity id
TypeScript
mpl-2.0
csegames/Camelot-Unchained,csegames/Camelot-Unchained,csegames/Camelot-Unchained
--- +++ @@ -35,9 +35,11 @@ return objectiveColor.color; } + const sortedObjectives = activeObjectivesContext.activeObjectives.sort((a, b) => + a.entityState.entityID.localeCompare(b.entityState.entityID)); return ( <Container> - {activeObjectivesContext.activeObjectives.map((objective) => { + {sortedObjectives.map((objective) => { return ( <ActiveObjective key={objective.entityState.entityID}
901618a3fc1563662277d40d00202bd906d69852
packages/components/containers/topBanners/WelcomeV4TopBanner.tsx
packages/components/containers/topBanners/WelcomeV4TopBanner.tsx
import React from 'react'; import { c } from 'ttag'; import { APPS, SSO_PATHS } from 'proton-shared/lib/constants'; import TopBanner from './TopBanner'; import { useConfig } from '../../hooks'; import { Href } from '../../components'; const IS_INITIAL_LOGIN = [SSO_PATHS.AUTHORIZE, SSO_PATHS.LOGIN, '/'].includes(window.location.pathname); const WelcomeV4TopBanner = () => { const { APP_NAME } = useConfig(); if (!IS_INITIAL_LOGIN || APP_NAME !== APPS.PROTONACCOUNT) { return null; } return ( <TopBanner className="bg-info"> <span className="mr0-5">{c('Message display when user visit v4 login first time') .t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}</span> <Href className="underline inline-block color-inherit" url="https://protonmail.com/blog/new-protonmail">{c( 'Link' ).t`Learn more`}</Href> </TopBanner> ); }; export default WelcomeV4TopBanner;
import React from 'react'; import { c } from 'ttag'; import { APPS, SSO_PATHS } from 'proton-shared/lib/constants'; import TopBanner from './TopBanner'; import { useConfig } from '../../hooks'; import { Href } from '../../components'; const IS_INITIAL_LOGIN = [SSO_PATHS.AUTHORIZE, SSO_PATHS.LOGIN, '/'].includes(window.location.pathname); const WelcomeV4TopBanner = () => { const { APP_NAME } = useConfig(); if (!IS_INITIAL_LOGIN || APP_NAME !== APPS.PROTONACCOUNT) { return null; } const learnMoreLink = ( <Href key="learn-more-link" className="underline inline-block color-inherit" url="https://protonmail.com/blog/new-protonmail" >{c('Link').t`learn more`}</Href> ); return ( <TopBanner className="bg-info"> {c('Message display when user visit v4 login first time') .jt`Welcome to the new ProtonMail design, modern and easy to use. Sign in to continue or ${learnMoreLink}.`} </TopBanner> ); }; export default WelcomeV4TopBanner;
Update copy for welcome banner
Update copy for welcome banner
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -15,13 +15,18 @@ return null; } + const learnMoreLink = ( + <Href + key="learn-more-link" + className="underline inline-block color-inherit" + url="https://protonmail.com/blog/new-protonmail" + >{c('Link').t`learn more`}</Href> + ); + return ( <TopBanner className="bg-info"> - <span className="mr0-5">{c('Message display when user visit v4 login first time') - .t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}</span> - <Href className="underline inline-block color-inherit" url="https://protonmail.com/blog/new-protonmail">{c( - 'Link' - ).t`Learn more`}</Href> + {c('Message display when user visit v4 login first time') + .jt`Welcome to the new ProtonMail design, modern and easy to use. Sign in to continue or ${learnMoreLink}.`} </TopBanner> ); };
b255e7e03825f043fc06b89f2778a362941d4eb4
src/extra/utils.ts
src/extra/utils.ts
import marked from 'marked'; import sanitizeHtml from 'sanitize-html'; const renderer = new marked.Renderer(); renderer.link = function(_href, _title, _text) { const link = marked.Renderer.prototype.link.apply(this, arguments); return link.replace('<a', '<a target="_blank" rel="noopener noreferrer"'); }; const markedOptions = { // Enable github flavored markdown gfm: true, breaks: true, headerIds: false, // Input text is sanitized using `sanitize-html` prior to being transformed by // `marked` sanitize: false, renderer, }; const sanitizerOptions = { allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'del', 'h1', 'h2', 'img', 'input', ]), allowedAttributes: { a: ['href', 'name', 'target', 'rel'], img: ['src'], input: [ { name: 'type', multiple: false, values: ['checkbox'], }, 'disabled', 'checked', ], span: ['class'], }, }; export const parseMarkdown = (text: string = '') => { const html = marked(text, markedOptions); const clean = sanitizeHtml(html, sanitizerOptions as any); return clean; };
import marked from 'marked'; import sanitizeHtml from 'sanitize-html'; const renderer = new marked.Renderer(); renderer.link = function(_href, _title, _text) { const link = marked.Renderer.prototype.link.apply(this, arguments); return link.replace('<a', '<a target="_blank" rel="noopener noreferrer"'); }; const markedOptions = { // Enable github flavored markdown gfm: true, breaks: true, headerIds: false, // Input text is sanitized using `sanitize-html` prior to being transformed by // `marked` sanitize: false, renderer, }; const sanitizerOptions = { allowedTags: sanitizeHtml.defaults.allowedTags.concat([ 'del', 'h1', 'h2', 'img', 'input', 'span', ]), allowedAttributes: { a: ['href', 'name', 'target', 'rel'], img: ['src'], input: [ { name: 'type', multiple: false, values: ['checkbox'], }, 'disabled', 'checked', ], span: ['class'], }, }; export const parseMarkdown = (text: string = '') => { const html = marked(text, markedOptions); const clean = sanitizeHtml(html, sanitizerOptions as any); return clean; };
Allow span tags to be preserved
Markdown: Allow span tags to be preserved Change-type: patch Signed-off-by: Lucian <[email protected]>
TypeScript
mit
resin-io-modules/resin-components,resin-io-modules/resin-components,resin-io-modules/resin-components
--- +++ @@ -26,6 +26,7 @@ 'h2', 'img', 'input', + 'span', ]), allowedAttributes: { a: ['href', 'name', 'target', 'rel'],
5a7077facb2fe79f4f06ad0187ebf87f4687462d
src/utils/templates.ts
src/utils/templates.ts
import * as vsc from 'vscode' import * as glob from 'glob' import { IPostfixTemplate } from '../template' import { CustomTemplate } from '../templates/customTemplate' export const loadCustomTemplates = () => { const config = vsc.workspace.getConfiguration('postfix') const templates = config.get<ICustomTemplateDefinition[]>('customTemplates') if (templates) { return templates.map(t => new CustomTemplate(t.name, t.description, t.body, t.when)) } } export const loadBuiltinTemplates = () => { const templates: IPostfixTemplate[] = [] let files = glob.sync('./templates/*.js', { cwd: __dirname }) files.forEach(path => { let builder: () => IPostfixTemplate | IPostfixTemplate[] = require(path).build if (builder) { let tpls = builder() if (Array.isArray(tpls)) { templates.push(...tpls) } else { templates.push(tpls) } } }) return templates } interface ICustomTemplateDefinition { name: string description: string body: string, when: string[] }
import * as vsc from 'vscode' import * as glob from 'glob' import { IPostfixTemplate } from '../template' import { CustomTemplate } from '../templates/customTemplate' export const loadCustomTemplates = () => { const config = vsc.workspace.getConfiguration('postfix') const templates = config.get<ICustomTemplateDefinition[]>('customTemplates') if (templates) { return templates.map(t => new CustomTemplate(t.name, t.description, t.body, t.when)) } } export const loadBuiltinTemplates = () => { const templates: IPostfixTemplate[] = [] let files = glob.sync('../templates/*.js', { cwd: __dirname }) files.forEach(path => { let builder: () => IPostfixTemplate | IPostfixTemplate[] = require(path).build if (builder) { let tpls = builder() if (Array.isArray(tpls)) { templates.push(...tpls) } else { templates.push(tpls) } } }) return templates } interface ICustomTemplateDefinition { name: string description: string body: string, when: string[] }
Fix bug after moving utils around
Fix bug after moving utils around
TypeScript
mit
ipatalas/vscode-postfix-ts,ipatalas/vscode-postfix-ts
--- +++ @@ -14,7 +14,7 @@ export const loadBuiltinTemplates = () => { const templates: IPostfixTemplate[] = [] - let files = glob.sync('./templates/*.js', { cwd: __dirname }) + let files = glob.sync('../templates/*.js', { cwd: __dirname }) files.forEach(path => { let builder: () => IPostfixTemplate | IPostfixTemplate[] = require(path).build
262307550979bcdd5b5e78615498497aa4f6c852
src/vmware/provider.ts
src/vmware/provider.ts
import { pick } from '@waldur/core/utils'; import * as ProvidersRegistry from '@waldur/providers/registry'; import { VMwareForm } from './VMwareForm'; const serializer = pick([ 'username', 'password', ]); ProvidersRegistry.register({ name: 'VMware', type: 'VMware', icon: 'icon-vmware.png', endpoint: 'vmware', component: VMwareForm, serializer, });
import { pick } from '@waldur/core/utils'; import * as ProvidersRegistry from '@waldur/providers/registry'; import { VMwareForm } from './VMwareForm'; const serializer = pick([ 'backend_url', 'username', 'password', 'default_cluster_label', 'max_cpu', 'max_ram', 'max_disk', 'max_disk_total', ]); ProvidersRegistry.register({ name: 'VMware', type: 'VMware', icon: 'icon-vmware.png', endpoint: 'vmware', component: VMwareForm, serializer, });
Allow to update limits and credentials for VMware service settings
Allow to update limits and credentials for VMware service settings [WAL-2796]
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -4,8 +4,14 @@ import { VMwareForm } from './VMwareForm'; const serializer = pick([ + 'backend_url', 'username', 'password', + 'default_cluster_label', + 'max_cpu', + 'max_ram', + 'max_disk', + 'max_disk_total', ]); ProvidersRegistry.register({
f2605cb814c11dbf2fa006c890b509e1052e975f
app/src/component/TaskDescription.tsx
app/src/component/TaskDescription.tsx
import * as React from "react"; import Markdown = require("react-markdown"); import InputComponent from "./InputComponent"; import "./style/TaskDescription.css"; export default class extends InputComponent { public render() { if (this.state.editing) { return ( <textarea className="TaskDescription-input" onKeyDown={(event: React.KeyboardEvent<{}>) => { if (event.keyCode === 83 && event.ctrlKey || event.keyCode === 13 && event.shiftKey) { this.setState({ editing: false }); event.preventDefault(); } }} {...{ ...this.getFormProps() }} /> ); } const { text } = this.props; return ( <div onClick={() => this.setState({ editing: true })}> {text.trim() ? <Markdown className="TaskDescription-markdown" source={text} /> : <div className="TaskDescription-message">No description</div>} </div> ); } }
import * as React from "react"; import Markdown = require("react-markdown"); import InputComponent from "./InputComponent"; import "./style/TaskDescription.css"; export default class extends InputComponent { public render() { if (this.state.editing) { return ( <textarea className="TaskDescription-input" onKeyDown={(event: React.KeyboardEvent<{}>) => { if (event.keyCode === 83 && event.ctrlKey || event.keyCode === 13 && event.shiftKey) { this.setState({ editing: false }); event.preventDefault(); } }} {...{ ...this.getFormProps() }} /> ); } const { text } = this.props; return ( <div onClick={() => this.setState({ editing: true })}> {text.trim() ? ( <Markdown className="TaskDescription-markdown" source={text} renderers={{ Link: ({ href, title, children }) => <a href={href} target="_blank" onClick={(event) => event.stopPropagation()} > {children} </a>, }} /> ) : <div className="TaskDescription-message">No description</div>} </div> ); } }
Fix anchor tag behavior in task descriptions
Fix anchor tag behavior in task descriptions
TypeScript
mit
raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d
--- +++ @@ -27,7 +27,22 @@ return ( <div onClick={() => this.setState({ editing: true })}> {text.trim() - ? <Markdown className="TaskDescription-markdown" source={text} /> + ? ( + <Markdown + className="TaskDescription-markdown" + source={text} + renderers={{ + Link: ({ href, title, children }) => + <a + href={href} + target="_blank" + onClick={(event) => event.stopPropagation()} + > + {children} + </a>, + }} + /> + ) : <div className="TaskDescription-message">No description</div>} </div> );
b11d615eb662f32e16e5129eac423d9ff18ea1bb
src/load.ts
src/load.ts
import { join } from 'path'; import Config, { Middleware } from './Config'; import ConfigLoader from './ConfigLoader'; import SecureMiddleware from './middleware/SecureMiddleware'; let middleware: Middleware | undefined; if (process.env.NODE_CONFIG_PRIVATE_KEY) { middleware = new SecureMiddleware(process.env.NODE_CONFIG_PRIVATE_KEY); } const configDir = process.env.NODE_CONFIG_DIR as string || join(process.cwd(), 'config'); const files = ['default', process.env.NODE_ENV].filter(x => x); const loader = new ConfigLoader(configDir); const config = Config.generate(loader.loadSync(files), middleware); export default config;
import { join } from 'path'; import Config, { Middleware } from './Config'; import ConfigLoader from './ConfigLoader'; import SecureMiddleware from './middleware/SecureMiddleware'; let middleware: Middleware | undefined; if (process.env.NODE_CONFIG_PRIVATE_KEY) { const privateKey = new Buffer(process.env.NODE_CONFIG_PRIVATE_KEY, 'base64'); middleware = new SecureMiddleware(privateKey.toString('utf8')); } const configDir = process.env.NODE_CONFIG_DIR as string || join(process.cwd(), 'config'); const files = ['default', process.env.NODE_ENV].filter(x => x); const loader = new ConfigLoader(configDir); const config = Config.generate(loader.loadSync(files), middleware); export default config;
Change NODE_CONFIG_PRIVATE_KEY to set Base64 string
Change NODE_CONFIG_PRIVATE_KEY to set Base64 string
TypeScript
mit
kou64yama/nobushi-config
--- +++ @@ -5,7 +5,8 @@ let middleware: Middleware | undefined; if (process.env.NODE_CONFIG_PRIVATE_KEY) { - middleware = new SecureMiddleware(process.env.NODE_CONFIG_PRIVATE_KEY); + const privateKey = new Buffer(process.env.NODE_CONFIG_PRIVATE_KEY, 'base64'); + middleware = new SecureMiddleware(privateKey.toString('utf8')); } const configDir = process.env.NODE_CONFIG_DIR as string || join(process.cwd(), 'config');
6d5f134266ff267f2d090691b02953d8e3822f95
src/app/core/images/imagestore/image-converter.ts
src/app/core/images/imagestore/image-converter.ts
import {Injectable} from '@angular/core'; const nativeImage = typeof window !== 'undefined' ? window.require('electron').nativeImage : require('electron').nativeImage; const Jimp = typeof window !== 'undefined' ? window.require('jimp') : require('jimp'); @Injectable() /** * @author F.Z. * @author Daniel de Oliveira * @author Thomas Kleinke */ export class ImageConverter { public async convert(data: any): Promise<Buffer> { const buffer: Buffer = Buffer.from(data); const image = this.convertWithElectron(buffer); if (!image.isEmpty()) { return image.toJPEG(60); } else { try { return await this.convertWithJimp(buffer); } catch (err) { console.error('Failed to convert image using jimp:', err); return undefined; } } } private convertWithElectron(buffer: Buffer) { return nativeImage.createFromBuffer(buffer) .resize({ height: 320 }); } private async convertWithJimp(buffer: Buffer) { const image = await Jimp.read(buffer); return image.resize(Jimp.AUTO, 320) .quality(60) .getBufferAsync(Jimp.MIME_JPEG); } }
import {Injectable} from '@angular/core'; const nativeImage = typeof window !== 'undefined' ? window.require('electron').nativeImage : require('electron').nativeImage; const Jimp = typeof window !== 'undefined' ? window.require('jimp') : require('jimp'); const TARGET_HEIGHT = 320; const TARGET_JPEG_QUALITY = 60; @Injectable() /** * @author F.Z. * @author Daniel de Oliveira * @author Thomas Kleinke */ export class ImageConverter { public async convert(data: any): Promise<Buffer> { const buffer: Buffer = Buffer.from(data); const image = this.convertWithElectron(buffer); if (!image.isEmpty()) { return image.toJPEG(TARGET_JPEG_QUALITY); } else { try { return await this.convertWithJimp(buffer); } catch (err) { console.error('Failed to convert image using jimp:', err); return undefined; } } } private convertWithElectron(buffer: Buffer) { return nativeImage.createFromBuffer(buffer) .resize({ height: TARGET_HEIGHT }); } private async convertWithJimp(buffer: Buffer) { const image = await Jimp.read(buffer); return image.resize(Jimp.AUTO, TARGET_HEIGHT) .quality(TARGET_JPEG_QUALITY) .getBufferAsync(Jimp.MIME_JPEG); } }
Use constants for conversion target values
Use constants for conversion target values
TypeScript
apache-2.0
codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client
--- +++ @@ -4,6 +4,10 @@ ? window.require('electron').nativeImage : require('electron').nativeImage; const Jimp = typeof window !== 'undefined' ? window.require('jimp') : require('jimp'); + + +const TARGET_HEIGHT = 320; +const TARGET_JPEG_QUALITY = 60; @Injectable() @@ -20,7 +24,7 @@ const image = this.convertWithElectron(buffer); if (!image.isEmpty()) { - return image.toJPEG(60); + return image.toJPEG(TARGET_JPEG_QUALITY); } else { try { return await this.convertWithJimp(buffer); @@ -35,7 +39,7 @@ private convertWithElectron(buffer: Buffer) { return nativeImage.createFromBuffer(buffer) - .resize({ height: 320 }); + .resize({ height: TARGET_HEIGHT }); } @@ -43,8 +47,8 @@ const image = await Jimp.read(buffer); - return image.resize(Jimp.AUTO, 320) - .quality(60) + return image.resize(Jimp.AUTO, TARGET_HEIGHT) + .quality(TARGET_JPEG_QUALITY) .getBufferAsync(Jimp.MIME_JPEG); } }
1c5a0b68f7d0f3ac3272142d5a37dc383834a08d
client/components/paper/paper.service.ts
client/components/paper/paper.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import { Subject } from '../../sharedClasses/subject' import { Question } from '../../sharedClasses/question'; @Injectable() export class PaperService { constructor(private _http: Http) { } getQuestions(subjectID, time): Promise<Question[]> { let api_url = 'questions/getQuestionIdTime/' + subjectID + '/' + time; return this._http.get(api_url) .toPromise() .then(response => response.json().questions as Question[]) .catch(this.handleError) } calculateTotalTime(questionArray): number { return } private handleError(error: any): Promise<any> { console.error('An error occurred', error); // for demo purposes only return Promise.reject(error.message || error); } }
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import 'rxjs/add/operator/toPromise'; import { Subject } from '../../sharedClasses/subject' import { Question } from '../../sharedClasses/question'; @Injectable() export class PaperService { constructor(private _http: Http) { } getQuestions(subjectID, time): Promise<Question[]> { let api_url = 'questions/getQuestionIdTime/' + subjectID + '/' + time; return this._http.get(api_url) .toPromise() .then(response => response.json().questions as Question[]) .catch(this.handleError) } calculateTotalTime(questionArray: Question[]): number { let totalTime = 0; for(let question of questionArray) { totalTime += question.question_time; } return totalTime; } private handleError(error: any): Promise<any> { console.error('An error occurred', error); // for demo purposes only return Promise.reject(error.message || error); } }
Add implementation for calculating total time for quiz
Add implementation for calculating total time for quiz
TypeScript
mit
shavindraSN/examen,shavindraSN/examen,shavindraSN/examen
--- +++ @@ -20,8 +20,12 @@ .catch(this.handleError) } - calculateTotalTime(questionArray): number { - return + calculateTotalTime(questionArray: Question[]): number { + let totalTime = 0; + for(let question of questionArray) { + totalTime += question.question_time; + } + return totalTime; } private handleError(error: any): Promise<any> {
09e65fc25e2ff9a5dac6df1d2b0670027752c942
test/unittests/front_end/test_setup/test_setup.ts
test/unittests/front_end/test_setup/test_setup.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. /* * This file is automatically loaded and run by Karma because it automatically * loads and injects all *.js files it finds. */ import type * as Common from '../../../../front_end/core/common/common.js'; import * as ThemeSupport from '../../../../front_end/ui/legacy/theme_support/theme_support.js'; import {resetTestDOM} from '../helpers/DOMHelpers.js'; beforeEach(resetTestDOM); before(async function() { /* Larger than normal timeout because we've seen some slowness on the bots */ this.timeout(10000); }); beforeEach(() => { // Some unit tests exercise code that assumes a ThemeSupport instance is available. // Run this in a beforeEach in case an individual test overrides it. const setting = { get() { return 'default'; }, } as Common.Settings.Setting<string>; ThemeSupport.ThemeSupport.instance({forceNew: true, setting}); });
// 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. /* * This file is automatically loaded and run by Karma because it automatically * loads and injects all *.js files it finds. */ import type * as Common from '../../../../front_end/core/common/common.js'; import * as ThemeSupport from '../../../../front_end/ui/legacy/theme_support/theme_support.js'; import {resetTestDOM} from '../helpers/DOMHelpers.js'; beforeEach(resetTestDOM); before(async function() { /* Larger than normal timeout because we've seen some slowness on the bots */ this.timeout(10000); }); afterEach(() => { // Clear out any Sinon stubs or spies between individual tests. sinon.restore(); }); beforeEach(() => { // Some unit tests exercise code that assumes a ThemeSupport instance is available. // Run this in a beforeEach in case an individual test overrides it. const setting = { get() { return 'default'; }, } as Common.Settings.Setting<string>; ThemeSupport.ThemeSupport.instance({forceNew: true, setting}); });
Clear sinon stubs between each unit test
Clear sinon stubs between each unit test Consider the following unit tests: ``` describe.only('jack test', () => { const someObj = { foo() { return 2; }, }; it('does a thing', () => { const stub = sinon.stub(someObj, 'foo').callsFake(() => { return 5; }) assert.strictEqual(someObj.foo(), 5); // this test PASSES }); it('does another thing', () => { assert.strictEqual(someObj.foo(), 2); // this test FAILS }); }); ``` The second test fails in our setup because the stub, although it was created in the first unit test, survives between tests. To fix this we can call `sinon.restore()`, which ensures that any stubbed methods get cleaned between runs, and ensures that in the above test cases both tests pass. `test_setup.ts` is run automatically between each test, so by adding it to the `afterEach` we ensure each test starts with a clean slate as far as sinon is concerned. Fixed: 1275936 Change-Id: Ic218027979b7d5b323d297d90891d741f61d5d88 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3313069 Auto-Submit: Jack Franklin <[email protected]> Commit-Queue: Johan Bay <[email protected]> Reviewed-by: Johan Bay <[email protected]>
TypeScript
bsd-3-clause
ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend
--- +++ @@ -17,6 +17,11 @@ this.timeout(10000); }); +afterEach(() => { + // Clear out any Sinon stubs or spies between individual tests. + sinon.restore(); +}); + beforeEach(() => { // Some unit tests exercise code that assumes a ThemeSupport instance is available. // Run this in a beforeEach in case an individual test overrides it.
37442b92aed4395e76fdce30580c6cf519fe7fd0
src/utils/units.ts
src/utils/units.ts
/* Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Simple utils for formatting style values */ // converts a pixel value to rem. export function toRem(pixelValue: number): string { return pixelValue / 15 + "rem"; } export function toPx(pixelValue: number): string { return pixelValue + "px"; }
/* Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Simple utils for formatting style values */ // converts a pixel value to rem. export function toRem(pixelValue: number): string { return pixelValue / 10 + "rem"; } export function toPx(pixelValue: number): string { return pixelValue + "px"; }
Update read receipt remainder for internal font size change
Update read receipt remainder for internal font size change In https://github.com/matrix-org/matrix-react-sdk/pull/4725, we changed the internal font size from 15 to 10, but the `toRem` function (currently only used for read receipts remainders curiously) was not updated. This updates the function, which restores the remainders. Fixes https://github.com/vector-im/riot-web/issues/14127
TypeScript
apache-2.0
matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk,matrix-org/matrix-react-sdk
--- +++ @@ -19,7 +19,7 @@ // converts a pixel value to rem. export function toRem(pixelValue: number): string { - return pixelValue / 15 + "rem"; + return pixelValue / 10 + "rem"; } export function toPx(pixelValue: number): string {
36ff413878bfed46aad013a62a102df981a7c10b
packages/components/containers/login/AbuseModal.tsx
packages/components/containers/login/AbuseModal.tsx
import { c } from 'ttag'; import { AlertModal, Button, Href } from '../../components'; interface Props { message?: string; open: boolean; onClose: () => void; } const AbuseModal = ({ message, open, onClose }: Props) => { const contactLink = ( <Href url="https://protonmail.com/abuse" key={1}> {c('Info').t`here`} </Href> ); return ( <AlertModal open={open} title={c('Title').t`Account suspended`} onClose={onClose} buttons={<Button onClick={onClose}>{c('Action').t`I understand`}</Button>} > {message || ( <> <div className="mb1">{c('Info') .t`This account has been suspended due to a potential policy violation.`}</div> <div>{c('Info').jt`If you believe this is in error, please contact us ${contactLink}.`}</div> </> )} </AlertModal> ); }; export default AbuseModal;
import { c } from 'ttag'; import { AlertModal, Button, Href } from '../../components'; interface Props { message?: string; open: boolean; onClose: () => void; } const AbuseModal = ({ message, open, onClose }: Props) => { const contactLink = ( <Href url="https://protonmail.com/abuse" key={1}> {c('Info').t`here`} </Href> ); return ( <AlertModal open={open} title={c('Title').t`Account suspended`} onClose={onClose} buttons={<Button onClick={onClose}>{c('Action').t`Close`}</Button>} > {message || ( <> <div className="mb1">{c('Info') .t`This account has been suspended due to a potential policy violation.`}</div> <div>{c('Info').jt`If you believe this is in error, please contact us ${contactLink}.`}</div> </> )} </AlertModal> ); }; export default AbuseModal;
Fix abuse modal close text
Fix abuse modal close text
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -19,7 +19,7 @@ open={open} title={c('Title').t`Account suspended`} onClose={onClose} - buttons={<Button onClick={onClose}>{c('Action').t`I understand`}</Button>} + buttons={<Button onClick={onClose}>{c('Action').t`Close`}</Button>} > {message || ( <>
c6ad36326a792b1c41f531f2b83fa438d2dc98de
src/components/publishing/embed.tsx
src/components/publishing/embed.tsx
import * as React from "react" import styled, { StyledFunction } from "styled-components" interface EmbedProps { section: any } const Embed: React.SFC<EmbedProps> = props => { const { url, height, mobile_height } = props.section return <IFrame src={url} scrolling="no" frameBorder="0" height={height} mobileHeight={mobile_height} /> } interface FrameProps extends React.HTMLProps<HTMLIFrameElement> { mobileHeight?: number height: number } const iframe: StyledFunction<FrameProps & React.HTMLProps<HTMLIFrameElement>> = styled.iframe const IFrame = iframe` width: 100%; height: ${props => props.height + "px"}; @media (max-width: 600px) { height: ${props => props.mobileHeight + "px"}; } ` export default Embed
import * as React from "react" import styled, { StyledFunction } from "styled-components" import { pMedia } from "../helpers" interface EmbedProps { section: any } const Embed: React.SFC<EmbedProps> = props => { const { url, height, mobile_height } = props.section return <IFrame src={url} scrolling="no" frameBorder="0" height={height} mobileHeight={mobile_height} /> } interface FrameProps extends React.HTMLProps<HTMLIFrameElement> { mobileHeight?: number height: number } const iframe: StyledFunction<FrameProps> = styled.iframe const IFrame = iframe` width: 100%; height: ${props => props.height + "px"}; ${props => pMedia.sm` height: ${props.mobileHeight}px; `} ` export default Embed
Fix query and remove duplicate prop
Fix query and remove duplicate prop
TypeScript
mit
artsy/reaction,artsy/reaction-force,xtina-starr/reaction,xtina-starr/reaction,xtina-starr/reaction,craigspaeth/reaction,craigspaeth/reaction,artsy/reaction,artsy/reaction,artsy/reaction-force,craigspaeth/reaction,xtina-starr/reaction
--- +++ @@ -1,5 +1,6 @@ import * as React from "react" import styled, { StyledFunction } from "styled-components" +import { pMedia } from "../helpers" interface EmbedProps { section: any @@ -15,14 +16,14 @@ height: number } -const iframe: StyledFunction<FrameProps & React.HTMLProps<HTMLIFrameElement>> = styled.iframe +const iframe: StyledFunction<FrameProps> = styled.iframe const IFrame = iframe` width: 100%; height: ${props => props.height + "px"}; - @media (max-width: 600px) { - height: ${props => props.mobileHeight + "px"}; - } + ${props => pMedia.sm` + height: ${props.mobileHeight}px; + `} ` export default Embed
a4edaaeec0f09d6ebf22c5bf60b5cb69be09f700
tests/runners/fourslash/fsrunner.ts
tests/runners/fourslash/fsrunner.ts
///<reference path='..\..\..\src\harness\fourslash.ts' /> ///<reference path='..\runnerbase.ts' /> class FourslashRunner extends RunnerBase { public runTests() { var runSingleFourslashTest = (fn: string) => { var justName = fn.replace(/^.*[\\\/]/, ''); if (!justName.match(/fourslash.ts$/i)) { describe('FourSlash test ' + justName, function () { it('Runs correctly', function () { FourSlash.runFourSlashTest(fn); }); }); } } //runSingleFourslashTest(Harness.userSpecifiedroot + 'tests/cases/fourslash/comments_Interface.ts'); this.enumerateFiles('tests/cases/fourslash').forEach(runSingleFourslashTest); } }
///<reference path='..\..\..\src\harness\fourslash.ts' /> ///<reference path='..\runnerbase.ts' /> class FourslashRunner extends RunnerBase { public runTests() { var runSingleFourslashTest = (fn: string) => { var justName = fn.replace(/^.*[\\\/]/, ''); if (!justName.match(/fourslash.ts$/i)) { describe('FourSlash test ' + justName, function () { it('Runs correctly', function () { FourSlash.runFourSlashTest(fn); }); }); } } if (this.tests.length === 0) { this.tests = this.enumerateFiles('tests/cases/fourslash'); } this.tests.forEach(runSingleFourslashTest); } }
Add the option to run a single Fourslash test.
Add the option to run a single Fourslash test.
TypeScript
apache-2.0
mbebenita/shumway.ts,hippich/typescript,fdecampredon/jsx-typescript-old-version,tarruda/typescript,fdecampredon/jsx-typescript-old-version,rbirkby/typescript,popravich/typescript,mbebenita/shumway.ts,tarruda/typescript,guidobouman/typescript,hippich/typescript,vcsjones/typescript,guidobouman/typescript,mbebenita/shumway.ts,tarruda/typescript,rbirkby/typescript,fdecampredon/jsx-typescript-old-version,guidobouman/typescript,popravich/typescript,rbirkby/typescript,mbrowne/typescript-dci,mbrowne/typescript-dci,popravich/typescript,mbrowne/typescript-dci,hippich/typescript,mbrowne/typescript-dci
--- +++ @@ -17,8 +17,11 @@ } } - //runSingleFourslashTest(Harness.userSpecifiedroot + 'tests/cases/fourslash/comments_Interface.ts'); - this.enumerateFiles('tests/cases/fourslash').forEach(runSingleFourslashTest); + if (this.tests.length === 0) { + this.tests = this.enumerateFiles('tests/cases/fourslash'); + } + + this.tests.forEach(runSingleFourslashTest); } }
2ae5a4da84806649dec272732ea635bfbbb87e4f
src/newtab/components/App/styles.ts
src/newtab/components/App/styles.ts
import styled from 'styled-components'; import images from '../../../shared/mixins/images'; import typography from '../../../shared/mixins/typography'; import opacity from '../../../shared/defaults/opacity'; export const StyledApp = styled.div` width: 100%; height: 100vh; `; export interface ContentProps { visible: boolean; } export const Content = styled.div` display: flex; justify-content: center; flex-flow: row; position: relative; padding-top: 24px; background-color: #f5f5f5; flex-wrap: wrap; opacity: ${({ visible }: ContentProps) => (visible ? 1 : 0)}; `; export const CardsContainer = styled.div` & .weather-card { position: sticky; top: 24px; } `; export const Credits = styled.div` position: fixed; bottom: 8px; left: 8px; font-size: 12px; color: rgba(0, 0, 0, ${opacity.light.secondaryText}); `; export const Column = styled.div` display: flex; flex-flow: column; margin-right: 32px; align-items: flex-start; &:last-child { margin-right: 0px; } `;
import styled from 'styled-components'; import images from '../../../shared/mixins/images'; import typography from '../../../shared/mixins/typography'; import opacity from '../../../shared/defaults/opacity'; export const StyledApp = styled.div` width: 100%; height: 100vh; `; export interface ContentProps { visible: boolean; } export const Content = styled.div` display: flex; justify-content: center; flex-flow: row; position: relative; padding-top: 24px; padding-bottom: 24px; background-color: #f5f5f5; flex-wrap: wrap; opacity: ${({ visible }: ContentProps) => (visible ? 1 : 0)}; `; export const CardsContainer = styled.div` & .weather-card { position: sticky; top: 24px; } `; export const Credits = styled.div` width: 100%; height: 24px; display: flex; align-items: center; position: fixed; bottom: 0px; left: 8px; font-size: 12px; color: rgba(0, 0, 0, ${opacity.light.secondaryText}); background-color: #f5f5f5; & a { transition: 0.2s color; } & a:hover { color: rgba(0, 0, 0, ${opacity.light.primaryText}); } `; export const Column = styled.div` display: flex; flex-flow: column; margin-right: 32px; align-items: flex-start; &:last-child { margin-right: 0px; } `;
Fix credits in new tab
:bugs: Fix credits in new tab
TypeScript
apache-2.0
Nersent/Wexond,Nersent/Wexond
--- +++ @@ -19,6 +19,7 @@ flex-flow: row; position: relative; padding-top: 24px; + padding-bottom: 24px; background-color: #f5f5f5; flex-wrap: wrap; @@ -33,12 +34,24 @@ `; export const Credits = styled.div` + width: 100%; + height: 24px; + display: flex; + align-items: center; position: fixed; - bottom: 8px; + bottom: 0px; left: 8px; font-size: 12px; + color: rgba(0, 0, 0, ${opacity.light.secondaryText}); + background-color: #f5f5f5; - color: rgba(0, 0, 0, ${opacity.light.secondaryText}); + & a { + transition: 0.2s color; + } + + & a:hover { + color: rgba(0, 0, 0, ${opacity.light.primaryText}); + } `; export const Column = styled.div`
f315130d67ee02f50dd9ad56e1c4b314e3d85639
postponed/firestore-mirror-bigquery/functions/src/firestoreEventHistoryTracker.ts
postponed/firestore-mirror-bigquery/functions/src/firestoreEventHistoryTracker.ts
/* * Copyright 2019 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. */ export enum ChangeType { CREATE, DELETE, UPDATED } export class FirestoreDocumentChangeEvent { constructor( public timestamp: string, public operation: ChangeType, public name: string, public eventId: string, public data: Object ); } export interface FirestoreEventHistoryTracker { record(event: FirestoreDocumentChangeEvent); }
/* * Copyright 2019 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. */ export enum ChangeType { CREATE, DELETE, UPDATED } export interface FirestoreDocumentChangeEvent { timestamp: string; operation: ChangeType; name: string; eventId: string; data: Object; } export interface FirestoreEventHistoryTracker { record(event: FirestoreDocumentChangeEvent); }
Change FirestoreDocumentChangeEvent to an interface
Change FirestoreDocumentChangeEvent to an interface
TypeScript
apache-2.0
firebase/extensions,firebase/extensions,firebase/extensions,firebase/extensions,firebase/extensions
--- +++ @@ -20,14 +20,12 @@ UPDATED } -export class FirestoreDocumentChangeEvent { - constructor( - public timestamp: string, - public operation: ChangeType, - public name: string, - public eventId: string, - public data: Object - ); +export interface FirestoreDocumentChangeEvent { + timestamp: string; + operation: ChangeType; + name: string; + eventId: string; + data: Object; } export interface FirestoreEventHistoryTracker {
8f33c6fee6799abc36fd5084adddf983a569f56c
server/src/actions/proxy.ts
server/src/actions/proxy.ts
import axios from 'axios'; import { Request, Response } from 'express'; interface ProxyRequest { body: string; headers: { [name: string]: string }; method: string; url: string; } export function proxy(req: Request, res: Response) { const content = req.body as ProxyRequest; const request = { method: content.method, data: content.body, headers: content.headers, url: content.url }; axios.request(request) .then(r => res.send(r.data)) .catch(e => { if (e.response && e.response.status) { res.status(e.response.status).send(e.response); } else if (e.request) { res.status(400).send({ reason: 'PassThrough', error: 'request error' }); } else { res.status(400).send({ reason: 'PassThrough', error: e.code }); } }); }
import axios from 'axios'; import { Request, Response } from 'express'; interface ProxyRequest { body: string; headers: { [name: string]: string }; method: string; url: string; } export function proxy(req: Request, res: Response) { const content = req.body as ProxyRequest; const request = { method: content.method, data: content.body, headers: content.headers, url: content.url }; axios.request(request) .then(r => res.send(r.data)) .catch(e => { if (e.response && e.response.status) { res.status(e.response.status).send(e.response.data); } else if (e.request) { res.status(400).send({ reason: 'PassThrough', error: 'request error' }); } else { res.status(400).send({ reason: 'PassThrough', error: e.code }); } }); }
Return data on error from the server
Return data on error from the server
TypeScript
apache-2.0
projectkudu/AzureFunctions,projectkudu/AzureFunctions,projectkudu/AzureFunctions,projectkudu/WebJobsPortal,projectkudu/WebJobsPortal,projectkudu/WebJobsPortal,projectkudu/AzureFunctions,projectkudu/WebJobsPortal
--- +++ @@ -20,7 +20,7 @@ .then(r => res.send(r.data)) .catch(e => { if (e.response && e.response.status) { - res.status(e.response.status).send(e.response); + res.status(e.response.status).send(e.response.data); } else if (e.request) { res.status(400).send({ reason: 'PassThrough',
e33a1cd26c593b58046b73d61bb8abcd9c299289
src/renderer/script/settings/settings.ts
src/renderer/script/settings/settings.ts
// Copyright 2016 underdolphin(masato sueda) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /// <reference path="../../../typings/index.d.ts" /> Polymer({ is: "settings-element" });
// Copyright 2016 underdolphin(masato sueda) // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /// <reference path="../../../../typings/index.d.ts" /> Polymer({ is: "settings-element" });
Fix reference path of typings
Fix reference path of typings
TypeScript
apache-2.0
underdolphin/SoundRebuild,underdolphin/SoundRebuild,underdolphin/SoundRebuild
--- +++ @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -/// <reference path="../../../typings/index.d.ts" /> +/// <reference path="../../../../typings/index.d.ts" /> Polymer({ is: "settings-element"
51caf25c0747f10fc054d320695d716778ee8556
src/app/app.progress-bar.service.ts
src/app/app.progress-bar.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class ProgressBarService { protected visible = true; constructor() { } setVisible() { this.visible = true; } setHidden() { this.visible = false; } }
import { Injectable } from '@angular/core'; @Injectable() export class ProgressBarService { protected visible = false; constructor() { } setVisible() { this.visible = true; } setHidden() { this.visible = false; } }
Change default state to invisible
Change default state to invisible
TypeScript
bsd-3-clause
UoA-eResearch/research-hub,UoA-eResearch/research-hub,UoA-eResearch/research-hub
--- +++ @@ -3,7 +3,7 @@ @Injectable() export class ProgressBarService { - protected visible = true; + protected visible = false; constructor() { }
f47ce0a04698bc01dae6412befb9aa6eed4e8eba
index.ts
index.ts
import Dimensions from "./dimensions"; var dimensions = new Dimensions();
import Dimensions from "./dimensions"; import * as fs from "fs"; process.on('uncaughtException', function(e) { fs.appendFile('../error-log.txt', `${e}\n`, function (err) { }); }); var dimensions = new Dimensions();
Add exception catcher due to unknown crash bug
Add exception catcher due to unknown crash bug
TypeScript
mit
popstarfreas/Dimensions,popstarfreas/Dimensions,popstarfreas/Dimensions
--- +++ @@ -1,2 +1,10 @@ import Dimensions from "./dimensions"; +import * as fs from "fs"; + +process.on('uncaughtException', function(e) { + fs.appendFile('../error-log.txt', `${e}\n`, function (err) { + + }); +}); + var dimensions = new Dimensions();
1b65b3cafbae2c7e908df65dab3b8d8aab949a86
src/components/Queue/EmptyQueue.tsx
src/components/Queue/EmptyQueue.tsx
import * as React from 'react'; import { EmptyState } from '@shopify/polaris'; export interface Handlers { onRefresh: () => void; } const EmptyQueue = ({ onRefresh }: Handlers) => { return ( <EmptyState heading="Your queue is empty." action={{ content: 'Refresh queue', onAction: onRefresh }} image="https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg" > <p>Switch to the search tab to accept some HITs.</p> </EmptyState> ); }; export default EmptyQueue;
import * as React from 'react'; import { Button } from '@shopify/polaris'; import { NonIdealState } from '@blueprintjs/core'; export interface Handlers { readonly onRefresh: () => void; } const EmptyQueue = ({ onRefresh }: Handlers) => { return ( // <EmptyState // heading="Your queue is empty." // action={{ // content: 'Refresh queue', // onAction: onRefresh // }} // image="https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg" // > // <p>Switch to the search tab to accept some HITs.</p> // </EmptyState> <NonIdealState title="Your queue is empty" description="You can click refresh or switch to the search tab." visual="refresh" action={ <Button primary onClick={onRefresh}> Refresh </Button> } /> ); }; export default EmptyQueue;
Switch QueueEmptyState with Blueprint non-ideal-state
Switch QueueEmptyState with Blueprint non-ideal-state
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -1,22 +1,33 @@ import * as React from 'react'; -import { EmptyState } from '@shopify/polaris'; +import { Button } from '@shopify/polaris'; +import { NonIdealState } from '@blueprintjs/core'; export interface Handlers { - onRefresh: () => void; + readonly onRefresh: () => void; } const EmptyQueue = ({ onRefresh }: Handlers) => { return ( - <EmptyState - heading="Your queue is empty." - action={{ - content: 'Refresh queue', - onAction: onRefresh - }} - image="https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg" - > - <p>Switch to the search tab to accept some HITs.</p> - </EmptyState> + // <EmptyState + // heading="Your queue is empty." + // action={{ + // content: 'Refresh queue', + // onAction: onRefresh + // }} + // image="https://cdn.shopify.com/s/files/1/0757/9955/files/empty-state.svg" + // > + // <p>Switch to the search tab to accept some HITs.</p> + // </EmptyState> + <NonIdealState + title="Your queue is empty" + description="You can click refresh or switch to the search tab." + visual="refresh" + action={ + <Button primary onClick={onRefresh}> + Refresh + </Button> + } + /> ); };
f0939f15a7c9939095a8a87c5000df6acc63676e
app.ts
app.ts
/** * Copyright (c) 2015, Fullstack.io * All rights reserved. * * This source code is licensed under the license found in the * LICENSE file in the root directory of this source tree. */ import { Component, EventEmitter } from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import { FORM_DIRECTIVES } from '@angular/common'; /** * @FormApp: the top-level component for our application */ @Component({ selector: 'demo-for-sku', directives: [FORM_DIRECTIVES], template: ` <div class="ui raised segment"> <h2 class="ui header">Demo Form: Sku</h2> <form #f="ngForm" (ngSubmit)="onSubmit(f.value)" class="ui form"> f.value: <pre>{{f.value | json}}</pre> <div class="field"> <label for="skuInput">SKU</label> <input type="text" id="skuInput" placeholder="SKU" ngControl="sku"> </div> <button type="submit" class="ui button">Submit</button> </form> </div> ` }) class FormApp { onSubmit(form: any): void { console.log('you submitted value:', form); } } bootstrap(FormApp);
/** * Copyright (c) 2015, Fullstack.io * All rights reserved. * * This source code is licensed under the license found in the * LICENSE file in the root directory of this source tree. */ import { Component, EventEmitter } from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; import { FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators } from '@angular/common'; /** * @FormApp: the top-level component for our application */ @Component({ selector: 'demo-for-sku', directives: [FORM_DIRECTIVES], template: ` <div class="ui raised segment"> <h2 class="ui header">Demo Form: Sku</h2> <form [ngFormModel]="myForm" (ngSubmit)="onSubmit(myForm.value)" class="ui form"> myForm.value: <pre>{{myForm.value | json}}</pre> <div class="field"> <label for="skuInput">SKU</label> <input type="text" id="skuInput" placeholder="SKU" [ngFormControl]="myForm.controls['sku']"> </div> <button type="submit" class="ui button">Submit</button> </form> </div> ` }) class FormApp { myForm: ControlGroup; constructor(fb: FormBuilder) { this.myForm = fb.group({ 'sku': [ '', Validators.required ] }); } onSubmit(form: any): void { console.log('you submitted value:', form); } } bootstrap(FormApp);
Use FormBuilder instead of ngForm
Use FormBuilder instead of ngForm
TypeScript
mit
etrivinos/ng-book2-forms,etrivinos/ng-book2-forms,etrivinos/ng-book2-forms
--- +++ @@ -9,7 +9,7 @@ import { Component, EventEmitter } from '@angular/core'; import {bootstrap} from '@angular/platform-browser-dynamic'; -import { FORM_DIRECTIVES } from '@angular/common'; +import { FORM_DIRECTIVES, FormBuilder, ControlGroup, Validators } from '@angular/common'; /** * @FormApp: the top-level component for our application @@ -21,11 +21,11 @@ <div class="ui raised segment"> <h2 class="ui header">Demo Form: Sku</h2> - <form #f="ngForm" - (ngSubmit)="onSubmit(f.value)" + <form [ngFormModel]="myForm" + (ngSubmit)="onSubmit(myForm.value)" class="ui form"> - f.value: <pre>{{f.value | json}}</pre> + myForm.value: <pre>{{myForm.value | json}}</pre> <div class="field"> <label for="skuInput">SKU</label> @@ -33,7 +33,7 @@ <input type="text" id="skuInput" placeholder="SKU" - ngControl="sku"> + [ngFormControl]="myForm.controls['sku']"> </div> <button type="submit" class="ui button">Submit</button> @@ -42,6 +42,17 @@ ` }) class FormApp { + myForm: ControlGroup; + + constructor(fb: FormBuilder) { + this.myForm = fb.group({ + 'sku': [ + '', + Validators.required + ] + }); + } + onSubmit(form: any): void { console.log('you submitted value:', form); }
071c4cddaa23fad6ea13e2deba121dc2a6e3cbae
src/app/infrastructure/dom.factory.ts
src/app/infrastructure/dom.factory.ts
import { Dom } from "./dom"; import { Component } from "./component"; export class DomFactory { static createElement(dom: Dom): HTMLElement { const element = document.createElement(dom.tag); if (dom.attributes) { dom.attributes.forEach(attribute => { element.setAttribute(attribute[0], attribute[1]); }); } if (dom.childs) { dom.childs.forEach(child => { if (typeof child === 'string') { element.innerText = child as string; } else { element.appendChild(this.createElement(child as Dom)); } }); } return element; } static createComponent(component: Component): HTMLElement { const tag = component.constructor.name; return this.createElement({ tag: tag, childs: component.childs }); } }
import { Dom } from "./dom"; import { Component } from "./component"; export class DomFactory { static createElement(dom: Dom): HTMLElement { const element = document.createElement(dom.tag); if (dom.attributes) { dom.attributes.forEach(attribute => { element.setAttribute(attribute[0], attribute[1]); }); } if (dom.childs) { dom.childs.forEach(child => { if (typeof child === 'string') { element.innerText = child; } else { element.appendChild(this.createElement(child as Dom)); } }); } return element; } static createComponent(component: Component): HTMLElement { const tag = component .constructor .name .replace(/([A-Z])/g, (word) => `-${word.toLowerCase()}`) .replace('-component', (word) => '') .substring(1); return this.createElement({ tag: tag, childs: component.childs }); } }
Add a convention to component tag name
Add a convention to component tag name
TypeScript
mit
Vtek/frameworkless,Vtek/frameworkless,Vtek/frameworkless
--- +++ @@ -14,7 +14,7 @@ if (dom.childs) { dom.childs.forEach(child => { if (typeof child === 'string') { - element.innerText = child as string; + element.innerText = child; } else { element.appendChild(this.createElement(child as Dom)); @@ -26,7 +26,13 @@ } static createComponent(component: Component): HTMLElement { - const tag = component.constructor.name; + const tag = component + .constructor + .name + .replace(/([A-Z])/g, (word) => `-${word.toLowerCase()}`) + .replace('-component', (word) => '') + .substring(1); + return this.createElement({ tag: tag, childs: component.childs
d4cd5fdeb63310ef7b72fe0c643644caa234e18c
identity-login.ts
identity-login.ts
import ko = require("knockout"); import services = require('services/services'); import authentication = require('./authentication'); import * as Folke from '../folke-core/folke'; import * as ServiceHelpers from "../folke-ko-service-helpers/folke-ko-service-helpers" export class IdentityLoginViewModel { form = new services.LoginView(); providers = ko.observableArray<string>(); loading = services.loading; constructor(public parameters: Folke.Parameters<authentication.AccountView>) { services.authentication.getExternalAuthenticationProviders({}).then(providers => this.providers(providers)); } public login = () => { services.authentication.login({ loginView: this.form }).then(loginResult => { if (loginResult.status() === services.LoginStatusEnum.Success) { authentication.default.updateMe().then(() => this.parameters.resolve()); } }); } public forgotPassword = () => Folke.default.showPopin<authentication.AccountView>('identity-forgot', this.parameters); public register = () => Folke.default.showPopin<authentication.AccountView>('identity-register', this.parameters); public dispose() { } public facebookLogin = () => { window.open('/api/authentication/external-login' + ServiceHelpers.getQueryString({ provider: 'Facebook', returnUrl: window.location.toString() }), 'oauth', 'dialog'); } } export var viewModel = IdentityLoginViewModel;
import ko = require("knockout"); import services = require('services/services'); import authentication = require('./authentication'); import * as Folke from '../folke-core/folke'; import * as ServiceHelpers from "../folke-ko-service-helpers/folke-ko-service-helpers" export class IdentityLoginViewModel { form = new services.LoginView(); providers = ko.observableArray<services.AuthenticationDescription>(); loading = services.loading; constructor(public parameters: Folke.Parameters<authentication.AccountView>) { services.authentication.getExternalAuthenticationProviders({}).then(providers => this.providers(providers)); } public login = () => { services.authentication.login({ loginView: this.form }).then(loginResult => { if (loginResult.status() === services.LoginStatusEnum.Success) { authentication.default.updateMe().then(() => this.parameters.resolve()); } }); } public forgotPassword = () => Folke.default.showPopin<authentication.AccountView>('identity-forgot', this.parameters); public register = () => Folke.default.showPopin<authentication.AccountView>('identity-register', this.parameters); public dispose() { } public facebookLogin = () => { window.open('/api/authentication/external-login' + ServiceHelpers.getQueryString({ provider: 'Facebook', returnUrl: window.location.toString() }), 'oauth', 'dialog'); } } export var viewModel = IdentityLoginViewModel;
Fix after change in Folke.Identity.Server
Fix after change in Folke.Identity.Server
TypeScript
mit
folkelib/folke-identity
--- +++ @@ -6,7 +6,7 @@ export class IdentityLoginViewModel { form = new services.LoginView(); - providers = ko.observableArray<string>(); + providers = ko.observableArray<services.AuthenticationDescription>(); loading = services.loading; constructor(public parameters: Folke.Parameters<authentication.AccountView>) {
b9af3b398b44e189db5b512f769f5a4644019659
src/core/log.ts
src/core/log.ts
import { createLogger, format, transports } from "winston"; const alignedWithColorsAndTime = format.combine( format.colorize(), format.timestamp(), format.prettyPrint(), format.align(), format.printf((info) => { const { timestamp, level, message, ...args } = info; const ts = String(timestamp).slice(0, 19).replace("T", " "); return `${ts} [${level}]: ${message} ${Object.keys(args).length ? JSON.stringify(args, null, 2) : "" }`; }), ); /** The winston logger instance to use. */ export const logger = createLogger({ level: "debug", transports: [ // colorize the output to the console new transports.Console({ format: alignedWithColorsAndTime, }), ], });
import { createLogger, format, transports } from "winston"; import { Config } from "~/core/config"; const alignedWithColorsAndTime = format.combine( format.colorize(), format.timestamp(), format.prettyPrint(), format.align(), format.printf((info) => { const { timestamp, level, message, ...args } = info; const ts = String(timestamp).slice(0, 19).replace("T", " "); return `${ts} [${level}]: ${message} ${Object.keys(args).length ? JSON.stringify(args, null, 2) : "" }`; }), ); /** The winston logger instance to use. */ export const logger = createLogger({ level: "debug", transports: [ new transports.Console({ // colorize the output to the console format: alignedWithColorsAndTime, silent: Config.SILENT, }), ], });
Fix the silent config to work
Fix the silent config to work
TypeScript
mit
JacobFischer/Cerveau,siggame/Cerveau,JacobFischer/Cerveau,siggame/Cerveau
--- +++ @@ -1,4 +1,5 @@ import { createLogger, format, transports } from "winston"; +import { Config } from "~/core/config"; const alignedWithColorsAndTime = format.combine( format.colorize(), @@ -21,9 +22,10 @@ export const logger = createLogger({ level: "debug", transports: [ - // colorize the output to the console new transports.Console({ + // colorize the output to the console format: alignedWithColorsAndTime, + silent: Config.SILENT, }), ], });
e4f2414a3978ead5f66ae664edd008e2549accea
src/app/actor/actor.component.spec.ts
src/app/actor/actor.component.spec.ts
import { inject } from '@angular/core/testing'; import { TestComponentBuilder } from '@angular/core/testing/test_component_builder'; import { ActorComponent } from './actor.component'; describe('Component: ActorComponent', () => { let tcb: TestComponentBuilder; beforeEach(done => { inject([TestComponentBuilder], (_tcb: TestComponentBuilder) => { tcb = _tcb; done(); })(); }); it('should show an actor\'s name', done => { tcb.createAsync(ActorComponent).then(fixture => { fixture.componentInstance.actor = { name: 'Hello World' }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('h2.actor-name').innerText).toEqual('Hello World'); done(); }); }); it('should show three related movies', done => { tcb.createAsync(ActorComponent).then(fixture => { fixture.componentInstance.actor = { name: 'Hello World', movies: [{}, {}, {}] }; fixture.detectChanges(); expect(fixture.nativeElement.querySelectorAll('kf-movie').length).toEqual(3); done(); }); }); });
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActorComponent } from './actor.component'; describe('Component: ActorComponent', () => { let fixture: ComponentFixture<ActorComponent>; beforeEach(done => { TestBed.configureTestingModule({ declarations: [ActorComponent], providers: [ ] }); TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(ActorComponent); done(); }); }); it('should show an actor\'s name', () => { fixture.componentInstance.actor = { name: 'Hello World' }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('h2.actor-name').innerText).toEqual('Hello World'); }); it('should show three related movies', () => { fixture.componentInstance.actor = { name: 'Hello World', movies: [{}, {}, {}] }; fixture.detectChanges(); expect(fixture.nativeElement.querySelectorAll('kf-movie').length).toEqual(3); }); });
Switch to using RC5 TestBed
Switch to using RC5 TestBed
TypeScript
isc
textbook/known-for-web,textbook/known-for-web,textbook/known-for-web
--- +++ @@ -1,33 +1,33 @@ -import { inject } from '@angular/core/testing'; -import { TestComponentBuilder } from '@angular/core/testing/test_component_builder'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActorComponent } from './actor.component'; describe('Component: ActorComponent', () => { - let tcb: TestComponentBuilder; + let fixture: ComponentFixture<ActorComponent>; beforeEach(done => { - inject([TestComponentBuilder], (_tcb: TestComponentBuilder) => { - tcb = _tcb; - done(); - })(); - }); - it('should show an actor\'s name', done => { - tcb.createAsync(ActorComponent).then(fixture => { - fixture.componentInstance.actor = { name: 'Hello World' }; - fixture.detectChanges(); - expect(fixture.nativeElement.querySelector('h2.actor-name').innerText).toEqual('Hello World'); + TestBed.configureTestingModule({ + declarations: [ActorComponent], + providers: [ + ] + }); + + TestBed.compileComponents().then(() => { + fixture = TestBed.createComponent(ActorComponent); done(); }); }); - it('should show three related movies', done => { - tcb.createAsync(ActorComponent).then(fixture => { - fixture.componentInstance.actor = { name: 'Hello World', movies: [{}, {}, {}] }; - fixture.detectChanges(); - expect(fixture.nativeElement.querySelectorAll('kf-movie').length).toEqual(3); - done(); - }); + it('should show an actor\'s name', () => { + fixture.componentInstance.actor = { name: 'Hello World' }; + fixture.detectChanges(); + expect(fixture.nativeElement.querySelector('h2.actor-name').innerText).toEqual('Hello World'); + }); + + it('should show three related movies', () => { + fixture.componentInstance.actor = { name: 'Hello World', movies: [{}, {}, {}] }; + fixture.detectChanges(); + expect(fixture.nativeElement.querySelectorAll('kf-movie').length).toEqual(3); }); });
d75aa52ad2753b253f63ab9d44f1f9556fedd055
src/app/movie/movie.component.spec.ts
src/app/movie/movie.component.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Observable } from 'rxjs/Rx'; import { MovieComponent } from './movie.component'; describe('Component: Movie', () => { let fixture: ComponentFixture<MovieComponent>; let mockActorService: any; beforeEach(done => { mockActorService = jasmine.createSpyObj('ActorService', ['getActor']); mockActorService.getActor.and.returnValue(Observable.from([{ name: 'Hans Muster' }])); TestBed.configureTestingModule({ declarations: [MovieComponent] }); TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(MovieComponent); fixture.detectChanges(); done(); }); }); it('should display the name of the movie', () => { let title = 'This Time It\'s Personal'; fixture.componentInstance.movie = { title }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('input.movie-title').value).toEqual(title); }); it('should display an image of the movie', () => { let imageUrl = 'poster.jpg'; fixture.componentInstance.movie = { title: 'Watch This', image_url: imageUrl }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('.movie-poster > img').src).toContain(imageUrl); }); it('should display an image of the movie', () => { let releaseYear = 1234; fixture.componentInstance.movie = { title: 'Watch This', release_year: releaseYear }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('p.movie-release').innerText).toContain(releaseYear); }); });
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MovieComponent } from './movie.component'; describe('Component: Movie', () => { let fixture: ComponentFixture<MovieComponent>; beforeEach(done => { TestBed.configureTestingModule({ declarations: [MovieComponent] }); TestBed.compileComponents().then(() => { fixture = TestBed.createComponent(MovieComponent); fixture.detectChanges(); done(); }); }); it('should display the name of the movie', () => { let title = 'This Time It\'s Personal'; fixture.componentInstance.movie = { title }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('input.movie-title').value).toEqual(title); }); it('should display an image of the movie', () => { let imageUrl = 'poster.jpg'; fixture.componentInstance.movie = { title: 'Watch This', image_url: imageUrl }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('.movie-poster > img').src).toContain(imageUrl); }); it('should display the movie\'s release year', () => { let releaseYear = 1234; fixture.componentInstance.movie = { title: 'Watch This', release_year: releaseYear }; fixture.detectChanges(); expect(fixture.nativeElement.querySelector('p.movie-release').innerText).toContain(releaseYear); }); });
Correct typo in test description and remove dead code.
Correct typo in test description and remove dead code.
TypeScript
isc
textbook/known-for-web,textbook/known-for-web,textbook/known-for-web
--- +++ @@ -1,17 +1,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Observable } from 'rxjs/Rx'; import { MovieComponent } from './movie.component'; describe('Component: Movie', () => { let fixture: ComponentFixture<MovieComponent>; - let mockActorService: any; beforeEach(done => { - mockActorService = jasmine.createSpyObj('ActorService', ['getActor']); - mockActorService.getActor.and.returnValue(Observable.from([{ name: 'Hans Muster' }])); - TestBed.configureTestingModule({ declarations: [MovieComponent] }); TestBed.compileComponents().then(() => { @@ -35,7 +29,7 @@ expect(fixture.nativeElement.querySelector('.movie-poster > img').src).toContain(imageUrl); }); - it('should display an image of the movie', () => { + it('should display the movie\'s release year', () => { let releaseYear = 1234; fixture.componentInstance.movie = { title: 'Watch This', release_year: releaseYear }; fixture.detectChanges();
50860b1b528686d0c3e10cb5e0a44cedbed47c72
scripts/slack/SlackWebAPI.ts
scripts/slack/SlackWebAPI.ts
import { injectable, inject } from "inversify"; import { ISlackWebAPI } from "./ISlackWebAPI"; import { PostMessageRequest, SlackConfig, SlackWebAPIResponse } from "./Types"; import { IHttpClient } from "../core/http/IHttpClient"; /*** * The Slack Web API is documented on https://api.slack.com/web */ @injectable() export class SlackWebAPI implements ISlackWebAPI { constructor( @inject("SlackConfig") private slackConfig: SlackConfig, @inject("HttpClient") private httpClient: IHttpClient) {} /** * For the details on this API check https://api.slack.com/methods/chat.postMessage */ async postMessage(message: PostMessageRequest): Promise<void> { let response: SlackWebAPIResponse = await this.httpClient.post<any, SlackWebAPIResponse>( "https://slack.com/api/chat.postMessage", { token: this.slackConfig.botUserOAuthAccessToken, channel: message.channel || this.slackConfig.defaultChannel, text: message.text, attachments: JSON.stringify(message.attachments), as_user: false } ); if (!response.ok) { throw new Error(`Error in slack send process: ${response.error}`); } } }
import { injectable, inject } from "inversify"; import { ISlackWebAPI } from "./ISlackWebAPI"; import { PostMessageRequest, SlackConfig, SlackWebAPIResponse } from "./Types"; import { IHttpClient } from "../core/http/IHttpClient"; /*** * The Slack Web API is documented on https://api.slack.com/web */ @injectable() export class SlackWebAPI implements ISlackWebAPI { constructor( @inject("SlackConfig") private slackConfig: SlackConfig, @inject("HttpClient") private httpClient: IHttpClient) {} /** * For the details on this API check https://api.slack.com/methods/chat.postMessage */ async postMessage(message: PostMessageRequest): Promise<void> { let response: SlackWebAPIResponse = await this.httpClient.post<any, SlackWebAPIResponse>( "https://slack.com/api/chat.postMessage", { token: this.slackConfig.botUserOAuthAccessToken, channel: message.channel || this.slackConfig.defaultChannel, text: message.text, attachments: JSON.stringify(message.attachments || []), as_user: false } ); if (!response.ok) { throw new Error(`Error in slack send process: ${response.error}`); } } }
Add defaults to message attachments
Add defaults to message attachments
TypeScript
apache-2.0
zmoog/dickbott
--- +++ @@ -24,10 +24,11 @@ token: this.slackConfig.botUserOAuthAccessToken, channel: message.channel || this.slackConfig.defaultChannel, text: message.text, - attachments: JSON.stringify(message.attachments), + attachments: JSON.stringify(message.attachments || []), as_user: false } ); + if (!response.ok) { throw new Error(`Error in slack send process: ${response.error}`); }
4373d35bd184fba0af7069b2f230fa6a092f7803
src/schema/Member.ts
src/schema/Member.ts
// This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. import {Namespace} from './Namespace'; import {Type} from './Type'; export class Member { constructor(name: string) { this.surrogateKey = Member.nextKey++; this.name = name; } name: string; namespace: Namespace; typeList: Type[]; comment: string; isExported: boolean; isAbstract: boolean; isSubstituted: boolean; substitutes: Member; surrogateKey: number; private static nextKey = 0; static abstractFlag = 1; static substitutedFlag = 2; static anyFlag = 4; }
// This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. import * as cxml from 'cxml'; import {Namespace} from './Namespace'; import {Type} from './Type'; export class Member extends cxml.MemberBase<Member, Namespace, cxml.ItemBase<Member>> { constructor(name: string) { super(null, name); this.surrogateKey = Member.nextKey++; } typeList: Type[]; comment: string; isExported: boolean; surrogateKey: number; private static nextKey = 0; }
Use member base class from cxml.
Use member base class from cxml.
TypeScript
mit
charto/cxsd,charto/fast-xml,charto/fast-xml,charto/cxsd
--- +++ @@ -1,17 +1,16 @@ // This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. + +import * as cxml from 'cxml'; import {Namespace} from './Namespace'; import {Type} from './Type'; -export class Member { +export class Member extends cxml.MemberBase<Member, Namespace, cxml.ItemBase<Member>> { constructor(name: string) { + super(null, name); this.surrogateKey = Member.nextKey++; - this.name = name; } - - name: string; - namespace: Namespace; typeList: Type[]; @@ -19,14 +18,6 @@ isExported: boolean; - isAbstract: boolean; - isSubstituted: boolean; - substitutes: Member; - surrogateKey: number; private static nextKey = 0; - - static abstractFlag = 1; - static substitutedFlag = 2; - static anyFlag = 4; }
e9d7a91d17ba13dda7b6b42ea8f1ff7fc8beb2ec
e2e/app.e2e-spec.ts
e2e/app.e2e-spec.ts
import { Ng2CiAppPage } from './app.po'; describe('ng2-ci-app App', function () { let page: Ng2CiAppPage; beforeEach(() => { page = new Ng2CiAppPage(); }); it('should display message saying app works', () => { page.navigateTo(); expect(page.getParagraphText()).toEqual('NG Friends!'); }); it('should display some ng friends', () => { page.navigateTo(); expect(page.getFriends()).toEqual(8); }); });
import { Ng2CiAppPage } from './app.po'; describe('ng2-ci-app App', function () { let page: Ng2CiAppPage; beforeEach(() => { page = new Ng2CiAppPage(); }); it('should display message saying app works', () => { page.navigateTo(); expect(page.getParagraphText()).toEqual('NG Friends!'); }); it('should display some ng friends', () => { page.navigateTo(); expect(page.getFriends()).toEqual(9); }); });
Fix tests to display 9 friends
test(e2e): Fix tests to display 9 friends Fix tests to display 9 friends
TypeScript
mit
Elecash/ng2-ci-app,Elecash/ng2-ci-app,Elecash/ng2-ci-app,Elecash/ng2-ci-app
--- +++ @@ -14,6 +14,6 @@ it('should display some ng friends', () => { page.navigateTo(); - expect(page.getFriends()).toEqual(8); + expect(page.getFriends()).toEqual(9); }); });
b5fd559ca49854f9a12032d4968b6c642da38a30
applications/calendar/src/app/components/events/PopoverContainer.tsx
applications/calendar/src/app/components/events/PopoverContainer.tsx
import React, { useRef, Ref, forwardRef } from 'react'; import { useCombinedRefs, useFocusTrap } from 'react-components'; interface Props extends React.HTMLAttributes<HTMLDivElement> { isOpen?: boolean; } const PopoverContainer = ({ children, isOpen = true, ...rest }: Props, ref: Ref<HTMLDivElement>) => { const rootRef = useRef<HTMLDivElement>(null); const combinedRefs = useCombinedRefs<HTMLDivElement>(ref, rootRef); const focusTrapProps = useFocusTrap({ active: isOpen, rootRef }); return ( <div ref={combinedRefs} {...rest} {...focusTrapProps}> {children} </div> ); }; const ForwardPopoverContainer = forwardRef(PopoverContainer); export default ForwardPopoverContainer;
import React, { useRef, Ref, forwardRef } from 'react'; import { useCombinedRefs, useFocusTrap, classnames } from 'react-components'; interface Props extends React.HTMLAttributes<HTMLDivElement> { isOpen?: boolean; } const PopoverContainer = ({ children, className, isOpen = true, ...rest }: Props, ref: Ref<HTMLDivElement>) => { const rootRef = useRef<HTMLDivElement>(null); const combinedRefs = useCombinedRefs<HTMLDivElement>(ref, rootRef); const focusTrapProps = useFocusTrap({ active: isOpen, rootRef }); return ( <div ref={combinedRefs} className={classnames([className, 'no-outline'])} {...rest} {...focusTrapProps}> {children} </div> ); }; const ForwardPopoverContainer = forwardRef(PopoverContainer); export default ForwardPopoverContainer;
Disable outline on popover focus trap
Disable outline on popover focus trap
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,17 +1,17 @@ import React, { useRef, Ref, forwardRef } from 'react'; -import { useCombinedRefs, useFocusTrap } from 'react-components'; +import { useCombinedRefs, useFocusTrap, classnames } from 'react-components'; interface Props extends React.HTMLAttributes<HTMLDivElement> { isOpen?: boolean; } -const PopoverContainer = ({ children, isOpen = true, ...rest }: Props, ref: Ref<HTMLDivElement>) => { +const PopoverContainer = ({ children, className, isOpen = true, ...rest }: Props, ref: Ref<HTMLDivElement>) => { const rootRef = useRef<HTMLDivElement>(null); const combinedRefs = useCombinedRefs<HTMLDivElement>(ref, rootRef); const focusTrapProps = useFocusTrap({ active: isOpen, rootRef }); return ( - <div ref={combinedRefs} {...rest} {...focusTrapProps}> + <div ref={combinedRefs} className={classnames([className, 'no-outline'])} {...rest} {...focusTrapProps}> {children} </div> );
db7270a0b0b91624449e50b31cde9261d05938b8
app/_config/config.ts
app/_config/config.ts
/** * Created by adam on 18/12/2016. */ export const REMOTE_URL = 'http://next.obudget.org/search'; export const LOCAL_URL = 'http://localhost:5000/search'; export const URL = REMOTE_URL; // export const URL = LOCAL_URL; export let Colors = { bgColor: '#ccc' };
/** * Created by adam on 18/12/2016. */ export const REMOTE_URL = 'https://next.obudget.org/search'; export const LOCAL_URL = 'http://localhost:5000/search'; export const URL = REMOTE_URL; // export const URL = LOCAL_URL; export let Colors = { bgColor: '#ccc' };
Use https version of search api
Use https version of search api
TypeScript
mit
aviklai/budgetkey-app-search,aviklai/budgetkey-app-search,aviklai/budgetkey-app-search
--- +++ @@ -1,7 +1,7 @@ /** * Created by adam on 18/12/2016. */ -export const REMOTE_URL = 'http://next.obudget.org/search'; +export const REMOTE_URL = 'https://next.obudget.org/search'; export const LOCAL_URL = 'http://localhost:5000/search'; export const URL = REMOTE_URL; // export const URL = LOCAL_URL;
dd73ad6a96e848e10cd94c2ad39008b783271e70
typings/globals.d.ts
typings/globals.d.ts
declare var sinon: Sinon.SinonStatic; import * as moment from "moment"; declare module "moment" { export type MomentFormatSpecification = string; } export = moment;
import { SinonStatic } from 'sinon'; declare global { const sinon: SinonStatic; } import * as moment from "moment"; declare module "moment" { export type MomentFormatSpecification = string; } export = moment;
Declare sinon as a global
Declare sinon as a global The latest sinon types don't have sinon as a global anymore, so we have to provide a shim for that.
TypeScript
mit
RenovoSolutions/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities
--- +++ @@ -1,4 +1,9 @@ -declare var sinon: Sinon.SinonStatic; +import { SinonStatic } from 'sinon'; + +declare global { + const sinon: SinonStatic; +} + import * as moment from "moment"; declare module "moment" {
8b6345defe0eed52987b70f9672f2e7712fab051
src/Decorators.ts
src/Decorators.ts
import _ = require("lodash"); export function memoize(resolver: any) { return (target: any, name: string, descriptor: PropertyDescriptor) => { descriptor.value = _.memoize(descriptor.value, resolver); return descriptor; } }
import _ = require("lodash"); export function memoize(resolver = (...args: any[]) => args) { return (target: any, name: string, descriptor: PropertyDescriptor) => { descriptor.value = _.memoize(descriptor.value, resolver); return descriptor; } }
Add a default value for memoize.
Add a default value for memoize.
TypeScript
mit
Young55555/black-screen,j-allard/black-screen,smaty1/black-screen,w9jds/black-screen,cyrixhero/black-screen,drew-gross/black-screen,drew-gross/black-screen,kingland/black-screen,cyrixhero/black-screen,smaty1/black-screen,gastrodia/black-screen,habibmasuro/black-screen,rob3ns/black-screen,jbhannah/black-screen,toxic88/black-screen,N00D13/black-screen,Thundabrow/black-screen,JimLiu/black-screen,over300laughs/black-screen,littlecodeshop/black-screen,Suninus/black-screen,RyanTech/black-screen,taraszerebecki/black-screen,Ribeiro/black-screen,Young55555/black-screen,alessandrostone/black-screen,black-screen/black-screen,alice-gh/black-screen-1,bodiam/black-screen,smaty1/black-screen,ammaroff/black-screen,ammaroff/black-screen,rakesh-mohanta/black-screen,gastrodia/black-screen,littlecodeshop/black-screen,black-screen/black-screen,railsware/upterm,Serg09/black-screen,noikiy/black-screen,mzgnr/black-screen,railsware/upterm,Ribeiro/black-screen,bodiam/black-screen,rocky-jaiswal/black-screen,RyanTech/black-screen,geksilla/black-screen,over300laughs/black-screen,jacobmarshall/black-screen,littlecodeshop/black-screen,j-allard/black-screen,skomski/black-screen,Suninus/black-screen,adamliesko/black-screen,geksilla/black-screen,shockone/black-screen,gabrielbellamy/black-screen,taraszerebecki/black-screen,rakesh-mohanta/black-screen,JimLiu/black-screen,Ribeiro/black-screen,vshatskyi/black-screen,rocky-jaiswal/black-screen,bodiam/black-screen,jassyboy/black-screen,stefohnee/black-screen,habibmasuro/black-screen,jacobmarshall/black-screen,kustomzone/black-screen,kingland/black-screen,Dangku/black-screen,alice-gh/black-screen-1,stefohnee/black-screen,black-screen/black-screen,w9jds/black-screen,Dangku/black-screen,alessandrostone/black-screen,toxic88/black-screen,alessandrostone/black-screen,gabrielbellamy/black-screen,genecyber/black-screen,Serg09/black-screen,AnalogRez/black-screen,jacobmarshall/black-screen,toxic88/black-screen,jassyboy/black-screen,bestwpw/black-screen,bestwpw/black-screen,gastrodia/black-screen,williara/black-screen,taraszerebecki/black-screen,Cavitt/black-screen,jassyboy/black-screen,adamliesko/black-screen,jonadev95/black-screen,habibmasuro/black-screen,kingland/black-screen,drew-gross/black-screen,kaze13/black-screen,mzgnr/black-screen,N00D13/black-screen,jqk6/black-screen,noikiy/black-screen,RyanTech/black-screen,w9jds/black-screen,skomski/black-screen,jbhannah/black-screen,adamliesko/black-screen,Thundabrow/black-screen,kaze13/black-screen,noikiy/black-screen,skomski/black-screen,rocky-jaiswal/black-screen,drew-gross/black-screen,JimLiu/black-screen,jonadev95/black-screen,gabrielbellamy/black-screen,Thundabrow/black-screen,rob3ns/black-screen,bestwpw/black-screen,Young55555/black-screen,rob3ns/black-screen,Cavitt/black-screen,kustomzone/black-screen,cyrixhero/black-screen,williara/black-screen,vshatskyi/black-screen,vshatskyi/black-screen,AnalogRez/black-screen,jonadev95/black-screen,jqk6/black-screen,williara/black-screen,vshatskyi/black-screen,Dangku/black-screen,mzgnr/black-screen,AnalogRez/black-screen,Cavitt/black-screen,kustomzone/black-screen,over300laughs/black-screen,Suninus/black-screen,ammaroff/black-screen,geksilla/black-screen,rakesh-mohanta/black-screen,shockone/black-screen,j-allard/black-screen,genecyber/black-screen,stefohnee/black-screen,genecyber/black-screen,jqk6/black-screen,N00D13/black-screen,kaze13/black-screen,Serg09/black-screen,jbhannah/black-screen,alice-gh/black-screen-1
--- +++ @@ -1,6 +1,6 @@ import _ = require("lodash"); -export function memoize(resolver: any) { +export function memoize(resolver = (...args: any[]) => args) { return (target: any, name: string, descriptor: PropertyDescriptor) => { descriptor.value = _.memoize(descriptor.value, resolver);
adde8c9c53a4b90c89a5ab41be64a389e9c5a57e
client.src/index.tsx
client.src/index.tsx
import {h, render} from 'preact';
import {h, render} from 'preact'; const TREE_DATA = [ { name: 'Services', icon: '#folder', entries: [ { key: 1482949340975, expiration: 1483686907461, history: [ 1482949340970, ], name: 'Google', description: 'Big brother', url: 'https://google.com/', icon: 'https://www.google.com/images/branding/product/ico/googleg_lodp.ico', data: { login: '[email protected]', password: 'Secret password', comments: 'Secret code: 42\nTel: 1234567890', attachments: [ { name: 'secret.txt', data: 'U2VjcmV0IHRleHQ=', }, { name: 'secret2.txt', data: 'U2VjcmV0IHRleHQgMg==', }, ], }, }, { key: 1482949464927, name: 'Yandex', } ], }, { name: 'Other', entries: [], }, ];
Add static mock of tree data
Add static mock of tree data
TypeScript
mit
Avol-V/anykey,Avol-V/anykey,Avol-V/anykey
--- +++ @@ -1 +1,44 @@ import {h, render} from 'preact'; + +const TREE_DATA = [ + { + name: 'Services', + icon: '#folder', + entries: [ + { + key: 1482949340975, + expiration: 1483686907461, + history: [ + 1482949340970, + ], + name: 'Google', + description: 'Big brother', + url: 'https://google.com/', + icon: 'https://www.google.com/images/branding/product/ico/googleg_lodp.ico', + data: { + login: '[email protected]', + password: 'Secret password', + comments: 'Secret code: 42\nTel: 1234567890', + attachments: [ + { + name: 'secret.txt', + data: 'U2VjcmV0IHRleHQ=', + }, + { + name: 'secret2.txt', + data: 'U2VjcmV0IHRleHQgMg==', + }, + ], + }, + }, + { + key: 1482949464927, + name: 'Yandex', + } + ], + }, + { + name: 'Other', + entries: [], + }, +];
6ce0c0b8332974ff868684c951e2ac1207abde41
test/test.ts
test/test.ts
import 'reflect-metadata'; import test from 'ava'; import { command, option } from '../dist'; // interface Global { // Reflect: any; // } const g = <any>global; const Reflect = g.Reflect; test((t) => { debugger; class MyCommand { @command({ argv: ['--test', 'test-value'] }) run(@option({ name: 'test' }) test: string) { t.true(test === 'test-value'); } } let c = new MyCommand(); c.run(''); });
import 'reflect-metadata'; import test from 'ava'; import { command, option } from '../dist'; // https://github.com/avajs/ava/issues/1089 const g = <any>global; const Reflect = g.Reflect; test((t) => { debugger; class MyCommand { @command({ argv: ['--test', 'test-value'] }) run(@option({ name: 'test' }) test: string) { t.true(test === 'test-value'); } } let c = new MyCommand(); c.run(''); });
Add link to issue about ava and overriding globals
Add link to issue about ava and overriding globals
TypeScript
mit
dwieeb/minimist-decorators
--- +++ @@ -3,10 +3,7 @@ import { command, option } from '../dist'; -// interface Global { -// Reflect: any; -// } - +// https://github.com/avajs/ava/issues/1089 const g = <any>global; const Reflect = g.Reflect;
0ea4ffec7f3752cefc86b009248a5f7c16cc5725
source/math_demo.ts
source/math_demo.ts
///<reference path="./interfaces.d.ts" /> class MathDemo implements MathInterface{ public PI : number; constructor() { this.PI = 3.14159265359; } public pow(base: number, exponent: number) { var result = base; for(var i = 1; i < exponent; i++){ result = result * base; } return result; } public powAsyncSlow(base: number, exponent: number, cb : (result : number) => void) { var delay = 45; //ms setTimeout(() => { var result = this.pow(base, exponent); cb(result); }, delay); } } export { MathDemo };
///<reference path="./interfaces.d.ts" /> class MathDemo implements MathInterface{ public PI : number; constructor() { this.PI = 3.14159265359; } public pow(base: number, exponent: number) { var result = base; for(var i = 1; i < exponent; i++){ result = result * base; } return result; } public powAsync(base: number, exponent: number, cb : (result : number) => void) { var delay = 45; //ms setTimeout(() => { var result = this.pow(base, exponent); cb(result); }, delay); } } export { MathDemo };
Fix for typo in method name
Fix for typo in method name
TypeScript
mit
ChargerIIC/ts-book,ChargerIIC/ts-book,ChargerIIC/ts-book
--- +++ @@ -15,7 +15,7 @@ return result; } - public powAsyncSlow(base: number, exponent: number, cb : (result : number) => void) { + public powAsync(base: number, exponent: number, cb : (result : number) => void) { var delay = 45; //ms setTimeout(() => { var result = this.pow(base, exponent);
e504a7938cbc56e301b65667247432cd7d5202ab
src/utils/config.ts
src/utils/config.ts
export const PROJECT_NAME = 'typings' export const CONFIG_FILE = `${PROJECT_NAME}.json` export const TYPINGS_DIR = `${PROJECT_NAME}_typings` export const DTS_MAIN_FILE = `${PROJECT_NAME}.main.d.ts` export const DTS_BROWSER_FILE = `${PROJECT_NAME}.browser.d.ts`
export const PROJECT_NAME = 'typings' export const CONFIG_FILE = `${PROJECT_NAME}.json` export const TYPINGS_DIR = PROJECT_NAME export const DTS_MAIN_FILE = 'main.d.ts' export const DTS_BROWSER_FILE = 'browser.d.ts'
Fix `typings/` directory structure after rename
Fix `typings/` directory structure after rename
TypeScript
mit
typings/typings,typings/typings
--- +++ @@ -1,5 +1,5 @@ export const PROJECT_NAME = 'typings' export const CONFIG_FILE = `${PROJECT_NAME}.json` -export const TYPINGS_DIR = `${PROJECT_NAME}_typings` -export const DTS_MAIN_FILE = `${PROJECT_NAME}.main.d.ts` -export const DTS_BROWSER_FILE = `${PROJECT_NAME}.browser.d.ts` +export const TYPINGS_DIR = PROJECT_NAME +export const DTS_MAIN_FILE = 'main.d.ts' +export const DTS_BROWSER_FILE = 'browser.d.ts'
3f0814c692cbed2864365df591c1e9b2bd5c1ddc
ui/src/api/image.ts
ui/src/api/image.ts
export const fetchImage = async (project: string, id: string, maxWidth: number, maxHeight: number, token: string): Promise<string> => { const imageUrl = getImageUrl(project, `${id}.jp2`, maxWidth, maxHeight, token); const response = await fetch(imageUrl); if (response.ok) return URL.createObjectURL(await response.blob()); else throw (await response.json()); }; export const getImageUrl = (project: string, path: string, maxWidth: number, maxHeight: number, token: string, format = 'jpg'): string => { const token_ = token === undefined || token === '' ? 'anonymous' : token; return `/api/images/${project}/${encodeURIComponent(path)}/` + `${token_}/full/!${maxWidth},${maxHeight}/0/default.${format}`; }; export const makeUrl = (project: string, id: string, token?: string): string => { const token_ = token === undefined || token === '' ? 'anonymous' : token; return `/api/images/${project}/${id}.jp2/${token_}/info.json`; };
export const fetchImage = async (project: string, id: string, maxWidth: number, maxHeight: number, token: string): Promise<string> => { const imageUrl = getImageUrl(project, `${id}.jp2`, maxWidth, maxHeight, token); const response = await fetch(imageUrl); if (response.ok) return URL.createObjectURL(await response.blob()); else throw (await response.json()); }; export const getImageUrl = (project: string, path: string, maxWidth: number, maxHeight: number, token: string, format = 'jpg'): string => { const token_ = token === undefined || token === '' ? 'anonymous' : token; return `/api/images/${project}/${encodeURIComponent(path)}/` + `${token_}/full/!${maxWidth},${maxHeight}/0/default.${format}`; }; export const makeUrl = (project: string, id: string, token?: string): string => { const token_ = token === undefined || token === '' ? 'anonymous' : token; return `/api/images/${project}/${id}.jp2/${token_}/info.json`; };
Add empty line at eof
Add empty line at eof
TypeScript
apache-2.0
dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web
d68f737abf00b490ba463bb87f5ded5ef091b42a
angular-dropdown-control.directive.ts
angular-dropdown-control.directive.ts
import { Directive, ElementRef, Inject, forwardRef, Input, Host, HostListener } from '@angular/core'; import { AngularDropdownDirective } from './angular-dropdown.directive'; @Directive({ selector: '[ng-dropdown-control],[ngDropdownControl]', host: { '[attr.aria-haspopup]': 'true', '[attr.aria-controls]': 'dropdown.id', '[class.ng-dropdown-control]': 'true', '[class.active]': 'dropdown.isOpen' } }) export class AngularDropdownControlDirective { @HostListener('click', [ '$event' ]) onClick(e: Event): void { e.stopPropagation(); if (!this.dropdown.disabled) { this.dropdown.toggle(); } } constructor( @Host() @Inject(forwardRef(() => AngularDropdownDirective)) public dropdown: AngularDropdownDirective, public element: ElementRef) { } }
import { Directive, ElementRef, Inject, forwardRef, Input, Host, HostListener } from '@angular/core'; import { AngularDropdownDirective } from './angular-dropdown.directive'; @Directive({ selector: '[ng-dropdown-control],[ngDropdownControl]', host: { '[attr.aria-haspopup]': 'true', '[attr.aria-controls]': 'dropdown.id', '[attr.aria-expanded]': 'dropdown.isOpen', '[class.ng-dropdown-control]': 'true', '[class.active]': 'dropdown.isOpen' } }) export class AngularDropdownControlDirective { @HostListener('click', [ '$event' ]) onClick(e: Event): void { e.stopPropagation(); if (!this.dropdown.disabled) { this.dropdown.toggle(); } } constructor( @Host() @Inject(forwardRef(() => AngularDropdownDirective)) public dropdown: AngularDropdownDirective, public element: ElementRef) { } }
Add aria-expanded attribute binding to control
Add aria-expanded attribute binding to control
TypeScript
mit
topaxi/angular-dropdown,topaxi/angular-dropdown,topaxi/angular-dropdown
--- +++ @@ -16,6 +16,7 @@ host: { '[attr.aria-haspopup]': 'true', '[attr.aria-controls]': 'dropdown.id', + '[attr.aria-expanded]': 'dropdown.isOpen', '[class.ng-dropdown-control]': 'true', '[class.active]': 'dropdown.isOpen' }
690d1e89780022ca84b80890eb360afd9562da4a
lib/utils.ts
lib/utils.ts
/** * Slack upload logic and utilites */ 'use strict' import * as fs from 'fs' import { exec } from 'child_process' import * as request from 'request-promise' import { SLACK_TOKEN, SLACK_CHANNEL } from './config' /** * Uploads the zip file to Slack * @param {string} file Path of file to upload * @param {string} type Type of build to upload * @param {string} tag Optional tag to upload */ export const Slack = (file: string, type: string, tag?: string) => { console.log('Uploading zip to Slack') return request.post({ url: 'https://slack.com/api/files.upload', qs: { token: SLACK_TOKEN }, json: true, formData: { channels: SLACK_CHANNEL, filename: `${type}${tag ? `-${tag}` : ''}.zip`, file: fs.createReadStream(file), }, }).then(res => { if (res.ok) { console.log('Uploaded to Slack') } else { console.log('Failed to upload') throw res } }) } /** * Executes given command on the Shell * @param {string} command Command to execute on shell */ export const Shell = (command: string): Promise<number> => { return new Promise((resolve, reject) => { console.log(`[exec] ${command}`) exec(command, (error) => error !== null ? resolve() : reject(error)) }) }
/** * Slack upload logic and utilites */ 'use strict' import * as fs from 'fs' import { exec } from 'child_process' import * as request from 'request-promise' import { SLACK_TOKEN, SLACK_CHANNEL } from './config' /** * Uploads the zip file to Slack * @param {string} file Path of file to upload * @param {string} type Type of build to upload * @param {string} tag Optional tag to upload */ export const Slack = (file: string, type: string, tag?: string) => { console.log('[exec] Uploading zip to Slack') return request.post({ url: 'https://slack.com/api/files.upload', qs: { token: SLACK_TOKEN }, json: true, formData: { channels: SLACK_CHANNEL, filename: `${type}${tag ? `-${tag}` : ''}.zip`, file: fs.createReadStream(file), }, }).then(res => { if (res.ok) { console.log('Uploaded to Slack') } else { console.log('Failed to upload') throw res } }) } /** * Executes given command on the Shell * @param {string} command Command to execute on shell */ export const Shell = (command: string): Promise<number> => { return new Promise((resolve, reject) => { console.log(`[exec] ${command}`) exec(command, (error) => error === null ? resolve() : reject(error)) }) }
Resolve if error is null
Resolve if error is null
TypeScript
apache-2.0
shantanuraj/slack-android-uploader,shantanuraj/slack-android-uploader
--- +++ @@ -16,7 +16,7 @@ * @param {string} tag Optional tag to upload */ export const Slack = (file: string, type: string, tag?: string) => { - console.log('Uploading zip to Slack') + console.log('[exec] Uploading zip to Slack') return request.post({ url: 'https://slack.com/api/files.upload', @@ -44,6 +44,6 @@ export const Shell = (command: string): Promise<number> => { return new Promise((resolve, reject) => { console.log(`[exec] ${command}`) - exec(command, (error) => error !== null ? resolve() : reject(error)) + exec(command, (error) => error === null ? resolve() : reject(error)) }) }
ad76b0d9b3bc9fd17d83b9e1e230a299980252f7
app/shared/no.sanitization.service.ts
app/shared/no.sanitization.service.ts
import { Injectable, provide } from '@angular/core'; import { DomSanitizationService, SecurityContext } from '@angular/platform-browser'; @Injectable() export class NoSanitizationService { sanitize(ctx: SecurityContext, value: any): string { return value; } } export const NO_SANITIZATION_PROVIDERS: any[] = [ provide(DomSanitizationService, { useClass: NoSanitizationService }), ];
import { Injectable } from '@angular/core'; import { DomSanitizationService, SecurityContext } from '@angular/platform-browser'; @Injectable() export class NoSanitizationService { sanitize(ctx: SecurityContext, value: any): string { return value; } } export const NO_SANITIZATION_PROVIDERS: any[] = [ {provide: DomSanitizationService, useClass: NoSanitizationService} ];
Update NoSanitizationService to not use deprecated apis
Update NoSanitizationService to not use deprecated apis
TypeScript
mit
zoehneto/tumblr-reader,zoehneto/tumblr-reader,zoehneto/tumblr-reader
--- +++ @@ -1,4 +1,4 @@ -import { Injectable, provide } from '@angular/core'; +import { Injectable } from '@angular/core'; import { DomSanitizationService, SecurityContext } from '@angular/platform-browser'; @Injectable() @@ -9,5 +9,5 @@ } export const NO_SANITIZATION_PROVIDERS: any[] = [ - provide(DomSanitizationService, { useClass: NoSanitizationService }), + {provide: DomSanitizationService, useClass: NoSanitizationService} ];
ae7273d673e3da00c1b07927b05ca225a652bc54
packages/node-sass-magic-importer/src/functions/parse-node-filters.ts
packages/node-sass-magic-importer/src/functions/parse-node-filters.ts
import { IFilterParser } from '../interfaces/IFilterParser'; export function parseNodeFiltersFactory(): IFilterParser { return (url: string) => { const nodeFiltersMatch = url .replace(/{.*?\/.*?\/.*?}/, '') .match(/\[([\s\S]*)\]/); if (!nodeFiltersMatch) { return []; } return nodeFiltersMatch[1].split(`,`) .map((x) => x.trim()) .filter((x) => x.length); }; }
import { IFilterParser } from '../interfaces/IFilterParser'; export function parseNodeFiltersFactory(): IFilterParser { return (url: string) => { const nodeFiltersMatch = url .replace(/{.*?\/.*?\/.*?}/, ``) .match(/\[([\s\S]*)\]/); if (!nodeFiltersMatch) { return []; } return nodeFiltersMatch[1].split(`,`) .map((x) => x.trim()) .filter((x) => x.length); }; }
Use backticks because coding style
Use backticks because coding style
TypeScript
mit
maoberlehner/node-sass-magic-importer,maoberlehner/node-sass-magic-importer,maoberlehner/node-sass-magic-importer
--- +++ @@ -3,7 +3,7 @@ export function parseNodeFiltersFactory(): IFilterParser { return (url: string) => { const nodeFiltersMatch = url - .replace(/{.*?\/.*?\/.*?}/, '') + .replace(/{.*?\/.*?\/.*?}/, ``) .match(/\[([\s\S]*)\]/); if (!nodeFiltersMatch) {
dfbf27e2958dd7770996cc4e75db9162484a0e48
NavigationReactNative/src/CoordinatorLayout.tsx
NavigationReactNative/src/CoordinatorLayout.tsx
import React from 'react' import { requireNativeComponent, Platform } from 'react-native'; import NavigationBar from './NavigationBar'; import SearchBar from './SearchBar'; class CoordinatorLayout extends React.Component<any, any> { private ref: React.RefObject<any>; constructor(props) { super(props); this.ref = React.createRef<any>(); } render() { var {overlap, children} = this.props; var {clonedChildren, searchBar} = React.Children.toArray(children) .reduce((val, child: any) => { if (child.type === NavigationBar) { var barChildren = React.Children.toArray(child.props.children); val.searchBar = barChildren.find(({type}: any) => type === SearchBar); child = React.cloneElement(child, child.props, barChildren.filter(c => c !== val.searchBar)) } val.clonedChildren.push(child); return val; }, {clonedChildren: [], searchBar: null}); return ( <> <NVCoordinatorLayout ref={this.ref} overlap={overlap} style={{flex: 1}} onTouchStart={e => { console.log(this.ref); }}> {clonedChildren} </NVCoordinatorLayout> {searchBar} </> ); } } const NVCoordinatorLayout = requireNativeComponent<any>('NVCoordinatorLayout', null) export default Platform.OS === 'android' ? CoordinatorLayout : ({children}) => children;
import React from 'react' import { requireNativeComponent, Platform } from 'react-native'; import NavigationBar from './NavigationBar'; import SearchBar from './SearchBar'; const CoordinatorLayout = ({overlap, children}) => { var {clonedChildren, searchBar} = React.Children.toArray(children) .reduce((val, child: any) => { if (child.type === NavigationBar) { var barChildren = React.Children.toArray(child.props.children); val.searchBar = barChildren.find(({type}: any) => type === SearchBar); child = React.cloneElement(child, child.props, barChildren.filter(c => c !== val.searchBar)) } val.clonedChildren.push(child); return val; }, {clonedChildren: [], searchBar: null}); return ( <> <NVCoordinatorLayout overlap={overlap} style={{flex: 1}}>{clonedChildren}</NVCoordinatorLayout> {searchBar} </> ); }; const NVCoordinatorLayout = requireNativeComponent<any>('NVCoordinatorLayout', null) export default Platform.OS === 'android' ? CoordinatorLayout : ({children}) => children;
Revert "Added ref to coodinator layout native component"
Revert "Added ref to coodinator layout native component" This reverts commit 56b709278641222adafa9459b4a27a23d56817d9.
TypeScript
apache-2.0
grahammendick/navigation,grahammendick/navigation,grahammendick/navigation,grahammendick/navigation,grahammendick/navigation,grahammendick/navigation,grahammendick/navigation
--- +++ @@ -3,40 +3,24 @@ import NavigationBar from './NavigationBar'; import SearchBar from './SearchBar'; -class CoordinatorLayout extends React.Component<any, any> { - private ref: React.RefObject<any>; - constructor(props) { - super(props); - this.ref = React.createRef<any>(); - } - render() { - var {overlap, children} = this.props; - var {clonedChildren, searchBar} = React.Children.toArray(children) - .reduce((val, child: any) => { - if (child.type === NavigationBar) { - var barChildren = React.Children.toArray(child.props.children); - val.searchBar = barChildren.find(({type}: any) => type === SearchBar); - child = React.cloneElement(child, child.props, barChildren.filter(c => c !== val.searchBar)) - } - val.clonedChildren.push(child); - return val; - }, {clonedChildren: [], searchBar: null}); - return ( - <> - <NVCoordinatorLayout - ref={this.ref} - overlap={overlap} - style={{flex: 1}} - onTouchStart={e => { - console.log(this.ref); - }}> - {clonedChildren} - </NVCoordinatorLayout> - {searchBar} - </> - ); - } -} +const CoordinatorLayout = ({overlap, children}) => { + var {clonedChildren, searchBar} = React.Children.toArray(children) + .reduce((val, child: any) => { + if (child.type === NavigationBar) { + var barChildren = React.Children.toArray(child.props.children); + val.searchBar = barChildren.find(({type}: any) => type === SearchBar); + child = React.cloneElement(child, child.props, barChildren.filter(c => c !== val.searchBar)) + } + val.clonedChildren.push(child); + return val; + }, {clonedChildren: [], searchBar: null}); + return ( + <> + <NVCoordinatorLayout overlap={overlap} style={{flex: 1}}>{clonedChildren}</NVCoordinatorLayout> + {searchBar} + </> + ); +}; const NVCoordinatorLayout = requireNativeComponent<any>('NVCoordinatorLayout', null) export default Platform.OS === 'android' ? CoordinatorLayout : ({children}) => children;
5f45aebad3d9143ee6d340394c81a76bee8c3bb5
client/download/download-dialog.tsx
client/download/download-dialog.tsx
import React from 'react' import styled from 'styled-components' import Dialog from '../material/dialog' import Download from './download' const StyledDialog = styled(Dialog)` max-width: 480px; ` interface DownloadDialogProps { dialogRef: React.Ref<any> onCancel?: () => void } export default function DownloadDialog(props: DownloadDialogProps) { return ( <StyledDialog onCancel={props.onCancel} showCloseButton={true} dialogRef={props.dialogRef}> <Download /> </StyledDialog> ) }
import React from 'react' import styled from 'styled-components' import Dialog from '../material/dialog' import Download from './download' const StyledDialog = styled(Dialog)` max-width: 480px; ` interface DownloadDialogProps { dialogRef: React.Ref<any> onCancel?: () => void } export default function DownloadDialog(props: DownloadDialogProps) { return ( <StyledDialog title='' onCancel={props.onCancel} showCloseButton={true} dialogRef={props.dialogRef}> <Download /> </StyledDialog> ) }
Fix DownloadDialog not passing a required prop.
Fix DownloadDialog not passing a required prop.
TypeScript
mit
ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery
--- +++ @@ -14,7 +14,11 @@ export default function DownloadDialog(props: DownloadDialogProps) { return ( - <StyledDialog onCancel={props.onCancel} showCloseButton={true} dialogRef={props.dialogRef}> + <StyledDialog + title='' + onCancel={props.onCancel} + showCloseButton={true} + dialogRef={props.dialogRef}> <Download /> </StyledDialog> )
a195bb2c2d1fd924c62d6d3e78d9bae628bc3fd5
src/SyntaxNodes/DescriptionListNode.ts
src/SyntaxNodes/DescriptionListNode.ts
import { OutlineSyntaxNode } from './OutlineSyntaxNode' import { InlineSyntaxNode } from './InlineSyntaxNode' import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer' import { OutlineSyntaxNodeContainer } from './OutlineSyntaxNodeContainer' export class DescriptionListNode implements OutlineSyntaxNode { constructor(public items: DescriptionListNode.Item[]) { } OUTLINE_SYNTAX_NODE(): void { } } export module DescriptionListNode { export class Item { constructor( public terms: DescriptionListNode.Item.Term[], public description: DescriptionListNode.Item.Description) { } } export module Item { export class Term implements InlineSyntaxNodeContainer { constructor(public children: InlineSyntaxNode[]) { } protected DESCRIPTION_LIST_ITEM_TERM(): void { } } export class Description implements OutlineSyntaxNodeContainer { constructor(public children: OutlineSyntaxNode[]) { } protected DESCRIPTION_LIST_ITEM_DESCRIPTION(): void { } } } }
import { OutlineSyntaxNode } from './OutlineSyntaxNode' import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer' import { OutlineSyntaxNodeContainer } from './OutlineSyntaxNodeContainer' export class DescriptionListNode implements OutlineSyntaxNode { constructor(public items: DescriptionListNode.Item[]) { } OUTLINE_SYNTAX_NODE(): void { } } export module DescriptionListNode { export class Item { constructor( public terms: DescriptionListNode.Item.Term[], public description: DescriptionListNode.Item.Description) { } } export module Item { export class Term extends InlineSyntaxNodeContainer { protected DESCRIPTION_LIST_ITEM_TERM(): void { } } export class Description implements OutlineSyntaxNodeContainer { constructor(public children: OutlineSyntaxNode[]) { } protected DESCRIPTION_LIST_ITEM_DESCRIPTION(): void { } } } }
Make description list term extend inline container
Make description list term extend inline container
TypeScript
mit
start/up,start/up
--- +++ @@ -1,5 +1,4 @@ import { OutlineSyntaxNode } from './OutlineSyntaxNode' -import { InlineSyntaxNode } from './InlineSyntaxNode' import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer' import { OutlineSyntaxNodeContainer } from './OutlineSyntaxNodeContainer' @@ -20,9 +19,7 @@ export module Item { - export class Term implements InlineSyntaxNodeContainer { - constructor(public children: InlineSyntaxNode[]) { } - + export class Term extends InlineSyntaxNodeContainer { protected DESCRIPTION_LIST_ITEM_TERM(): void { } }
3e8ecaadc487a8c1438b40c73cb4e4b2303a3609
src/index.ts
src/index.ts
import { Observable } from 'rxjs'; import { FilterOptions } from './collection'; export { Database } from './database'; export { Collection } from './collection'; export { Query } from './query'; /** * IDatabase * IDatabase contains a set of collections which stores documents. */ export interface IDatabase { collection( name ): ICollection; } /** * ICollection * ICollection contains a set of documents which can be manipulated * using collection methods. It uses a IPersistor to store data. */ export interface ICollection { find( filter: any, options: FilterOptions ): IQuery; insert( doc: any ): Observable<any>; update( filter: any, changes: any ): Observable<any[]>; remove( filter: any ): Observable<any[]>; } /** * IQuery * IQuery wraps the result of a collection find query. */ export interface IQuery { value(): Observable<any[]>; } /** * IPersistorFactory * IPersistorFactory creates a Persistors for collections to store data. */ export interface IPersistorFactory { create( collectionName: string ): IPersistor; } /** * IPersistor * IPersistor stores data in a permanent storage location. With default * options, data may get stored in IndexedDB, WebSQL or LocalStorage. * Each collection has it's own IPersistor instance to store data. */ export interface IPersistor { load(): Promise<any[]>; store( docs: any[]): Promise<any>; remove( docs: any[]): Promise<any>; }
import { Observable } from 'rxjs'; import { FilterOptions } from './collection'; export { Database } from './database'; export { Collection } from './collection'; export { Query } from './query'; /** * IDatabase * IDatabase contains a set of collections which stores documents. */ export interface IDatabase { collection( name ): ICollection; } /** * ICollection * ICollection contains a set of documents which can be manipulated * using collection methods. It uses a IPersistor to store data. */ export interface ICollection { find( filter: any, options?: FilterOptions ): IQuery; insert( doc: any ): Observable<any>; update( filter: any, changes: any ): Observable<any[]>; remove( filter: any ): Observable<any[]>; } /** * IQuery * IQuery wraps the result of a collection find query. */ export interface IQuery { value(): Observable<any[]>; } /** * IPersistorFactory * IPersistorFactory creates a Persistors for collections to store data. */ export interface IPersistorFactory { create( collectionName: string ): IPersistor; } /** * IPersistor * IPersistor stores data in a permanent storage location. With default * options, data may get stored in IndexedDB, WebSQL or LocalStorage. * Each collection has it's own IPersistor instance to store data. */ export interface IPersistor { load(): Promise<any[]>; store( docs: any[]): Promise<any>; remove( docs: any[]): Promise<any>; }
Make query options optional in ICollection interface
Make query options optional in ICollection interface
TypeScript
mit
Cinergix/rxdata,Cinergix/rxdata
--- +++ @@ -19,7 +19,7 @@ * using collection methods. It uses a IPersistor to store data. */ export interface ICollection { - find( filter: any, options: FilterOptions ): IQuery; + find( filter: any, options?: FilterOptions ): IQuery; insert( doc: any ): Observable<any>; update( filter: any, changes: any ): Observable<any[]>; remove( filter: any ): Observable<any[]>;
9ba350be219852397194600f803e368798c72a1b
src/index.ts
src/index.ts
import { ComponentDoc, parse, PropItem, PropItemType, Props, withCustomConfig, withDefaultConfig } from './parser'; export { parse, withDefaultConfig, withCustomConfig, ComponentDoc, Props, PropItem, PropItemType };
import { ComponentDoc, FileParser, parse, ParserOptions, PropItem, PropItemType, Props, withCompilerOptions, withCustomConfig, withDefaultConfig } from './parser'; export { parse, withCompilerOptions, withDefaultConfig, withCustomConfig, ComponentDoc, FileParser, ParserOptions, Props, PropItem, PropItemType };
Add additional exports to module entry point
Add additional exports to module entry point Added a few additional exports to the module's index to support use with react-docgen-typescript-loader. This allows this package to more easily be used as a peer dependency.
TypeScript
mit
pvasek/react-docgen-typescript,styleguidist/react-docgen-typescript
--- +++ @@ -1,18 +1,24 @@ import { ComponentDoc, + FileParser, parse, + ParserOptions, PropItem, PropItemType, Props, + withCompilerOptions, withCustomConfig, withDefaultConfig } from './parser'; export { parse, + withCompilerOptions, withDefaultConfig, withCustomConfig, ComponentDoc, + FileParser, + ParserOptions, Props, PropItem, PropItemType
ab4ade51a9db79776539be79fd31bcac85077057
src/store.ts
src/store.ts
import { createStore, compose, applyMiddleware } from 'redux'; import createSagaMiddleware from 'redux-saga'; import { autoRehydrate, persistStore } from 'redux-persist'; import { rootReducer } from './reducers'; import rootSaga from './sagas'; import { config } from './config'; const sagaMiddleware = createSagaMiddleware(); const store = createStore<any>( rootReducer, compose(applyMiddleware(sagaMiddleware), autoRehydrate(), config.devtools) ); sagaMiddleware.run(rootSaga); persistStore( store, config.reduxPersistSettings, config.reduxPersistErrorCallback ); export default store;
import { createStore, compose, applyMiddleware } from 'redux'; import createSagaMiddleware from 'redux-saga'; import { autoRehydrate, persistStore } from 'redux-persist'; import { rootReducer } from './reducers'; import rootSaga from './sagas'; import { config } from './config'; const sagaMiddleware = createSagaMiddleware(); const store = createStore( rootReducer, compose(applyMiddleware(sagaMiddleware), autoRehydrate(), config.devtools) ); sagaMiddleware.run(rootSaga); persistStore( store, config.reduxPersistSettings, config.reduxPersistErrorCallback ); export default store;
Remove unnecessary type argument to createStore.
Remove unnecessary type argument to createStore.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -7,7 +7,7 @@ const sagaMiddleware = createSagaMiddleware(); -const store = createStore<any>( +const store = createStore( rootReducer, compose(applyMiddleware(sagaMiddleware), autoRehydrate(), config.devtools) );
9507092f8f31fe45094eba8cfc34e3e3a35dcae4
e2e/common/common.ts
e2e/common/common.ts
const data = require('../data/users.json').users; import { ElementFinder } from 'protractor'; export class User { alias: string; description: string; username: string; password: string; constructor(alias: string, description: string) { this.alias = alias; this.description = description; const envUsername = process.env[`IPAAS_${alias.toUpperCase()}_USERNAME`] || null; const envPassword = process.env[`IPAAS_${alias.toUpperCase()}_PASSWORD`] || null; if (envUsername === null || envPassword === null) { this.username = data[alias].username; this.password = data[alias].password; } else { this.username = envUsername; this.password = envPassword; } } toString(): string { return `User{alias=${this.alias}, login=${this.username}}`; } } /** * Represents ui component that has it's angular selector. */ export interface IPaaSComponent { rootElement(): ElementFinder; }
import { ElementFinder } from 'protractor'; export class User { alias: string; description: string; username: string; password: string; constructor(alias: string, description: string) { this.alias = alias; this.description = description; const envUsername = process.env[`IPAAS_${alias.toUpperCase()}_USERNAME`] || null; const envPassword = process.env[`IPAAS_${alias.toUpperCase()}_PASSWORD`] || null; if (envUsername === null || envPassword === null) { const data = require('../data/users.json').users; this.username = data[alias].username; this.password = data[alias].password; } else { this.username = envUsername; this.password = envPassword; } } toString(): string { return `User{alias=${this.alias}, login=${this.username}}`; } } /** * Represents ui component that has it's angular selector. */ export interface IPaaSComponent { rootElement(): ElementFinder; }
Fix credentials loading from json
Fix credentials loading from json
TypeScript
apache-2.0
kahboom/ipaas-client,kahboom/ipaas-client,kahboom/ipaas-client,kahboom/ipaas-client
--- +++ @@ -1,4 +1,3 @@ -const data = require('../data/users.json').users; import { ElementFinder } from 'protractor'; export class User { @@ -16,6 +15,7 @@ const envPassword = process.env[`IPAAS_${alias.toUpperCase()}_PASSWORD`] || null; if (envUsername === null || envPassword === null) { + const data = require('../data/users.json').users; this.username = data[alias].username; this.password = data[alias].password; } else {
ded00a0b4b3d5487d1b8b11344a9a4d723d78710
app/common/angular-utility.ts
app/common/angular-utility.ts
/** * @author Thomas Kleinke */ export module AngularUtility { export async function refresh() { await new Promise(resolve => setTimeout(async () => resolve(), 1)); } }
/** * @author Thomas Kleinke */ export module AngularUtility { export async function refresh() { await new Promise(resolve => setTimeout(async () => resolve(), 100)); } }
Increase timeout value in AngularUtility.refresh
Increase timeout value in AngularUtility.refresh
TypeScript
apache-2.0
codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client
--- +++ @@ -5,6 +5,6 @@ export async function refresh() { - await new Promise(resolve => setTimeout(async () => resolve(), 1)); + await new Promise(resolve => setTimeout(async () => resolve(), 100)); } }
856aa57f59b7439ff1a5bc15b8e07abdaa90cc7f
index.d.ts
index.d.ts
export = scrollama; declare function scrollama(): scrollama.ScrollamaInstance; declare namespace scrollama { export type DecimalType = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; export type ScrollamaOptions = { step: HTMLElement | string; progress?: boolean; offset?: DecimalType; threshold?: 1 | 2 | 3 | 4; order?: boolean; once?: boolean; debug?: boolean; }; export type ProgressCallbackResponse = { element: HTMLElement; index: number; progress: DecimalType; }; export type CallbackResponse = { element: HTMLElement; index: number; direction: "up" | "down"; }; export type StepCallback = (response: CallbackResponse) => void; export type StepProgressCallback = ( response: ProgressCallbackResponse ) => void; export type ScrollamaInstance = { setup: (options: ScrollamaOptions) => ScrollamaInstance; onStepEnter: (callback: StepCallback) => ScrollamaInstance; onStepExit: (callback: StepCallback) => ScrollamaInstance; onStepProgress: (callback: StepProgressCallback) => ScrollamaInstance; resize: () => ScrollamaInstance; enable: () => ScrollamaInstance; disable: () => ScrollamaInstance; destroy: () => void; offsetTrigger: (value: [number, number]) => void; } }
export = scrollama; declare function scrollama(): scrollama.ScrollamaInstance; declare namespace scrollama { export type DecimalType = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; export type ScrollamaOptions = { step: HTMLElement[] | string; progress?: boolean; offset?: DecimalType; threshold?: 1 | 2 | 3 | 4; order?: boolean; once?: boolean; debug?: boolean; }; export type ProgressCallbackResponse = { element: HTMLElement; index: number; progress: DecimalType; }; export type CallbackResponse = { element: HTMLElement; index: number; direction: "up" | "down"; }; export type StepCallback = (response: CallbackResponse) => void; export type StepProgressCallback = ( response: ProgressCallbackResponse ) => void; export type ScrollamaInstance = { setup: (options: ScrollamaOptions) => ScrollamaInstance; onStepEnter: (callback: StepCallback) => ScrollamaInstance; onStepExit: (callback: StepCallback) => ScrollamaInstance; onStepProgress: (callback: StepProgressCallback) => ScrollamaInstance; resize: () => ScrollamaInstance; enable: () => ScrollamaInstance; disable: () => ScrollamaInstance; destroy: () => void; offsetTrigger: (value: [number, number]) => void; } }
Change step type to array of elements
Change step type to array of elements As per the documentation: "`step` (string): Selector (or array of elements)"
TypeScript
mit
russellgoldenberg/scrollama,russellgoldenberg/scrollama
--- +++ @@ -6,7 +6,7 @@ export type DecimalType = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; export type ScrollamaOptions = { - step: HTMLElement | string; + step: HTMLElement[] | string; progress?: boolean; offset?: DecimalType; threshold?: 1 | 2 | 3 | 4;
84aaf5f8d3e1e954f3286c36241c4dad81170017
src/collect/structures/array-from.ts
src/collect/structures/array-from.ts
export function arrayFrom(attrs: NamedNodeMap): readonly Attr[]; export function arrayFrom<N extends Node>(nodeListOf: NodeListOf<N>): readonly N[]; export function arrayFrom(nodeListOf: HTMLCollection): readonly Element[]; export function arrayFrom( collection: NodeListOf<Node>|HTMLCollection|NamedNodeMap, ): ReadonlyArray<Node|Element> { const array: Array<Node|Element> = []; for (let i = 0; i < collection.length; i++) { const item = collection.item(i); if (item) { array.push(item); } } return array; }
export function arrayFrom(attrs: NamedNodeMap): readonly Attr[]; export function arrayFrom<N extends Node>(nodeListOf: NodeListOf<N>): readonly N[]; export function arrayFrom(filelist: FileList): readonly File[]; export function arrayFrom(nodeListOf: HTMLCollection): readonly Element[]; export function arrayFrom( collection: NodeListOf<Node>|HTMLCollection|NamedNodeMap|FileList, ): ReadonlyArray<Node|Element|File> { const array: Array<Node|Element|File> = []; for (let i = 0; i < collection.length; i++) { const item = collection.item(i); if (item) { array.push(item); } } return array; }
Make arrayFrom support file list
Make arrayFrom support file list
TypeScript
mit
garysoed/gs-tools,garysoed/gs-tools,garysoed/gs-tools,garysoed/gs-tools
--- +++ @@ -1,10 +1,11 @@ export function arrayFrom(attrs: NamedNodeMap): readonly Attr[]; export function arrayFrom<N extends Node>(nodeListOf: NodeListOf<N>): readonly N[]; +export function arrayFrom(filelist: FileList): readonly File[]; export function arrayFrom(nodeListOf: HTMLCollection): readonly Element[]; export function arrayFrom( - collection: NodeListOf<Node>|HTMLCollection|NamedNodeMap, -): ReadonlyArray<Node|Element> { - const array: Array<Node|Element> = []; + collection: NodeListOf<Node>|HTMLCollection|NamedNodeMap|FileList, +): ReadonlyArray<Node|Element|File> { + const array: Array<Node|Element|File> = []; for (let i = 0; i < collection.length; i++) { const item = collection.item(i); if (item) {
b53b76bd3ab0e5e0c7fe2f4be1bd54ff92eb0860
src/parent-symbol.ts
src/parent-symbol.ts
const parentSymbol: symbol = Symbol('parent'); export default parentSymbol;
declare var global: any; let root: any; if (typeof self !== 'undefined') { root = self; } else if (typeof window !== 'undefined') { root = window; } else if (typeof global !== 'undefined') { root = global; } else { root = Function('return this')(); } const Symbol = root.Symbol; let parentSymbol: symbol; if (typeof Symbol === 'function') { parentSymbol = Symbol('parent'); } else { parentSymbol = '@@snabbdom-selector-parent' as any; } export default parentSymbol;
Add a string-based fallback when Symbol is not available
Add a string-based fallback when Symbol is not available Fixes issue #22
TypeScript
mit
TylorS/snabbdom-selector
--- +++ @@ -1,3 +1,23 @@ -const parentSymbol: symbol = Symbol('parent'); +declare var global: any; + +let root: any; +if (typeof self !== 'undefined') { + root = self; +} else if (typeof window !== 'undefined') { + root = window; +} else if (typeof global !== 'undefined') { + root = global; +} else { + root = Function('return this')(); +} + +const Symbol = root.Symbol; + +let parentSymbol: symbol; +if (typeof Symbol === 'function') { + parentSymbol = Symbol('parent'); +} else { + parentSymbol = '@@snabbdom-selector-parent' as any; +} export default parentSymbol;
490e4e1b2a27664e6609eaf6715896eb2caffd49
frontend/map.component.ts
frontend/map.component.ts
import { Component, OnInit } from "@angular/core"; @Component({ selector: "map-app", templateUrl: "map.component.html" }) export class MapComponent implements OnInit { public tweets: Array<Object>; constructor() { this.tweets = [ { "author": "Foo", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt u..." }, { "author": "Bar", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore m..." }, { "author": "Baz", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,..." } ]; } ngOnInit() { const latlng = new google.maps.LatLng(52.3731, 4.8922); const mapOptions = { center: latlng, scrollWheel: false, zoom: 13 }; const marker = new google.maps.Marker({ position: latlng, url: "/", animation: google.maps.Animation.DROP }); const map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); marker.setMap(map); } }
import { Component, OnInit } from "@angular/core"; @Component({ selector: "map-app", templateUrl: "map.component.html" }) export class MapComponent implements OnInit { public tweets: Array<Object>; constructor() { this.tweets = [ { "author": "Foo", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt u..." }, { "author": "Bar", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore m..." }, { "author": "Baz", "text": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,..." } ]; } ngOnInit() { const latlng = new google.maps.LatLng(52.3731, 4.8922); const mapOptions = { center: latlng, scrollWheel: false, zoom: 13 }; const marker = new google.maps.Marker({ position: latlng, animation: google.maps.Animation.DROP }); const map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); marker.setMap(map); } }
Remove url from Google Maps marker.
Remove url from Google Maps marker.
TypeScript
mit
Strassengezwitscher/Strassengezwitscher,Strassengezwitscher/Strassengezwitscher,Strassengezwitscher/Strassengezwitscher,Strassengezwitscher/Strassengezwitscher,Strassengezwitscher/Strassengezwitscher
--- +++ @@ -35,7 +35,6 @@ const marker = new google.maps.Marker({ position: latlng, - url: "/", animation: google.maps.Animation.DROP });
56a4048571764fea35512d0bdae01a5ab19caed8
src/third_party/tsetse/error_code.ts
src/third_party/tsetse/error_code.ts
/** * Error codes for tsetse checks. * * Start with 21222 and increase linearly. * The intent is for these codes to be fixed, so that tsetse users can * search for them in user forums and other media. */ export enum ErrorCode { CHECK_RETURN_VALUE = 21222, EQUALS_NAN = 21223, BAN_EXPECT_TRUTHY_PROMISE = 21224, MUST_USE_PROMISES = 21225, BAN_PROMISE_AS_CONDITION = 21226, PROPERTY_RENAMING_SAFE = 21227, CONFORMANCE_PATTERN = 21228, BAN_MUTABLE_EXPORTS = 21229, BAN_STRING_INITIALIZED_SETS = 21230, }
/** * Error codes for tsetse checks. * * Start with 21222 and increase linearly. * The intent is for these codes to be fixed, so that tsetse users can * search for them in user forums and other media. */ export enum ErrorCode { CHECK_RETURN_VALUE = 21222, EQUALS_NAN = 21223, BAN_EXPECT_TRUTHY_PROMISE = 21224, MUST_USE_PROMISES = 21225, BAN_PROMISE_AS_CONDITION = 21226, PROPERTY_RENAMING_SAFE = 21227, CONFORMANCE_PATTERN = 21228, BAN_MUTABLE_EXPORTS = 21229, BAN_STRING_INITIALIZED_SETS = 21230, MUST_TYPE_ASSERT_JSON_PARSE = 21231, }
Add rule which requires the user to cast the result of JSON.parse.
Add rule which requires the user to cast the result of JSON.parse. PiperOrigin-RevId: 322620340
TypeScript
apache-2.0
google/tsec,google/tsec
--- +++ @@ -15,4 +15,5 @@ CONFORMANCE_PATTERN = 21228, BAN_MUTABLE_EXPORTS = 21229, BAN_STRING_INITIALIZED_SETS = 21230, + MUST_TYPE_ASSERT_JSON_PARSE = 21231, }
ab0494f592cd5fbd4d960991278190020ab59b5b
src/utils/string.ts
src/utils/string.ts
/** * Indicates if the given string ends with the given suffix * * @export * @param {string} str * @param {string} suffix * @returns {boolean} */ export function strEndsWith(str: string, suffix: string): boolean { return str.indexOf(suffix, str.length - suffix.length) !== -1; } /** * Replaces all occurrences of the given string with the specified replacement in the target * string * * @param str * @param find * @param replace * @since 0.12 */ export function strReplaceAll(str: string, find: string, replace: string): string { return str.split(find).join(replace); } /** * Empty string constant */ export const STR_EMPTY = ""; /** * Indicates if the given string is null or empty * * @export * @param {(string | null | undefined)} str * @returns {boolean} */ export function strIsNullOrEmpty(str: string | null | undefined): boolean { return null == str || "" === str; } /** * Returns a trimmed version of the given string * * @param str The string to trim * @since 0.12.5 */ export function strTrim(str: string): string { if (!String.prototype.trim) { return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } return str.trim(); }
/** * Indicates if the given string ends with the given suffix * * @export * @param {string} str * @param {string} suffix * @returns {boolean} */ export function strEndsWith(str: string, suffix: string): boolean { return str.indexOf(suffix, str.length - suffix.length) !== -1; } /** * Replaces all occurrences of the given string with the specified replacement in the target * string * * @param str * @param find * @param replace * @since 0.12 */ export function strReplaceAll(str: string, find: string, replace: string): string { return str.split(find).join(replace); } /** * Empty string constant */ export const STR_EMPTY = ""; /** * Indicates if the given string is null or empty * * @export * @param {(string | null | undefined)} str * @returns {boolean} */ export function strIsNullOrEmpty(str: string | null | undefined): str is null | undefined { return null == str || "" === str; } /** * Returns a trimmed version of the given string * * @param str The string to trim * @since 0.12.5 */ export function strTrim(str: string): string { if (!String.prototype.trim) { return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } return str.trim(); }
Change strIsNullOrEmpty so that it works as a proper type-guard
Change strIsNullOrEmpty so that it works as a proper type-guard
TypeScript
mit
jumpinjackie/mapguide-react-layout,jumpinjackie/mapguide-react-layout,jumpinjackie/mapguide-react-layout,jumpinjackie/mapguide-react-layout,jumpinjackie/mapguide-react-layout
--- +++ @@ -35,7 +35,7 @@ * @param {(string | null | undefined)} str * @returns {boolean} */ -export function strIsNullOrEmpty(str: string | null | undefined): boolean { +export function strIsNullOrEmpty(str: string | null | undefined): str is null | undefined { return null == str || "" === str; }
aa6ecde922a6e0fec5f7a28d5911d8bc6dad289f
src/model/literature.ts
src/model/literature.ts
/** * @author Thomas Kleinke */ export interface Literature { quotation: string; zenonId?: string; } export module Literature { export function generateLabel(literature: Literature, getTranslation: (key: string) => string): string { return literature.quotation + (literature.zenonId ? ' (' + getTranslation('zenonId') + ': ' + literature.zenonId + ')' : ''); } }
/** * @author Thomas Kleinke */ export interface Literature { quotation: string; zenonId?: string; } export module Literature { export function generateLabel(literature: Literature, getTranslation: (key: string) => string): string { return literature.quotation + (literature.zenonId ? ' (' + getTranslation('zenonId') + ': ' + literature.zenonId + ')' : ''); } export function isValid(literature: Literature): boolean { return literature.quotation !== undefined && literature.quotation.length > 0; } }
Add basic validation function for Literature
Add basic validation function for Literature
TypeScript
apache-2.0
dainst/idai-components-2,dainst/idai-components-2,dainst/idai-components-2
--- +++ @@ -18,4 +18,10 @@ + ': ' + literature.zenonId + ')' : ''); } + + + export function isValid(literature: Literature): boolean { + + return literature.quotation !== undefined && literature.quotation.length > 0; + } }
5840bf64e92d291cc037830c56edc90a67f1f1a7
test/test_runner.ts
test/test_runner.ts
import * as fs from "fs"; import { MultiReporter } from "./mocha_multi_reporter"; import testRunner = require("vscode/lib/testrunner"); const onExit = require("signal-exit"); // tslint:disable-line:no-var-requires // Ensure we write coverage on exit. declare const __coverage__: any; onExit(() => { // Unhandled exceptions here seem to hang, but console.error+process.exit do not! ¯\_(ツ)_/¯ try { if (typeof __coverage__ !== "undefined" && typeof process.env.COVERAGE_OUTPUT !== "undefined" && process.env.COVERAGE_OUTPUT) { fs.writeFileSync(process.env.COVERAGE_OUTPUT, JSON.stringify(__coverage__)); } } catch (e) { console.error(e); process.exit(1); } }); testRunner.configure({ forbidOnly: !!process.env.MOCHA_FORBID_ONLY, reporter: MultiReporter, reporterOptions: { output: process.env.TEST_XML_OUTPUT, }, slow: 10000, // increased threshold before marking a test as slow timeout: 60000, // increased timeout because starting up Code, Analyzer, etc. is slooow ui: "bdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) useColors: true, // colored output from test results } as MochaSetupOptions & { reporterOptions: any }); module.exports = testRunner;
console.log("Starting test runner..."); import * as fs from "fs"; import { MultiReporter } from "./mocha_multi_reporter"; import testRunner = require("vscode/lib/testrunner"); const onExit = require("signal-exit"); // tslint:disable-line:no-var-requires // Ensure we write coverage on exit. declare const __coverage__: any; onExit(() => { // Unhandled exceptions here seem to hang, but console.error+process.exit do not! ¯\_(ツ)_/¯ try { if (typeof __coverage__ !== "undefined" && typeof process.env.COVERAGE_OUTPUT !== "undefined" && process.env.COVERAGE_OUTPUT) { fs.writeFileSync(process.env.COVERAGE_OUTPUT, JSON.stringify(__coverage__)); } } catch (e) { console.error(e); process.exit(1); } }); testRunner.configure({ forbidOnly: !!process.env.MOCHA_FORBID_ONLY, reporter: MultiReporter, reporterOptions: { output: process.env.TEST_XML_OUTPUT, }, slow: 10000, // increased threshold before marking a test as slow timeout: 60000, // increased timeout because starting up Code, Analyzer, etc. is slooow ui: "bdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.) useColors: true, // colored output from test results } as MochaSetupOptions & { reporterOptions: any }); module.exports = testRunner;
Add log at vert start of tests
Add log at vert start of tests Travis Linux seems to be hanging; not clear if it's getting this far..
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -1,3 +1,5 @@ +console.log("Starting test runner..."); + import * as fs from "fs"; import { MultiReporter } from "./mocha_multi_reporter"; import testRunner = require("vscode/lib/testrunner");
a6f1aca3eef9b3d7402126bf020e965b286c7405
src/pages/item/index.ts
src/pages/item/index.ts
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class Item { private readonly router: Router; private readonly api: HackerNewsApi; private id: number; private item: any; private comments: any[]; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { window.scrollTo(0, 0); if (params.id === undefined || isNaN(params.id) || params.id < 0) { this.router.navigateToRoute('news'); return; } this.id = params.id; this.comments = []; this.item = await this.api.fetchItem(this.id); if (this.item.kids !== undefined && this.item.kids.length >= 1) { this.comments = await this.api.fetchItems(this.item.kids); } } }
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class Item { id: number; item: any; comments: any[]; private readonly router: Router; private readonly api: HackerNewsApi; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { window.scrollTo(0, 0); if (params.id === undefined || isNaN(params.id) || params.id < 0) { this.router.navigateToRoute('news'); return; } this.id = params.id; this.comments = []; this.item = await this.api.fetchItem(this.id); if (this.item.kids !== undefined && this.item.kids.length >= 1) { this.comments = await this.api.fetchItems(this.item.kids); } } }
Correct visibility of variables in Item view-model
Correct visibility of variables in Item view-model
TypeScript
isc
michaelbull/aurelia-hacker-news,michaelbull/aurelia-hacker-news,MikeBull94/aurelia-hacker-news,MikeBull94/aurelia-hacker-news,michaelbull/aurelia-hacker-news
--- +++ @@ -4,12 +4,12 @@ @inject(Router, HackerNewsApi) export class Item { + id: number; + item: any; + comments: any[]; + private readonly router: Router; private readonly api: HackerNewsApi; - - private id: number; - private item: any; - private comments: any[]; constructor(router: Router, api: HackerNewsApi) { this.router = router;
23733265bb7a7e082f7af90f87a7672c353f08e2
modules/api/index.ts
modules/api/index.ts
import qs from 'query-string' import {IS_PRODUCTION} from '@frogpond/constants' let root: string export function setApiRoot(url: string): void { root = url } export const API = (path: string, query: unknown = null): string => { if (!IS_PRODUCTION) { if (!path.startsWith('/')) { throw new Error('invalid path requested from the api!') } } let url = root + path if (query) { url += `?${qs.stringify(query)}` } return url }
import qs from 'query-string' import {IS_PRODUCTION} from '@frogpond/constants' let root: string export function setApiRoot(url: string): void { root = url } export const API = (path: string, query?: Record<string, any>): string => { if (!IS_PRODUCTION) { if (!path.startsWith('/')) { throw new Error('invalid path requested from the api!') } } let url = root + path if (query) { url += `?${qs.stringify(query)}` } return url }
Fix API(string, Record<string, any>) signature
m/api: Fix API(string, Record<string, any>) signature While the previous type was technically correct, this commit definitely makes the types we expect more explicit. Something Record-y with string keys _can_ be passed as the second parameter. If it's not passed, then it'd be undefined, not null. Signed-off-by: Kristofer Rye <[email protected]>
TypeScript
agpl-3.0
StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native
--- +++ @@ -8,7 +8,7 @@ root = url } -export const API = (path: string, query: unknown = null): string => { +export const API = (path: string, query?: Record<string, any>): string => { if (!IS_PRODUCTION) { if (!path.startsWith('/')) { throw new Error('invalid path requested from the api!')
db7bd4efda0076eec0e27c0b5058063c269ed193
addons/google-analytics/src/register.ts
addons/google-analytics/src/register.ts
import { window } from 'global'; import { addons } from '@storybook/addons'; import { STORY_CHANGED, STORY_ERRORED, STORY_MISSING } from '@storybook/core-events'; import ReactGA from 'react-ga'; addons.register('storybook/google-analytics', api => { ReactGA.initialize(window.STORYBOOK_GA_ID); api.on(STORY_CHANGED, () => { const { url } = api.getUrlState(); ReactGA.pageview(url); }); api.on(STORY_ERRORED, ({ description }: { description: string }) => { ReactGA.exception({ description, fatal: true, }); }); api.on(STORY_MISSING, (id: string) => { ReactGA.exception({ description: `attempted to render ${id}, but it is missing`, fatal: false, }); }); });
import { window } from 'global'; import { addons } from '@storybook/addons'; import { STORY_CHANGED, STORY_ERRORED, STORY_MISSING } from '@storybook/core-events'; import ReactGA from 'react-ga'; addons.register('storybook/google-analytics', api => { ReactGA.initialize(window.STORYBOOK_GA_ID); api.on(STORY_CHANGED, () => { const { path } = api.getUrlState(); ReactGA.pageview(path); }); api.on(STORY_ERRORED, ({ description }: { description: string }) => { ReactGA.exception({ description, fatal: true, }); }); api.on(STORY_MISSING, (id: string) => { ReactGA.exception({ description: `attempted to render ${id}, but it is missing`, fatal: false, }); }); });
Fix 'path is required in .pageview()' in GA addon
Fix 'path is required in .pageview()' in GA addon See https://github.com/storybookjs/storybook/issues/6012
TypeScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,kadirahq/react-storybook
--- +++ @@ -8,8 +8,8 @@ ReactGA.initialize(window.STORYBOOK_GA_ID); api.on(STORY_CHANGED, () => { - const { url } = api.getUrlState(); - ReactGA.pageview(url); + const { path } = api.getUrlState(); + ReactGA.pageview(path); }); api.on(STORY_ERRORED, ({ description }: { description: string }) => { ReactGA.exception({
b5fb2f105aef9f4887641cc9f55030f549df35de
src/shared/vscode/utils.ts
src/shared/vscode/utils.ts
import { commands, Uri } from "vscode"; import { forceWindowsDriveLetterToUppercase } from "../utils"; export function fsPath(uri: Uri | string) { // tslint:disable-next-line:disallow-fspath return forceWindowsDriveLetterToUppercase(uri instanceof Uri ? uri.fsPath : uri); } export function openInBrowser(url: string) { // Don't use vs.env.openExternal unless // https://github.com/Microsoft/vscode/issues/69608 // is fixed, as it complicates testing. commands.executeCommand("vscode.open", Uri.parse(url)); }
import { commands, ExtensionKind, extensions, Uri } from "vscode"; import { dartCodeExtensionIdentifier } from "../constants"; import { forceWindowsDriveLetterToUppercase } from "../utils"; const dartExtension = extensions.getExtension(dartCodeExtensionIdentifier); // The extension kind is declared as Workspace, but VS Code will return UI in the // case that there is no remote extension host. export const isRunningLocally = dartExtension.extensionKind === ExtensionKind.UI; export function fsPath(uri: Uri | string) { // tslint:disable-next-line:disallow-fspath return forceWindowsDriveLetterToUppercase(uri instanceof Uri ? uri.fsPath : uri); } export function openInBrowser(url: string) { // Don't use vs.env.openExternal unless // https://github.com/Microsoft/vscode/issues/69608 // is fixed, as it complicates testing. commands.executeCommand("vscode.open", Uri.parse(url)); }
Add the ability to detect when running remotely
Add the ability to detect when running remotely See #1738.
TypeScript
mit
Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code
--- +++ @@ -1,5 +1,11 @@ -import { commands, Uri } from "vscode"; +import { commands, ExtensionKind, extensions, Uri } from "vscode"; +import { dartCodeExtensionIdentifier } from "../constants"; import { forceWindowsDriveLetterToUppercase } from "../utils"; + +const dartExtension = extensions.getExtension(dartCodeExtensionIdentifier); +// The extension kind is declared as Workspace, but VS Code will return UI in the +// case that there is no remote extension host. +export const isRunningLocally = dartExtension.extensionKind === ExtensionKind.UI; export function fsPath(uri: Uri | string) { // tslint:disable-next-line:disallow-fspath
665e692ab7ebd0db2969b3cac6ae97dac1306ea4
app/src/services/http-json-service.ts
app/src/services/http-json-service.ts
export default class HttpJsonService { private basePath: string; constructor(basePath: string) { this.basePath = basePath; } public get(url: string): Promise<any> { return this.fetch("GET", url, null); } public post(url: string, body: any): Promise<any> { return this.fetch("POST", url, body); } public put(url: string, body: any): Promise<any> { return this.fetch("PUT", url, body); } public fetch(method: string, url: string, body: any): Promise<any> { url = this.basePath + url; let requestInit: any = { method: method, headers: { "Content-Type": "application/json", }, credentials: "same-origin", }; if ((method !== "HEAD") && (method !== "GET")) { requestInit.body = JSON.stringify(body); } return ((window as any).fetch(url, requestInit) .then(this.checkStatus) .then(this.parseJson, this.parseError)); } private checkStatus(response: any): Promise<any> { if (response.status >= 400) { return Promise.reject(response); } return response; } private parseJson(response: any): Promise<any> { return response.json(); } private parseError(response: any): Promise<any> { return response.json().then((data: any) => Promise.reject(data)); } }
export default class HttpJsonService { private basePath: string; constructor(basePath: string) { this.basePath = basePath; } public get(url: string): Promise<any> { return this.fetch("GET", url, null); } public post(url: string, body: any): Promise<any> { return this.fetch("POST", url, body); } public put(url: string, body: any): Promise<any> { return this.fetch("PUT", url, body); } public fetch(method: string, url: string, body: any): Promise<any> { url = this.basePath + url; let requestInit: any = { method: method, headers: { "Content-Type": "application/json", }, credentials: "same-origin", }; if ((method !== "HEAD") && (method !== "GET")) { requestInit.body = JSON.stringify(body); } return ((window as any).fetch(url, requestInit) .then(this.checkStatus) .then(this.parseJson, this.parseError)); } private checkStatus(response: any): Promise<any> { if (response.status >= 400) { return Promise.reject(response); } return response; } private parseJson(response: any): Promise<any> { if (response.status === 204) { return Promise.resolve(null); } return response.json(); } private parseError(response: any): Promise<any> { return response.json().then((data: any) => Promise.reject(data)); } }
Fix httpJsonService on 204 responses
Fix httpJsonService on 204 responses
TypeScript
mit
DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website,DiscoViking/website
--- +++ @@ -46,6 +46,9 @@ } private parseJson(response: any): Promise<any> { + if (response.status === 204) { + return Promise.resolve(null); + } return response.json(); }
5ab28dbbeec853606367a7611acda37e9a078e32
src/parser/util.ts
src/parser/util.ts
import * as path from 'path'; declare var atom: any; function parseFilepath(s: string): string { if (s) { // remove newlines s = s.replace('\\n', ''); // sanitize with path.parse first const parsed = path.parse(s); // join it back and replace Windows' stupid backslash with slash let joined = path.join(parsed.dir, parsed.base).split(path.sep).join('/'); // fuck Windows Bidi control character if (joined.charCodeAt(0) === 8234) joined = joined.substr(1); return joined.trim(); } else { return ''; } } function parseInputContent(data: string): string { let expr = data.toString() .replace(/\\/g, '\\\\') .replace(/\\/g, '\\\\') // \ => \\ .replace(/\"/g, '\"') // " => \" .replace(/\n/g, '\\n'); // newline => \\n // trim spaces if (atom.config.get('agda-mode.trimSpaces')) return expr.trim(); else return expr; } export { parseInputContent, parseFilepath }
import * as path from 'path'; declare var atom: any; function parseFilepath(s: string): string { if (s) { // remove newlines s = s.replace('\n', ''); // sanitize with path.parse first const parsed = path.parse(s); // join it back and replace Windows' stupid backslash with slash let joined = path.join(parsed.dir, parsed.base).split(path.sep).join('/'); // fuck Windows Bidi control character if (joined.charCodeAt(0) === 8234) joined = joined.substr(1); return joined.trim(); } else { return ''; } } function parseInputContent(data: string): string { let expr = data.toString() .replace(/\\/g, '\\\\') .replace(/\\/g, '\\\\') // \ => \\ .replace(/\"/g, '\"') // " => \" .replace(/\n/g, '\\n'); // newline => \\n // trim spaces if (atom.config.get('agda-mode.trimSpaces')) return expr.trim(); else return expr; } export { parseInputContent, parseFilepath }
Fix path parsing with valid \n
Fix path parsing with valid \n
TypeScript
mit
banacorn/agda-mode,banacorn/agda-mode,banacorn/agda-mode
--- +++ @@ -5,7 +5,7 @@ function parseFilepath(s: string): string { if (s) { // remove newlines - s = s.replace('\\n', ''); + s = s.replace('\n', ''); // sanitize with path.parse first const parsed = path.parse(s); // join it back and replace Windows' stupid backslash with slash
f0e3acbe5165a0f2366df87b3d403249ef1d7c3b
src/renderer/index.ts
src/renderer/index.ts
///<reference path='user_settings_dialog.ts'/> var remote = require('remote'); var fs = require('fs'); var path = require('path'); var settings = require('../browser/user_settings') var MainController = require('./main_controller'); var NavigatorController = require('./navigator_controller'); var ngModule = angular.module('adversaria', []); ngModule.controller('MainController', ['$scope', MainController]); ngModule.controller('NavigatorController', ['$scope', NavigatorController]); ngModule.directive('mdPreview', () => { return ($scope, $elem, $attrs) => { $scope.$watch($attrs.mdPreview, (source) => { $elem.html(source); }); }; }); window.onload = () => { var document_path = settings.loadDocumentPath(); if (!document_path) { UserSettingsDialog.show(); } var scope: any = angular.element(document.getElementById('navigator')).scope(); scope.setRootDirectory(document_path); }
///<reference path='user_settings_dialog.ts'/> var remote = require('remote'); var fs = require('fs'); var path = require('path'); var settings = require('../browser/user_settings') var externalEditor = require('./../browser/external_editor'); var MainController = require('./main_controller'); var NavigatorController = require('./navigator_controller'); var ngModule = angular.module('adversaria', []); ngModule.controller('MainController', ['$scope', MainController]); ngModule.controller('NavigatorController', ['$scope', NavigatorController]); ngModule.directive('mdPreview', () => { return ($scope, $elem, $attrs) => { $scope.$watch($attrs.mdPreview, (source) => { $elem.html(source); }); }; }); window.onload = () => { var document_path = settings.loadDocumentPath(); if (!document_path) { UserSettingsDialog.show(); } var scope: any = angular.element(document.getElementById('navigator')).scope(); scope.setRootDirectory(document_path); } window.onkeypress = (e) => { if (e.keyCode == 101) { // e var scope = <any>angular.element(document.body).scope(); var path = scope.current_note.path; console.debug(scope.current_note); if (scope.current_note.path.length == 0) { return true; } externalEditor.open(path) } }
Add shortcut key to edit current file
Add shortcut key to edit current file
TypeScript
mit
ueokande/adversaria,ueokande/adversaria,ueokande/adversaria
--- +++ @@ -4,9 +4,9 @@ var fs = require('fs'); var path = require('path'); var settings = require('../browser/user_settings') +var externalEditor = require('./../browser/external_editor'); var MainController = require('./main_controller'); var NavigatorController = require('./navigator_controller'); - var ngModule = angular.module('adversaria', []); ngModule.controller('MainController', ['$scope', MainController]); @@ -28,3 +28,15 @@ var scope: any = angular.element(document.getElementById('navigator')).scope(); scope.setRootDirectory(document_path); } + +window.onkeypress = (e) => { + if (e.keyCode == 101) { // e + var scope = <any>angular.element(document.body).scope(); + var path = scope.current_note.path; + console.debug(scope.current_note); + if (scope.current_note.path.length == 0) { + return true; + } + externalEditor.open(path) + } +}
c23c8f0bd134289cdee51b26620e57156f1a3efa
public_src/services/config.service.ts
public_src/services/config.service.ts
import {Injectable} from "@angular/core"; const p = require("../../package.json"); @Injectable() export class ConfigService { public cfgFilterLines: boolean = true; static overpassUrl = "https://overpass-api.de/api/interpreter"; static apiTestUrl = "http://api06.dev.openstreetmap.org"; static appName = p["name"] + "v" + p["version"]; public minDownloadZoom = 15; public minDownloadDistance = 5000; }
import {Injectable} from "@angular/core"; const p = require("../../package.json"); @Injectable() export class ConfigService { public cfgFilterLines: boolean = true; static overpassUrl = "https://overpass-api.de/api/interpreter"; static baseOsmUrl = "https://www.openstreetmap.org"; static apiUrl = "https://api.openstreetmap.org/api/0.6/node/2194519037"; static apiConsumerSecret = "vFXps19FPNhWzzGmWbrhNpMv3RYiI1RFL4oK8NPz"; static apiConsumerKey = "rPEtcWkEykSKlLccsDS0FaZ9DpGAVPoJfQXWubXl"; static apiTestUrl = "https://master.apis.dev.openstreetmap.org"; static apiTestConsumerKey = "myPQ4WewlhUBa5zRs00zwHjWV4nEIsrg6SAF9zat"; static apiTestConsumerSecret = "7hAymlaBzyUqGU0ecbdUqXgYt4w59ru3t3JIM9xp"; static appName = p["name"] + " v" + p["version"]; public minDownloadZoom = 15; public minDownloadDistance = 5000; }
Adjust app config (API parameters)
Adjust app config (API parameters)
TypeScript
mit
dkocich/osm-pt-ngx-leaflet,dkocich/osm-pt-ngx-leaflet,dkocich/osm-pt-ngx-leaflet
--- +++ @@ -5,9 +5,19 @@ @Injectable() export class ConfigService { public cfgFilterLines: boolean = true; + static overpassUrl = "https://overpass-api.de/api/interpreter"; - static apiTestUrl = "http://api06.dev.openstreetmap.org"; - static appName = p["name"] + "v" + p["version"]; + static baseOsmUrl = "https://www.openstreetmap.org"; + + static apiUrl = "https://api.openstreetmap.org/api/0.6/node/2194519037"; + static apiConsumerSecret = "vFXps19FPNhWzzGmWbrhNpMv3RYiI1RFL4oK8NPz"; + static apiConsumerKey = "rPEtcWkEykSKlLccsDS0FaZ9DpGAVPoJfQXWubXl"; + + static apiTestUrl = "https://master.apis.dev.openstreetmap.org"; + static apiTestConsumerKey = "myPQ4WewlhUBa5zRs00zwHjWV4nEIsrg6SAF9zat"; + static apiTestConsumerSecret = "7hAymlaBzyUqGU0ecbdUqXgYt4w59ru3t3JIM9xp"; + + static appName = p["name"] + " v" + p["version"]; public minDownloadZoom = 15; public minDownloadDistance = 5000; }
971df238d14653111589239ef3bd7f01d4508bec
src/commands/info.ts
src/commands/info.ts
import * as Discord from 'discord.js'; import { creator, infoCommand, limitCommand, ordersCommand, priceCommand, regionCommand } from '../market-bot'; import { logCommand } from '../helpers/command-logger'; export async function infoFunction(discordMessage: Discord.Message) { await discordMessage.channel.sendMessage('Greetings, I am MarketBot!\n' + `I was created by <@${creator.id}> to fetch data from the EVE Online market, ` + 'all my data currently comes from https://eve-central.com, the EVE Swagger Interface ' + 'and the Static Data Export provided by CCP.\n\n' + 'You can access my functions by using these commands:\n\n' + `- \`${priceCommand} <item name> [${regionCommand} <region name>]\` ` + '- Use this to let me fetch data from the EVE Online market for a given item, ' + 'by default I use the market in The Forge region (where Jita is).\n\n' + `- \`${ordersCommand} <item name> [${regionCommand} <region name>] [${limitCommand} <limit>]\` ` + '- When issued with this command, I will search a regional market for the best sell orders available.' + '\n**Warning! This does not include Citadels**\n\n' + `- \`${infoCommand}\` - Print this information.\n\n` + 'My code is publicly available on https://github.com/Ionaru/MarketBot'); logCommand('info', discordMessage); }
import * as Discord from 'discord.js'; import { creator, infoCommand, limitCommand, ordersCommand, priceCommand, regionCommand } from '../market-bot'; import { logCommand } from '../helpers/command-logger'; export async function infoFunction(discordMessage: Discord.Message) { await discordMessage.channel.sendMessage('Greetings, I am MarketBot!\n' + `I was created by <@${creator.id}> to fetch data from the EVE Online market, ` + 'all my data currently comes from EVE-Central, the EVE Swagger Interface ' + 'and the Static Data Export provided by CCP.\n\n' + 'You can access my functions by using these commands:\n\n' + `- \`${priceCommand} <item name> [${regionCommand} <region name>]\` ` + '- Use this to let me fetch data from the EVE Online market for a given item, ' + 'by default I use the market in The Forge region (where Jita is).\n\n' + `- \`${ordersCommand} <item name> [${regionCommand} <region name>] [${limitCommand} <limit>]\` ` + '- When issued with this command, I will search a regional market for the best sell orders available.' + '\n**Warning! This does not include Citadels**\n\n' + `- \`${infoCommand}\` - Print this information.\n\n` + 'My code is publicly available on `https://github.com/Ionaru/MarketBot`'); logCommand('info', discordMessage); }
Use backtics around the url in /i
Use backtics around the url in /i
TypeScript
mit
Ionaru/MarketBot
--- +++ @@ -5,7 +5,7 @@ export async function infoFunction(discordMessage: Discord.Message) { await discordMessage.channel.sendMessage('Greetings, I am MarketBot!\n' + `I was created by <@${creator.id}> to fetch data from the EVE Online market, ` + - 'all my data currently comes from https://eve-central.com, the EVE Swagger Interface ' + + 'all my data currently comes from EVE-Central, the EVE Swagger Interface ' + 'and the Static Data Export provided by CCP.\n\n' + 'You can access my functions by using these commands:\n\n' + `- \`${priceCommand} <item name> [${regionCommand} <region name>]\` ` + @@ -15,6 +15,6 @@ '- When issued with this command, I will search a regional market for the best sell orders available.' + '\n**Warning! This does not include Citadels**\n\n' + `- \`${infoCommand}\` - Print this information.\n\n` + - 'My code is publicly available on https://github.com/Ionaru/MarketBot'); + 'My code is publicly available on `https://github.com/Ionaru/MarketBot`'); logCommand('info', discordMessage); }
598121371bebf3f3d5f5decacc0f83b0aa27ae9a
packages/logger/index.ts
packages/logger/index.ts
import * as debug from 'debug' export function log (namespace: string): debug.IDebugger { return debug(`machinomy:${namespace}`) }
import * as d from 'debug' class Levels { namespace: string _fatal?: d.IDebugger _error?: d.IDebugger _warn?: d.IDebugger _info?: d.IDebugger _debug?: d.IDebugger _trace?: d.IDebugger constructor (namespace: string) { this.namespace = namespace } get fatal (): d.IDebugger { if (!this._fatal) { this._fatal = d(`fatal:${this.namespace}`) } return this._fatal } get error () { if (!this._error) { this._error = d(`error:${this.namespace}`) } return this._error } get warn () { if (!this._warn) { this._warn = d(`warn:${this.namespace}`) } return this._warn } get info () { if (!this._info) { this._info = d(`info:${this.namespace}`) } return this._info } get debug () { if (!this._debug) { this._debug = d(`debug:${this.namespace}`) } return this._debug } get trace () { if (!this._trace) { this._trace = d(`trace:${this.namespace}`) } return this._trace } } export default class Logger { fatal: d.IDebugger error: d.IDebugger warn: d.IDebugger info: d.IDebugger debug: d.IDebugger trace: d.IDebugger constructor (namespace: string) { let levels = new Levels(namespace) this.fatal = levels.fatal this.error = levels.error this.warn = levels.warn this.info = levels.info this.debug = levels.debug this.trace = levels.trace } }
Replace Logger code with right Logger code.
Replace Logger code with right Logger code.
TypeScript
apache-2.0
machinomy/machinomy,machinomy/machinomy,machinomy/machinomy
--- +++ @@ -1,5 +1,76 @@ -import * as debug from 'debug' +import * as d from 'debug' -export function log (namespace: string): debug.IDebugger { - return debug(`machinomy:${namespace}`) +class Levels { + namespace: string + _fatal?: d.IDebugger + _error?: d.IDebugger + _warn?: d.IDebugger + _info?: d.IDebugger + _debug?: d.IDebugger + _trace?: d.IDebugger + + constructor (namespace: string) { + this.namespace = namespace + } + + get fatal (): d.IDebugger { + if (!this._fatal) { + this._fatal = d(`fatal:${this.namespace}`) + } + return this._fatal + } + + get error () { + if (!this._error) { + this._error = d(`error:${this.namespace}`) + } + return this._error + } + + get warn () { + if (!this._warn) { + this._warn = d(`warn:${this.namespace}`) + } + return this._warn + } + + get info () { + if (!this._info) { + this._info = d(`info:${this.namespace}`) + } + return this._info + } + + get debug () { + if (!this._debug) { + this._debug = d(`debug:${this.namespace}`) + } + return this._debug + } + + get trace () { + if (!this._trace) { + this._trace = d(`trace:${this.namespace}`) + } + return this._trace + } } + +export default class Logger { + fatal: d.IDebugger + error: d.IDebugger + warn: d.IDebugger + info: d.IDebugger + debug: d.IDebugger + trace: d.IDebugger + + constructor (namespace: string) { + let levels = new Levels(namespace) + this.fatal = levels.fatal + this.error = levels.error + this.warn = levels.warn + this.info = levels.info + this.debug = levels.debug + this.trace = levels.trace + } +}
e3e1ca02d5db904a645184b389bb8d1186bf2227
src/bin/sonarwhal.ts
src/bin/sonarwhal.ts
#!/usr/bin/env node /** * @fileoverview Main CLI that is run via the sonarwhal command. Based on ESLint. */ /* eslint no-console:off, no-process-exit:off */ /* * ------------------------------------------------------------------------------ * Helpers * ------------------------------------------------------------------------------ */ const debug = (process.argv.includes('--debug')); import * as d from 'debug'; // This initialization needs to be done *before* other requires in order to work. if (debug) { d.enable('sonarwhal:*'); } /* * ------------------------------------------------------------------------------ * Requirements * ------------------------------------------------------------------------------ * Now we can safely include the other modules that use debug. */ import * as cli from '../lib/cli'; /* * ------------------------------------------------------------------------------ * Execution * ------------------------------------------------------------------------------ */ process.once('uncaughtException', (err) => { console.error(err.message); console.error(err.stack); process.exit(1); }); process.once('unhandledRejection', (reason, promise) => { console.error(`Unhandled rejection at: Promise ${promise}, reason: ${reason}`); process.exit(1); }); const run = async () => { process.exitCode = await cli.execute(process.argv); if (debug) { console.log(`Exit code: ${process.exitCode}`); } process.exit(process.exitCode); }; run();
#!/usr/bin/env node /** * @fileoverview Main CLI that is run via the sonarwhal command. Based on ESLint. */ /* eslint no-console:off, no-process-exit:off */ /* * ------------------------------------------------------------------------------ * Helpers * ------------------------------------------------------------------------------ */ const debug = (process.argv.includes('--debug')); import * as d from 'debug'; // This initialization needs to be done *before* other requires in order to work. if (debug) { d.enable('sonarwhal:*'); } /* * ------------------------------------------------------------------------------ * Requirements * ------------------------------------------------------------------------------ * Now we can safely include the other modules that use debug. */ import * as cli from '../lib/cli'; /* * ------------------------------------------------------------------------------ * Execution * ------------------------------------------------------------------------------ */ process.once('uncaughtException', (err) => { console.error(err.message); console.error(err.stack); process.exit(1); }); process.once('unhandledRejection', (reason) => { console.error(`Unhandled rejection promise: uri: ${reason.uri} message: ${reason.error.message} stack: ${reason.error.stack}`); process.exit(1); }); const run = async () => { process.exitCode = await cli.execute(process.argv); if (debug) { console.log(`Exit code: ${process.exitCode}`); } process.exit(process.exitCode); }; run();
Improve error message for unhandled promises
Fix: Improve error message for unhandled promises The output is more meaningful and now looks like: ``` `Unhandled rejection promise: uri: FAILING URI message: ERROR MESSAGE stack: STACK TRACE ```
TypeScript
apache-2.0
alrra/sonar,alrra/sonar,alrra/sonar,sonarwhal/sonar,sonarwhal/sonar,sonarwhal/sonar
--- +++ @@ -41,8 +41,12 @@ process.exit(1); }); -process.once('unhandledRejection', (reason, promise) => { - console.error(`Unhandled rejection at: Promise ${promise}, reason: ${reason}`); +process.once('unhandledRejection', (reason) => { + console.error(`Unhandled rejection promise: + uri: ${reason.uri} + message: ${reason.error.message} + stack: +${reason.error.stack}`); process.exit(1); });
c897094a99c24e034a72581fb602df618c784db5
components/Card.tsx
components/Card.tsx
import { FunctionComponent, Fragment } from "react" const Card: FunctionComponent = ({ children }) => { return ( <Fragment> <div className="card-container">{children}</div> <style jsx>{` div.card-container { background: var(--secondary-background); border-radius: 8px; padding: 12px; margin-bottom: 8px; } `}</style> </Fragment> ) } export default Card
import { FunctionComponent, Fragment } from "react" const Card: FunctionComponent = ({ children }) => { return ( <Fragment> <div className="card-container">{children}</div> <style jsx>{` div.card-container { background: var(--secondary-background); border-radius: 8px; padding: 12px; margin-bottom: 8px; flex: 1; } `}</style> </Fragment> ) } export default Card
Fix cards not being full width in chrome
Fix cards not being full width in chrome
TypeScript
mit
JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk
--- +++ @@ -10,6 +10,7 @@ border-radius: 8px; padding: 12px; margin-bottom: 8px; + flex: 1; } `}</style> </Fragment>
7942d0e00e6a3b956f99be36aa7b9562785ce969
test/index.ts
test/index.ts
import * as path from 'path'; import { runTests } from 'vscode-test'; async function main() { try { // The paths are relative from the `/out/test` folder. const extensionDevelopmentPath = path.resolve(__dirname, '../../'); const extensionTestsPath = path.resolve(__dirname, './suite'); // Download VS Code, unzip it and run the integration test await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: [ // This disables all extensions except the one being tested. '--disable-extensions' ], }); } 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 { // The paths are relative from the `/out/test` folder. const extensionDevelopmentPath = path.resolve(__dirname, '../../'); const extensionTestsPath = path.resolve(__dirname, './suite'); // Download VS Code, unzip it and run the integration test await runTests({ extensionDevelopmentPath, extensionTestsPath, launchArgs: [ // This disables all extensions except the one being tested. '--disable-extensions' ], }); } catch (err) { console.error('Failed to run tests. Reason: ' + err); process.exit(1); } } main();
Include error reason for failed test run
Include error reason for failed test run
TypeScript
mit
darkriszty/MarkdownTablePrettify-VSCodeExt,darkriszty/MarkdownTablePrettify-VSCodeExt
--- +++ @@ -18,7 +18,7 @@ ], }); } catch (err) { - console.error('Failed to run tests'); + console.error('Failed to run tests. Reason: ' + err); process.exit(1); } }
fe1e01a108369bcaead2959590ad3addb9683988
webpack/plugins/index.ts
webpack/plugins/index.ts
const StringReplacePlugin = require('string-replace-webpack-plugin'); import constant from './const'; import hoist from './hoist'; import minify from './minify'; import banner from './banner'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; export default (version, lang) => { const plugins = [ constant(lang), new StringReplacePlugin(), hoist() ]; if (isProduction) { plugins.push(minify()); } plugins.push(banner(version)); return plugins; };
const StringReplacePlugin = require('string-replace-webpack-plugin'); import constant from './const'; import hoist from './hoist'; //import minify from './minify'; import banner from './banner'; const env = process.env.NODE_ENV; const isProduction = env === 'production'; export default (version, lang) => { const plugins = [ constant(lang), new StringReplacePlugin(), hoist() ]; if (isProduction) { //plugins.push(minify()); } plugins.push(banner(version)); return plugins; };
Disable minification due to artifacts
Disable minification due to artifacts
TypeScript
mit
Tosuke/misskey,Tosuke/misskey,syuilo/Misskey,syuilo/Misskey,ha-dai/Misskey,Tosuke/misskey,Tosuke/misskey,Tosuke/misskey,ha-dai/Misskey
--- +++ @@ -2,7 +2,7 @@ import constant from './const'; import hoist from './hoist'; -import minify from './minify'; +//import minify from './minify'; import banner from './banner'; const env = process.env.NODE_ENV; @@ -16,7 +16,7 @@ ]; if (isProduction) { - plugins.push(minify()); + //plugins.push(minify()); } plugins.push(banner(version));
b2210113755270e1de915cf78cb6372026b0d89a
src/marketplace/common/StepsList.tsx
src/marketplace/common/StepsList.tsx
import * as classNames from 'classnames'; import * as React from 'react'; import { Step } from './Step'; import './StepsList.scss'; interface StepsListProps { choices: string[]; value: string; onClick?(step: string): void; disabled?: boolean; } export const StepsList = (props: StepsListProps) => { const stepIndex = props.choices.indexOf(props.value); return ( <div className={classNames({disabled: props.disabled}, 'shopping-cart-steps')}> {props.choices.map((title, index) => ( <Step key={index} title={`${index + 1}. ${title}`} complete={stepIndex > index} active={stepIndex === index} onClick={() => props.onClick(title)} /> ))} </div> ); };
import * as classNames from 'classnames'; import * as React from 'react'; import { Step } from './Step'; import './StepsList.scss'; interface StepsListProps { choices: string[]; value: string; onClick?(step: string): void; disabled?: boolean; } export const StepsList = (props: StepsListProps) => { const stepIndex = props.choices.indexOf(props.value); return ( <div className={classNames({disabled: props.disabled}, 'shopping-cart-steps')}> {props.choices.map((title, index) => ( <Step key={index} title={`${index + 1}. ${title}`} complete={stepIndex > index} active={stepIndex === index} onClick={() => props.onClick && props.onClick(title)} /> ))} </div> ); };
Check if optional click callback is defined in steps component.
Check if optional click callback is defined in steps component.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -22,7 +22,7 @@ title={`${index + 1}. ${title}`} complete={stepIndex > index} active={stepIndex === index} - onClick={() => props.onClick(title)} + onClick={() => props.onClick && props.onClick(title)} /> ))} </div>
afaf8bc39f13e647fc742ff2146461082cb7ded5
src/linter-configs.ts
src/linter-configs.ts
export interface LinterConfig { name: string; configFiles: string[]; extension: string; enableConfig: string; packageJSONConfig?: string; } export const LINTERS: LinterConfig[] = [ { name: 'ESLint', configFiles: [ '.eslintrc', '.eslintrc.js', '.eslintrc.yaml', '.eslintrc.yml', '.eslintrc.json' ], extension: 'vscode-eslint', enableConfig: 'eslint.enable', packageJSONConfig: 'eslintConfig' }, { name: 'JSHint', configFiles: [ '.jshintrc' ], extension: 'jshint', enableConfig: 'jshint.enable' }, { name: 'JSCS', configFiles: [ '.jscsrc' ], extension: 'jscs', enableConfig: 'jscs.enable' } ];
export interface LinterConfig { name: string; configFiles: string[]; extension: string; enableConfig: string; packageJSONConfig?: string; } export const LINTERS: LinterConfig[] = [ { name: 'ESLint', configFiles: [ '.eslintrc', '.eslintrc.js', '.eslintrc.yaml', '.eslintrc.yml', '.eslintrc.json' ], extension: 'vscode-eslint', enableConfig: 'eslint.enable', packageJSONConfig: 'eslintConfig' }, { name: 'JSHint', configFiles: [ '.jshintrc' ], extension: 'jshint', enableConfig: 'jshint.enable' }, { name: 'JSCS', configFiles: [ '.jscsrc', '.jscs.json' ], extension: 'jscs', enableConfig: 'jscs.enable', packageJSONConfig: 'jscsConfig' } ];
Check package.json for jscsConfig and check for .jscs.json
Check package.json for jscsConfig and check for .jscs.json
TypeScript
mit
t-sauer/autolinting-for-javascript
--- +++ @@ -31,9 +31,11 @@ { name: 'JSCS', configFiles: [ - '.jscsrc' + '.jscsrc', + '.jscs.json' ], extension: 'jscs', - enableConfig: 'jscs.enable' + enableConfig: 'jscs.enable', + packageJSONConfig: 'jscsConfig' } ];
d2dadb41c7958a1b6f5ed7bf6f34af7d73668b06
scripts/Actions/Video.ts
scripts/Actions/Video.ts
import AnimeNotifier from "../AnimeNotifier" // Play video export function playVideo(arn: AnimeNotifier, video: HTMLVideoElement) { video.volume = arn.audioPlayer.volume if(video.readyState >= 2) { togglePlayVideo(video) return } video.addEventListener("canplay", () => { togglePlayVideo(video) }) video.load() } function togglePlayVideo(video: HTMLVideoElement) { if(video.paused) { video.play() } else { video.pause() } } // Toggle fullscreen export function toggleFullscreen(arn: AnimeNotifier, button: HTMLElement) { let elementId = button.dataset.id let element = document.getElementById(elementId) let requestFullscreen = element.requestFullscreen || element["mozRequestFullScreen"] || element["webkitRequestFullScreen"] || element["msRequestFullscreen"] let exitFullscreen = document.exitFullscreen || document["mozCancelFullScreen"] || document["webkitExitFullscreen"] || document["msExitFullscreen"] if(document.fullscreen) { exitFullscreen.call(document) } else { requestFullscreen.call(element) } }
import AnimeNotifier from "../AnimeNotifier" // Play video export function playVideo(arn: AnimeNotifier, video: HTMLVideoElement) { video.volume = arn.audioPlayer.volume if(video.readyState >= 2) { togglePlayVideo(video) return } video.addEventListener("canplay", () => { togglePlayVideo(video) }) video.load() } function togglePlayVideo(video: HTMLVideoElement) { if(video.paused) { video.play() } else { video.pause() } } // Toggle fullscreen export function toggleFullscreen(arn: AnimeNotifier, button: HTMLElement) { let elementId = button.dataset.id let element = document.getElementById(elementId) let requestFullscreen = element.requestFullscreen || element["mozRequestFullScreen"] || element["webkitRequestFullScreen"] || element["msRequestFullscreen"] let exitFullscreen = document.exitFullscreen || document["mozCancelFullScreen"] || document["webkitExitFullscreen"] || document["msExitFullscreen"] let fullscreen = document.fullscreen || document["webkitIsFullScreen"] || document["mozFullScreen"] if(fullscreen) { exitFullscreen.call(document) } else { requestFullscreen.call(element) } }
Use prefixed document.fullscreen if necessary
Use prefixed document.fullscreen if necessary
TypeScript
mit
animenotifier/notify.moe,animenotifier/notify.moe,animenotifier/notify.moe
--- +++ @@ -30,8 +30,9 @@ let element = document.getElementById(elementId) let requestFullscreen = element.requestFullscreen || element["mozRequestFullScreen"] || element["webkitRequestFullScreen"] || element["msRequestFullscreen"] let exitFullscreen = document.exitFullscreen || document["mozCancelFullScreen"] || document["webkitExitFullscreen"] || document["msExitFullscreen"] + let fullscreen = document.fullscreen || document["webkitIsFullScreen"] || document["mozFullScreen"] - if(document.fullscreen) { + if(fullscreen) { exitFullscreen.call(document) } else { requestFullscreen.call(element)
973d2fe6374494f0f8e3df3e2bae99d8c2649418
src/gerrit/controller.ts
src/gerrit/controller.ts
import { Gerrit } from "./gerrit"; import { Ref } from "./ref"; export class GerritController { constructor(private gerrit: Gerrit) { } public checkoutBranch() { this.gerrit.checkoutBranch("master"); } public checkoutRevision() { let newRef: Ref = new Ref(0, 0); this.gerrit.setCurrentRef(newRef); } public commitAmend() { this.gerrit.commit("", [""], true); } public commit() { this.gerrit.commit("", [""], false); } }
import { window, InputBoxOptions } from "vscode"; import { Gerrit } from "./gerrit"; import { Ref } from "./ref"; export class GerritController { constructor(private gerrit: Gerrit) { } public checkoutBranch() { let options: InputBoxOptions = { value: "master", prompt: "The branch to checkout" }; window.showInputBox(options).then(branch => { this.gerrit.checkoutBranch(branch); }, reason => { }); } public checkoutRevision() { let revisionOptions: InputBoxOptions = { placeHolder: "Ref Number", validateInput: (value: string): string => { if (isNaN(parseInt(value))) { return "Not a Number"; } else { return null; } }, prompt: "The revision to checkout" }; window.showInputBox(revisionOptions).then(refString => { let refId = parseInt(refString); let patchsetOptions: InputBoxOptions = revisionOptions; patchsetOptions.placeHolder = `Patchset for Ref: ${refString}`; patchsetOptions.prompt = "The patchset to checkout"; window.showInputBox(patchsetOptions).then(patchString => { let patchId = parseInt(patchString); let newRef: Ref = new Ref(refId, patchId); this.gerrit.setCurrentRef(newRef); }, reason => { }); }, reason => { }); } public commitAmend() { // TODO: should not require new commit message this.gerrit.commit("", [""], true); } public commit() { let options: InputBoxOptions = { placeHolder: "Commit Message", prompt: "The commit description" }; window.showInputBox(options).then(message => { this.gerrit.commit(message, [""], false); }, reason => { }); } }
Add input boxes for commands
Add input boxes for commands
TypeScript
mit
tht13/gerrit-vscode
--- +++ @@ -1,3 +1,4 @@ +import { window, InputBoxOptions } from "vscode"; import { Gerrit } from "./gerrit"; import { Ref } from "./ref"; @@ -7,22 +8,60 @@ } public checkoutBranch() { + let options: InputBoxOptions = { + value: "master", + prompt: "The branch to checkout" + }; - this.gerrit.checkoutBranch("master"); + window.showInputBox(options).then(branch => { + this.gerrit.checkoutBranch(branch); + }, reason => { + }); } public checkoutRevision() { - let newRef: Ref = new Ref(0, 0); - this.gerrit.setCurrentRef(newRef); + let revisionOptions: InputBoxOptions = { + placeHolder: "Ref Number", + validateInput: (value: string): string => { + if (isNaN(parseInt(value))) { + return "Not a Number"; + } else { + return null; + } + }, + prompt: "The revision to checkout" + }; + + window.showInputBox(revisionOptions).then(refString => { + let refId = parseInt(refString); + let patchsetOptions: InputBoxOptions = revisionOptions; + patchsetOptions.placeHolder = `Patchset for Ref: ${refString}`; + patchsetOptions.prompt = "The patchset to checkout"; + + window.showInputBox(patchsetOptions).then(patchString => { + let patchId = parseInt(patchString); + let newRef: Ref = new Ref(refId, patchId); + this.gerrit.setCurrentRef(newRef); + }, reason => { + }); + }, reason => { + }); } public commitAmend() { - + // TODO: should not require new commit message this.gerrit.commit("", [""], true); } public commit() { + let options: InputBoxOptions = { + placeHolder: "Commit Message", + prompt: "The commit description" + }; - this.gerrit.commit("", [""], false); + window.showInputBox(options).then(message => { + this.gerrit.commit(message, [""], false); + }, reason => { + }); } }
e39695527caa66be5a2ae7c6587abe062a8e1810
app/app.component.ts
app/app.component.ts
import {Component} from "angular2/core"; import {RouteConfig} from "angular2/router"; import {NS_ROUTER_DIRECTIVES} from "nativescript-angular/router"; import * as Config from "./shared/config"; import {LoginPage} from "./pages/login/login.component"; import {ListPage} from "./pages/list/list.component"; var startOnList = !!Config.token; @Component({ selector: "main", directives: [NS_ROUTER_DIRECTIVES], template: "<StackLayout><page-router-outlet></page-router-outlet></StackLayout>" }) @RouteConfig([ { path: "/", component: LoginPage, as: "Login", useAsDefault: !startOnList }, { path: "/List", component: ListPage, as: "List", useAsDefault: startOnList } ]) export class AppComponent {}
import {Component} from "angular2/core"; import {RouteConfig} from "angular2/router"; import {NS_ROUTER_DIRECTIVES} from "nativescript-angular/router"; import * as Config from "./shared/config"; import {LoginPage} from "./pages/login/login.component"; import {ListPage} from "./pages/list/list.component"; var startOnList = !!Config.token; @Component({ selector: "main", directives: [NS_ROUTER_DIRECTIVES], template: "<StackLayout><page-router-outlet></page-router-outlet></StackLayout>" }) @RouteConfig([ { path: "/Login", component: LoginPage, as: "Login", useAsDefault: !startOnList }, { path: "/List", component: ListPage, as: "List", useAsDefault: startOnList } ]) export class AppComponent {}
Make the useAsDefault flag work by making sure no existing routes use the root path
Make the useAsDefault flag work by making sure no existing routes use the root path
TypeScript
mit
qtagtech/nativescript_tutorial,anhoev/cms-mobile,dzfweb/sample-groceries,tjvantoll/sample-Groceries,poly-mer/community,Icenium/nativescript-sample-groceries,poly-mer/community,tjvantoll/sample-Groceries,NativeScript/sample-Groceries,qtagtech/nativescript_tutorial,poly-mer/community,qtagtech/nativescript_tutorial,NativeScript/sample-Groceries,NativeScript/sample-Groceries,anhoev/cms-mobile,tjvantoll/sample-Groceries,dzfweb/sample-groceries,dzfweb/sample-groceries,anhoev/cms-mobile
--- +++ @@ -14,7 +14,7 @@ template: "<StackLayout><page-router-outlet></page-router-outlet></StackLayout>" }) @RouteConfig([ - { path: "/", component: LoginPage, as: "Login", useAsDefault: !startOnList }, + { path: "/Login", component: LoginPage, as: "Login", useAsDefault: !startOnList }, { path: "/List", component: ListPage, as: "List", useAsDefault: startOnList } ]) export class AppComponent {}
127f00f6d9d83c98ea276b4a5f2c0832dca7ccb3
app/src/ui/create-branch/sanitized-branch-name.ts
app/src/ui/create-branch/sanitized-branch-name.ts
/** Sanitize a proposed branch name by replacing illegal characters. */ export function sanitizedBranchName(name: string): string { return name.replace(/[\x00-\x20\x7F~^:?*\[\\|""<>]|@{|\.\.+|^\.|\.$|\.lock$|\/$/g, '-') .replace(/--+/g, '-') .replace(/^-/g, '') }
/** Sanitize a proposed branch name by replacing illegal characters. */ export function sanitizedBranchName(name: string): string { // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html // ASCII Control chars and space, DEL, ~ ^ : ? * [ \ // | " < and > is technically a valid refname but not on Windows // the magic sequence @{, consecutive dots, leading and trailing dot, ref ending in .lock return name.replace(/[\x00-\x20\x7F~^:?*\[\\|""<>]|@{|\.\.+|^\.|\.$|\.lock$|\/$/g, '-') .replace(/--+/g, '-') .replace(/^-/g, '') }
Add comment about the sanitization regex
Add comment about the sanitization regex
TypeScript
mit
kactus-io/kactus,hjobrien/desktop,gengjiawen/desktop,artivilla/desktop,hjobrien/desktop,shiftkey/desktop,say25/desktop,desktop/desktop,BugTesterTest/desktops,artivilla/desktop,BugTesterTest/desktops,say25/desktop,j-f1/forked-desktop,kactus-io/kactus,kactus-io/kactus,gengjiawen/desktop,BugTesterTest/desktops,kactus-io/kactus,say25/desktop,desktop/desktop,hjobrien/desktop,desktop/desktop,shiftkey/desktop,shiftkey/desktop,desktop/desktop,shiftkey/desktop,artivilla/desktop,j-f1/forked-desktop,BugTesterTest/desktops,hjobrien/desktop,gengjiawen/desktop,j-f1/forked-desktop,say25/desktop,gengjiawen/desktop,artivilla/desktop,j-f1/forked-desktop
--- +++ @@ -1,5 +1,9 @@ /** Sanitize a proposed branch name by replacing illegal characters. */ export function sanitizedBranchName(name: string): string { + // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html + // ASCII Control chars and space, DEL, ~ ^ : ? * [ \ + // | " < and > is technically a valid refname but not on Windows + // the magic sequence @{, consecutive dots, leading and trailing dot, ref ending in .lock return name.replace(/[\x00-\x20\x7F~^:?*\[\\|""<>]|@{|\.\.+|^\.|\.$|\.lock$|\/$/g, '-') .replace(/--+/g, '-') .replace(/^-/g, '')
9f282bf8846ab24c14d7ccd598487d562306699a
app/react/src/server/framework-preset-react-docgen.ts
app/react/src/server/framework-preset-react-docgen.ts
import type { TransformOptions } from '@babel/core'; import type { Configuration } from 'webpack'; import type { StorybookOptions } from '@storybook/core/types'; import ReactDocgenTypescriptPlugin from 'react-docgen-typescript-plugin'; export function babel(config: TransformOptions, { typescriptOptions }: StorybookOptions) { const { reactDocgen } = typescriptOptions; if (!reactDocgen || reactDocgen === 'react-docgen-typescript') { return config; } return { ...config, overrides: [ { test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, plugins: [ [ require.resolve('babel-plugin-react-docgen'), { DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', }, ], ], }, ], }; } export function webpackFinal(config: Configuration, { typescriptOptions }: StorybookOptions) { const { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions; if (reactDocgen !== 'react-docgen-typescript') { return config; } return { ...config, plugins: [...config.plugins, new ReactDocgenTypescriptPlugin(reactDocgenTypescriptOptions)], }; }
import type { TransformOptions } from '@babel/core'; import type { Configuration } from 'webpack'; import type { StorybookOptions } from '@storybook/core/types'; import ReactDocgenTypescriptPlugin from 'react-docgen-typescript-plugin'; export function babel(config: TransformOptions, { typescriptOptions }: StorybookOptions) { const { reactDocgen } = typescriptOptions; return { ...config, overrides: [ { test: reactDocgen === 'react-docgen' ? /\.(mjs|tsx?|jsx?)$/ : /\.(mjs|jsx?)$/, plugins: [ [ require.resolve('babel-plugin-react-docgen'), { DOC_GEN_COLLECTION_NAME: 'STORYBOOK_REACT_CLASSES', }, ], ], }, ], }; } export function webpackFinal(config: Configuration, { typescriptOptions }: StorybookOptions) { const { reactDocgen, reactDocgenTypescriptOptions } = typescriptOptions; if (reactDocgen !== 'react-docgen-typescript') { return config; } return { ...config, plugins: [...config.plugins, new ReactDocgenTypescriptPlugin(reactDocgenTypescriptOptions)], }; }
Fix react-docgen for JS files
React: Fix react-docgen for JS files
TypeScript
mit
storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook
--- +++ @@ -5,10 +5,6 @@ export function babel(config: TransformOptions, { typescriptOptions }: StorybookOptions) { const { reactDocgen } = typescriptOptions; - - if (!reactDocgen || reactDocgen === 'react-docgen-typescript') { - return config; - } return { ...config,
2a76afda7fb7f514a04e35053e98a83a92ac5959
packages/components/containers/payments/Alert3ds.tsx
packages/components/containers/payments/Alert3ds.tsx
import { c } from 'ttag'; import React from 'react'; import americanExpressSafekeySvg from 'design-system/assets/img/bank-icons/amex-safekey.svg'; import discoverProtectBuySvg from 'design-system/assets/img/bank-icons/discover-protectbuy.svg'; import mastercardSecurecodeSvg from 'design-system/assets/img/bank-icons/mastercard-securecode.svg'; import verifiedByVisaSvg from 'design-system/assets/img/bank-icons/visa-secure.svg'; const Alert3ds = () => { return ( <p> <div className="mb0-5">{c('Info').t`We use 3-D Secure to protect your payments.`}</div> <div className="flex flex-nowrap flex-align-items-center"> <img height="44" alt="" className="mr1" src={verifiedByVisaSvg} /> <img height="44" alt="" className="mr1" src={mastercardSecurecodeSvg} /> <img height="44" alt="" className="mr1" src={discoverProtectBuySvg} /> <img height="44" alt="" className="mr1" src={americanExpressSafekeySvg} /> </div> </p> ); }; export default Alert3ds;
import { c } from 'ttag'; import React from 'react'; import americanExpressSafekeySvg from 'design-system/assets/img/bank-icons/amex-safekey.svg'; import discoverProtectBuySvg from 'design-system/assets/img/bank-icons/discover-protectbuy.svg'; import mastercardSecurecodeSvg from 'design-system/assets/img/bank-icons/mastercard-securecode.svg'; import verifiedByVisaSvg from 'design-system/assets/img/bank-icons/visa-secure.svg'; const Alert3ds = () => { return ( <div className="mt1-5 mb1-5"> <div className="mb0-5">{c('Info').t`We use 3-D Secure to protect your payments.`}</div> <div className="flex flex-nowrap flex-align-items-center"> <img height="44" alt="" className="mr1" src={verifiedByVisaSvg} /> <img height="44" alt="" className="mr1" src={mastercardSecurecodeSvg} /> <img height="44" alt="" className="mr1" src={discoverProtectBuySvg} /> <img height="44" alt="" className="mr1" src={americanExpressSafekeySvg} /> </div> </div> ); }; export default Alert3ds;
Fix alert 3ds dom nesting
Fix alert 3ds dom nesting
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -7,7 +7,7 @@ const Alert3ds = () => { return ( - <p> + <div className="mt1-5 mb1-5"> <div className="mb0-5">{c('Info').t`We use 3-D Secure to protect your payments.`}</div> <div className="flex flex-nowrap flex-align-items-center"> <img height="44" alt="" className="mr1" src={verifiedByVisaSvg} /> @@ -15,7 +15,7 @@ <img height="44" alt="" className="mr1" src={discoverProtectBuySvg} /> <img height="44" alt="" className="mr1" src={americanExpressSafekeySvg} /> </div> - </p> + </div> ); };
6eeaa7f32aa3fb2040e01a34fd22ce76dab1ef7c
lib/mappers/AutoMapper.ts
lib/mappers/AutoMapper.ts
import {AttributesMapperFactory} from "./AttributesMapperFactory"; import Record from "neo4j-driver/types/v1/record"; import {Node, Relationship} from "neo4j-driver/types/v1/graph-types"; import {isNode, isRelationship} from "../driver/NeoTypes"; export class AutoMapper { constructor(private attributesMapperFactory:AttributesMapperFactory) {} toMappedArray(records:Record[]):any[] { return records.map((record:Record) => { let row = {}; record.forEach((recordField:Node|Relationship, id) => { if (isNode(recordField) && this.attributesMapperFactory.hasNodeMapper(recordField.labels)) { row[id] = this.attributesMapperFactory.getNodeAttributesMapper(recordField.labels).mapToInstance(recordField); return; } if (isRelationship(recordField) && this.attributesMapperFactory.hasRelationMapper(recordField.type)) { row[id] = this.attributesMapperFactory.getRelationAttributesMapper(recordField.type).mapToInstance(recordField); return; } row[id] = recordField; }); return row; }) } }
import {AttributesMapperFactory} from "./AttributesMapperFactory"; import Record from "neo4j-driver/types/v1/record"; import {Node, Relationship} from "neo4j-driver/types/v1/graph-types"; import {isNode, isRelationship} from "../driver/NeoTypes"; import * as _ from 'lodash'; export class AutoMapper { constructor(private attributesMapperFactory:AttributesMapperFactory) {} toMappedArray(records:Record[]):any[] { return records.map((record:Record) => { let row = {}; record.forEach((recordField:Node | Relationship, id) => { row[id] = this.mapRecord(recordField); }); return row; }) } private mapRecord(recordField:Node | Relationship) { if (_.isArray(recordField)){ return recordField.map(el => this.mapRecord(el)) } if (isNode(recordField) && this.attributesMapperFactory.hasNodeMapper(recordField.labels)) { return this.attributesMapperFactory.getNodeAttributesMapper(recordField.labels).mapToInstance(recordField); } if (isRelationship(recordField) && this.attributesMapperFactory.hasRelationMapper(recordField.type)) { return this.attributesMapperFactory.getRelationAttributesMapper(recordField.type).mapToInstance(recordField); } return recordField; } }
Add mapping for nested arrays
Add mapping for nested arrays
TypeScript
mit
robak86/neography
--- +++ @@ -2,6 +2,7 @@ import Record from "neo4j-driver/types/v1/record"; import {Node, Relationship} from "neo4j-driver/types/v1/graph-types"; import {isNode, isRelationship} from "../driver/NeoTypes"; +import * as _ from 'lodash'; export class AutoMapper { @@ -11,21 +12,29 @@ return records.map((record:Record) => { let row = {}; - record.forEach((recordField:Node|Relationship, id) => { - if (isNode(recordField) && this.attributesMapperFactory.hasNodeMapper(recordField.labels)) { - row[id] = this.attributesMapperFactory.getNodeAttributesMapper(recordField.labels).mapToInstance(recordField); - return; - } - - if (isRelationship(recordField) && this.attributesMapperFactory.hasRelationMapper(recordField.type)) { - row[id] = this.attributesMapperFactory.getRelationAttributesMapper(recordField.type).mapToInstance(recordField); - return; - } - - row[id] = recordField; + record.forEach((recordField:Node | Relationship, id) => { + row[id] = this.mapRecord(recordField); }); return row; }) } + + private mapRecord(recordField:Node | Relationship) { + if (_.isArray(recordField)){ + return recordField.map(el => this.mapRecord(el)) + } + + if (isNode(recordField) && this.attributesMapperFactory.hasNodeMapper(recordField.labels)) { + return this.attributesMapperFactory.getNodeAttributesMapper(recordField.labels).mapToInstance(recordField); + } + + if (isRelationship(recordField) && this.attributesMapperFactory.hasRelationMapper(recordField.type)) { + return this.attributesMapperFactory.getRelationAttributesMapper(recordField.type).mapToInstance(recordField); + } + + return recordField; + } + + }
907ff003002e3eb218be1f025d2b807c1ce0d83e
tests/app/main.ts
tests/app/main.ts
import '../../src/utils/polyfills'; import Vue from 'vue'; import router from './router'; import '../../src/styles/main.scss'; import ComponentsPlugin from '../../src/components'; import DirectivesPlugin from '../../src/directives'; import UtilsPlugin, { UtilsPluginOptions } from '../../src/utils'; import Meta from '../../src/meta/meta'; import MetaAll from '../../src/meta/meta-all'; import I18nLanguagePlugin, { currentLang, FRENCH } from '../../src/utils/i18n/i18n'; import FrenchPlugin from '../../src/lang/fr'; import DefaultSpritesPlugin from '../../src/utils/svg/default-sprites'; Vue.config.productionTip = false; const utilsPluginOptions: UtilsPluginOptions = { securityPluginOptions: { protectedUrls: [] } }; Vue.use(ComponentsPlugin); Vue.use(DirectivesPlugin); Vue.use(UtilsPlugin, utilsPluginOptions); currentLang(FRENCH); Vue.use(I18nLanguagePlugin); Vue.use(FrenchPlugin); Vue.use(MetaAll, Meta); Vue.use(DefaultSpritesPlugin); const vue = new Vue({ router, template: '<router-view></router-view>' }); vue.$mount('#vue');
import '../../src/utils/polyfills'; import Vue from 'vue'; import router from './router'; import '../../src/styles/main.scss'; import ComponentsPlugin from '../../src/components'; import DirectivesPlugin from '../../src/directives'; import UtilsPlugin, { UtilsPluginOptions } from '../../src/utils'; import Meta from '../../src/meta/meta'; import I18nLanguagePlugin, { currentLang, FRENCH } from '../../src/utils/i18n/i18n'; import FrenchPlugin from '../../src/lang/fr'; import DefaultSpritesPlugin from '../../src/utils/svg/default-sprites'; Vue.config.productionTip = false; const utilsPluginOptions: UtilsPluginOptions = { securityPluginOptions: { protectedUrls: [] } }; Vue.use(ComponentsPlugin); Vue.use(DirectivesPlugin); Vue.use(UtilsPlugin, utilsPluginOptions); currentLang(FRENCH); Vue.use(I18nLanguagePlugin); Vue.use(FrenchPlugin); Vue.use(DefaultSpritesPlugin); const vue = new Vue({ router, template: '<router-view></router-view>' }); vue.$mount('#vue');
Move meta files to website - fix build
Move meta files to website - fix build
TypeScript
apache-2.0
ulaval/modul-components,ulaval/modul-components,ulaval/modul-components
--- +++ @@ -8,7 +8,6 @@ import UtilsPlugin, { UtilsPluginOptions } from '../../src/utils'; import Meta from '../../src/meta/meta'; -import MetaAll from '../../src/meta/meta-all'; import I18nLanguagePlugin, { currentLang, FRENCH } from '../../src/utils/i18n/i18n'; import FrenchPlugin from '../../src/lang/fr'; import DefaultSpritesPlugin from '../../src/utils/svg/default-sprites'; @@ -28,7 +27,6 @@ currentLang(FRENCH); Vue.use(I18nLanguagePlugin); Vue.use(FrenchPlugin); -Vue.use(MetaAll, Meta); Vue.use(DefaultSpritesPlugin); const vue = new Vue({
b9652f228a383eb4d869deeee47a66b04589d643
playwright.config.ts
playwright.config.ts
/** * Configuration for Playwright using default from @jupyterlab/galata */ import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { testDir: './nbgrader/tests/labextension_ui-tests', testMatch: '**/*.spec.ts', testIgnore: '**/node_modules/**/*', timeout: 30000, reporter: [[process.env.CI ? 'dot' : 'list'], ['html']], use: { // Browser options // headless: false, // slowMo: 500, // Context options viewport: { width: 1024, height: 768 }, // Artifacts video: 'retain-on-failure' }, webServer: { command: 'jlpm start:test', url: 'http://localhost:8888/lab', timeout: 120 * 1000, reuseExistingServer: !process.env.CI, }, }; export default config;
/** * Configuration for Playwright using default from @jupyterlab/galata */ import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { testDir: './nbgrader/tests/labextension_ui-tests', testMatch: '**/*.spec.ts', testIgnore: '**/node_modules/**/*', timeout: 30000, reporter: [[process.env.CI ? 'dot' : 'list'], ['html']], workers: 1, use: { // Browser options // headless: false, // slowMo: 500, // Context options viewport: { width: 1024, height: 768 }, // Artifacts video: 'retain-on-failure' }, webServer: { command: 'jlpm start:test', url: 'http://localhost:8888/lab', timeout: 120 * 1000, reuseExistingServer: !process.env.CI, }, }; export default config;
Allow only one playwright worker to avoid errors
Allow only one playwright worker to avoid errors
TypeScript
bsd-3-clause
jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader
--- +++ @@ -10,6 +10,7 @@ testIgnore: '**/node_modules/**/*', timeout: 30000, reporter: [[process.env.CI ? 'dot' : 'list'], ['html']], + workers: 1, use: { // Browser options // headless: false,
0e52ee27b6ce70446ff147c9b835907df96217fc
src/app/app.spec.ts
src/app/app.spec.ts
import { beforeEachProviders, inject, injectAsync, it } from '@angular/core/testing'; // Load the implementations that should be tested import { App } from './app.component'; import { AppState } from './app.service'; describe('App', () => { // provide our implementations or mocks to the dependency injector beforeEachProviders(() => [ AppState, App ]); it('should have a url', inject([ App ], (app) => { expect(app.url).toEqual('https://twitter.com/AngularClass'); })); });
import { beforeEachProviders, inject, injectAsync, it } from '@angular/core/testing'; // Load the implementations that should be tested import { App } from './app.component'; import { AppState } from './app.service'; describe('App', () => { // provide our implementations or mocks to the dependency injector beforeEachProviders(() => [ AppState, App ]); });
Remove needless test from seed project
Remove needless test from seed project
TypeScript
mit
bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder
--- +++ @@ -15,9 +15,4 @@ AppState, App ]); - - it('should have a url', inject([ App ], (app) => { - expect(app.url).toEqual('https://twitter.com/AngularClass'); - })); - });
6a649521ef2efb496f9a2d52dab0b587b79f6498
source/commands/danger.ts
source/commands/danger.ts
#! /usr/bin/env node import * as program from "commander" import * as debug from "debug" import chalk from "chalk" import { version } from "../../package.json" import setSharedArgs, { SharedCLI } from "./utils/sharedDangerfileArgs" import { runRunner } from "./run/runner" const d = debug("danger:runner") d(`argv: ${process.argv}`) process.on("unhandledRejection", function(reason: string, _p: any) { console.log(chalk.red("Error: "), reason) process.exitCode = 1 }) // Provides the root node to the command-line architecture setSharedArgs(program) program .version(version) .command("init", "Helps you get started with Danger") .command("process", "Like `run` but lets another process handle evaluating a Dangerfile") .command("pr", "Runs your changes against an existing PR") .command("runner", "Runs a dangerfile against a DSL passed in via STDIN") .command("run", "Runs danger on your local system") .parse(process.argv) const app = (program as any) as SharedCLI runRunner(app)
#! /usr/bin/env node import * as program from "commander" import * as debug from "debug" import chalk from "chalk" import { version } from "../../package.json" import setSharedArgs, { SharedCLI } from "./utils/sharedDangerfileArgs" import { runRunner } from "./run/runner" const d = debug("danger:runner") d(`argv: ${process.argv}`) process.on("unhandledRejection", function(reason: string, _p: any) { console.log(chalk.red("Error: "), reason) process.exitCode = 1 }) // Provides the root node to the command-line architecture program .version(version) .command("init", "Helps you get started with Danger") .command("process", "Like `run` but lets another process handle evaluating a Dangerfile") .command("pr", "Runs your changes against an existing PR") .command("runner", "Runs a dangerfile against a DSL passed in via STDIN") .command("run", "Runs danger on your local system") setSharedArgs(program) program.parse(process.argv) const app = (program as any) as SharedCLI runRunner(app)
Add the options after all the commands etc are set up
Add the options after all the commands etc are set up
TypeScript
mit
danger/danger-js,danger/danger-js,danger/danger-js,danger/danger-js
--- +++ @@ -17,7 +17,6 @@ }) // Provides the root node to the command-line architecture -setSharedArgs(program) program .version(version) @@ -26,7 +25,9 @@ .command("pr", "Runs your changes against an existing PR") .command("runner", "Runs a dangerfile against a DSL passed in via STDIN") .command("run", "Runs danger on your local system") - .parse(process.argv) + +setSharedArgs(program) +program.parse(process.argv) const app = (program as any) as SharedCLI runRunner(app)
d442eb06da8456d002a746f66dd44a2b47b190d5
client/Commands/components/Toolbar.tsx
client/Commands/components/Toolbar.tsx
import * as React from "react"; export interface ToolbarProps { } export class Toolbar extends React.Component<ToolbarProps> { public render() { return "TOOLBAR"; } }
import * as React from "react"; interface ToolbarProps { } interface ToolbarState { displayWide: boolean; } export class Toolbar extends React.Component<ToolbarProps, ToolbarState> { constructor(props: ToolbarProps){ super(props); this.setState({ displayWide: false }); } public render() { const className = this.state.displayWide ? "toolbar s-wide" : "toolbar s-narrow"; return <div className={className}> </div>; } }
Add wrapper with display width CSS
Add wrapper with display width CSS
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -1,11 +1,24 @@ import * as React from "react"; -export interface ToolbarProps { +interface ToolbarProps { } -export class Toolbar extends React.Component<ToolbarProps> { +interface ToolbarState { + displayWide: boolean; +} + +export class Toolbar extends React.Component<ToolbarProps, ToolbarState> { + constructor(props: ToolbarProps){ + super(props); + this.setState({ + displayWide: false + }); + } + public render() { - return "TOOLBAR"; - } + const className = this.state.displayWide ? "toolbar s-wide" : "toolbar s-narrow"; + return <div className={className}> + </div>; + } }
021fab9d2d2786a7b17146a92fb5b191fea73ee2
packages/lesswrong/lib/rss_urls.ts
packages/lesswrong/lib/rss_urls.ts
import { siteUrlSetting } from './instanceSettings'; export const rssTermsToUrl = (terms) => { const siteUrl = siteUrlSetting.get(); const terms_as_GET_params = Object.keys(terms).map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(terms[k])).join('&') return siteUrl+"feed.xml?"+terms_as_GET_params; }
import { getSiteUrl } from './vulcan-lib/utils'; export const rssTermsToUrl = (terms) => { const siteUrl = getSiteUrl(); const terms_as_GET_params = Object.keys(terms).map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(terms[k])).join('&') return siteUrl+"feed.xml?"+terms_as_GET_params; }
Fix a broken RSS link (missing slash)
Fix a broken RSS link (missing slash)
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -1,7 +1,7 @@ -import { siteUrlSetting } from './instanceSettings'; +import { getSiteUrl } from './vulcan-lib/utils'; export const rssTermsToUrl = (terms) => { - const siteUrl = siteUrlSetting.get(); + const siteUrl = getSiteUrl(); const terms_as_GET_params = Object.keys(terms).map((k) => encodeURIComponent(k) + '=' + encodeURIComponent(terms[k])).join('&') return siteUrl+"feed.xml?"+terms_as_GET_params; }
0eff2ef6f44a4043b1b49c6a6f7c1a6cd4c8b13e
app/app.component.ts
app/app.component.ts
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ' <h1>{{title}}</h1> <h2>{{hero.name}} details!</h2> <div><label>id: </label>{{hero.id}}</div> <div><label>name: </label>{{hero.name}}</div> ' }) export class AppComponent { title = 'Tour of Heroes'; hero: Hero = { id: 10000, name: 'Windstorm' }; } export class Hero { id: number; name: string; }
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h1>{{title}}</h1> <h2>{{hero.name}} details!</h2> <div><label>id: </label>{{hero.id}}</div> <div><label>name: </label>{{hero.name}}</div> ` }) export class AppComponent { title = 'Tour of Heroes'; hero: Hero = { id: 10000, name: 'Windstorm' }; } export class Hero { id: number; name: string; }
Change template to multi-line. Should not change UI
Change template to multi-line. Should not change UI
TypeScript
mit
atbtm/Angular2-Pull-Repo,atbtm/Angular2-Pull-Repo,atbtm/Angular2-Pull-Repo
--- +++ @@ -2,12 +2,12 @@ @Component({ selector: 'my-app', - template: ' + template: ` <h1>{{title}}</h1> <h2>{{hero.name}} details!</h2> <div><label>id: </label>{{hero.id}}</div> <div><label>name: </label>{{hero.name}}</div> - ' + ` }) export class AppComponent { title = 'Tour of Heroes';
875226c910042e2d6b8a2d93b394bf2b38e32da7
client/Components/Overlay.tsx
client/Components/Overlay.tsx
import * as React from "react"; import * as ReactDOM from "react-dom"; interface OverlayProps { maxHeightPx?: number; handleMouseEvents?: (e: React.MouseEvent<HTMLDivElement>) => void; left?: number; top?: number; } interface OverlayState { } export class Overlay extends React.Component<OverlayProps, OverlayState> { private height?: number; public render() { const overflowAmount = Math.max((this.props.top || 0) + (this.height || 0) - window.innerHeight + 4, 0); const style: React.CSSProperties = { maxHeight: this.props.maxHeightPx || "100%", left: this.props.left || 0, top: (this.props.top - overflowAmount) || 0, }; return <div className="c-overlay" style={style} onMouseEnter={this.props.handleMouseEvents} onMouseLeave={this.props.handleMouseEvents}> {this.props.children} </div>; } public componentDidMount() { this.updateHeight(); } public componentDidUpdate() { this.updateHeight(); } private updateHeight() { let domElement = ReactDOM.findDOMNode(this); if (domElement instanceof Element) { let newHeight = domElement.getBoundingClientRect().height; if (newHeight != this.height) { this.height = newHeight; this.forceUpdate(); } } } }
import * as React from "react"; import * as ReactDOM from "react-dom"; interface OverlayProps { maxHeightPx?: number; handleMouseEvents?: (e: React.MouseEvent<HTMLDivElement>) => void; left?: number; top?: number; } interface OverlayState { height: number; } export class Overlay extends React.Component<OverlayProps, OverlayState> { constructor(props: OverlayProps) { super(props); this.state = { height: null }; } public render() { const overflowAmount = Math.max((this.props.top || 0) + this.state.height - window.innerHeight + 4, 0); const style: React.CSSProperties = { maxHeight: this.props.maxHeightPx || "100%", left: this.props.left || 0, top: (this.props.top - overflowAmount) || 0, }; return <div className="c-overlay" style={style} onMouseEnter={this.props.handleMouseEvents} onMouseLeave={this.props.handleMouseEvents}> {this.props.children} </div>; } public componentDidMount() { this.updateHeight(); } public componentDidUpdate() { this.updateHeight(); } private updateHeight() { let domElement = ReactDOM.findDOMNode(this); if (domElement instanceof Element) { let newHeight = domElement.getBoundingClientRect().height; if (newHeight != this.state.height) { this.setState({ height: newHeight, }); } } } }
Use State instead of local var for height tracking
Use State instead of local var for height tracking Removes the need for forceUpdate()
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -8,13 +8,20 @@ top?: number; } -interface OverlayState { } +interface OverlayState { + height: number; +} export class Overlay extends React.Component<OverlayProps, OverlayState> { - private height?: number; + constructor(props: OverlayProps) { + super(props); + this.state = { + height: null + }; + } public render() { - const overflowAmount = Math.max((this.props.top || 0) + (this.height || 0) - window.innerHeight + 4, 0); + const overflowAmount = Math.max((this.props.top || 0) + this.state.height - window.innerHeight + 4, 0); const style: React.CSSProperties = { maxHeight: this.props.maxHeightPx || "100%", left: this.props.left || 0, @@ -42,9 +49,10 @@ let domElement = ReactDOM.findDOMNode(this); if (domElement instanceof Element) { let newHeight = domElement.getBoundingClientRect().height; - if (newHeight != this.height) { - this.height = newHeight; - this.forceUpdate(); + if (newHeight != this.state.height) { + this.setState({ + height: newHeight, + }); } } }
452a8551bc79705a947c2337383c180a0b833a8a
ERClient/src/app/er.service.ts
ERClient/src/app/er.service.ts
import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import { Emotion } from './emotion'; import 'rxjs/Rx'; //for operators @Injectable() export class ErService { private erServerUrl = 'er'; constructor(private http: Http) {} getSampleEmotion(): Observable<Emotion> { return this.http.get(this.erServerUrl + '/emotion') .map(response => response.json() as Emotion); } getEmotion(sentence: string): Observable<Emotion> { return this.http.post(this.erServerUrl + '/sentence', sentence) .map(response => response.json() as Emotion); } }
import { Injectable } from '@angular/core'; import { Headers, RequestOptions, Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import { Emotion } from './emotion'; import 'rxjs/Rx'; //for operators @Injectable() export class ErService { private erServerUrl = 'er'; constructor(private http: Http) {} getSampleEmotion(): Observable<Emotion> { return this.http.get(this.erServerUrl + '/emotion') .map(response => response.json() as Emotion); } getEmotion(sentence: string): Observable<Emotion> { let headers = new Headers({ 'Content-Type': 'application/json' }); let options = new RequestOptions({ headers: headers }); return this.http.post(this.erServerUrl + '/sentence', JSON.stringify({sentence: sentence}), options) .map(response => response.json() as Emotion); } }
Call sentence POST API with content-type json
Call sentence POST API with content-type json
TypeScript
apache-2.0
shioyang/EmotionalReader,shioyang/EmotionalReader,shioyang/EmotionalReader
--- +++ @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Headers, Http, Response } from '@angular/http'; +import { Headers, RequestOptions, Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Observable'; import { Emotion } from './emotion'; @@ -17,7 +17,9 @@ } getEmotion(sentence: string): Observable<Emotion> { - return this.http.post(this.erServerUrl + '/sentence', sentence) + let headers = new Headers({ 'Content-Type': 'application/json' }); + let options = new RequestOptions({ headers: headers }); + return this.http.post(this.erServerUrl + '/sentence', JSON.stringify({sentence: sentence}), options) .map(response => response.json() as Emotion); } }
362a854d5af5c616007fab2054efd0eaed24fa08
src/index.ts
src/index.ts
export function Enum<V extends string>(...values: V[]): { [K in V]: K }; export function Enum< T extends { [_: string]: V }, V extends string >(definition: T): T; export function Enum(...values: any[]): object { if (typeof values[0] === "string") { const result: any = {}; for (const value of values) { result[value] = value; } return result; } else { return values[0]; } } export type Enum<T extends object> = T[keyof T]; export namespace Enum { function hasOwnProperty(obj: object, prop: string): boolean { return Object.prototype.hasOwnProperty.call(obj, prop); } export function keys< T extends { [_: string]: any } >(e: T): Array<keyof T> { const result: string[] = []; for (const prop in e) { if (hasOwnProperty(e, prop)) { result.push(prop); } } return result as Array<keyof T>; } export function values< T extends { [_: string]: any } >(e: T): Array<Enum<T>> { const result: Array<Enum<T>> = []; for (const key of keys(e)) { result.push(e[key as string]); } return result; } }
export function Enum<V extends string>(...values: V[]): { [K in V]: K }; export function Enum< T extends { [_: string]: V }, V extends string >(definition: T): T; export function Enum(...values: any[]): object { if (typeof values[0] === "string") { const result: any = {}; for (const value of values) { result[value] = value; } return result; } else { return values[0]; } } export type Enum<T extends object> = T[keyof T]; export namespace Enum { export function keys< T extends { [_: string]: any } >(e: T): Array<keyof T> { return Object.keys(e) as Array<keyof T>; } export function values< T extends { [_: string]: any } >(e: T): Array<Enum<T>> { const result: Array<Enum<T>> = []; for (const key of keys(e)) { result.push(e[key as string]); } return result; } }
Use Object.keys() instead of for..in
Use Object.keys() instead of for..in
TypeScript
mit
dphilipson/typescript-string-enums
--- +++ @@ -18,20 +18,10 @@ export type Enum<T extends object> = T[keyof T]; export namespace Enum { - function hasOwnProperty(obj: object, prop: string): boolean { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - export function keys< T extends { [_: string]: any } >(e: T): Array<keyof T> { - const result: string[] = []; - for (const prop in e) { - if (hasOwnProperty(e, prop)) { - result.push(prop); - } - } - return result as Array<keyof T>; + return Object.keys(e) as Array<keyof T>; } export function values<
2d65e3204e23104517868838dc10d5175a83fee9
common/CombatantState.ts
common/CombatantState.ts
import { DurationTiming } from "./DurationTiming"; import { StatBlock } from "./StatBlock"; export interface TagState { Text: string; DurationRemaining: number; DurationTiming: DurationTiming; DurationCombatantId: string; } export interface CombatantState { Id: string; StatBlock: StatBlock; PersistentCharacterId?: string; MaxHP: number; CurrentHP: number; TemporaryHP: number; Initiative: number; InitiativeGroup?: string; Alias: string; IndexLabel: number; Tags: string[] | TagState[]; Hidden: boolean; InterfaceVersion: string; ImageURL: string; }
import { DurationTiming } from "./DurationTiming"; import { StatBlock } from "./StatBlock"; export interface TagState { Text: string; DurationRemaining: number; DurationTiming: DurationTiming; DurationCombatantId: string; } export interface CombatantState { Id: string; StatBlock: StatBlock; PersistentCharacterId?: string; MaxHP: number; CurrentHP: number; TemporaryHP: number; Initiative: number; InitiativeGroup?: string; Alias: string; IndexLabel: number; Tags: string[] | TagState[]; Hidden: boolean; InterfaceVersion: string; }
Remove URL from combatant state
Remove URL from combatant state
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -22,5 +22,4 @@ Tags: string[] | TagState[]; Hidden: boolean; InterfaceVersion: string; - ImageURL: string; }
9e9e164267517d88420b79b83bcf8bc189602009
lib/language-idris.ts
lib/language-idris.ts
import { IdrisController } from './idris-controller' import { CompositeDisposable } from 'atom' import * as url from 'url' import { IdrisPanel } from './views/panel-view' let controller: IdrisController | null = null let subscriptions = new CompositeDisposable() export function activate() { controller = new IdrisController() const subscription = atom.commands.add( 'atom-text-editor[data-grammar~="idris"]', controller.getCommands(), ) subscriptions = new CompositeDisposable() subscriptions.add(subscription) atom.workspace.addOpener((uriToOpen: string) => { try { const { protocol, host } = url.parse(uriToOpen) if (protocol === 'idris:' && controller) { return new IdrisPanel(controller, host || '') } } catch (error) { return } }) } export const deactivate = () => { subscriptions.dispose() if (controller) { controller.destroy() } } export const provide = () => { if (controller) { controller.provideReplCompletions() } }
import { IdrisController } from './idris-controller' import { CompositeDisposable } from 'atom' import * as url from 'url' import { IdrisPanel } from './views/panel-view' let controller: IdrisController | null = null let subscriptions = new CompositeDisposable() export function activate() { controller = new IdrisController() const subscription = atom.commands.add( 'atom-text-editor[data-grammar~="idris"]', controller.getCommands(), ) subscriptions = new CompositeDisposable() subscriptions.add(subscription) atom.workspace.addOpener((uriToOpen: string) => { try { const { protocol, host } = url.parse(uriToOpen) if (protocol === 'idris:' && controller) { return new IdrisPanel(controller, host || '') } } catch (error) { return } }) } export const deactivate = () => { subscriptions.dispose() if (controller) { controller.destroy() } } export const provide = () => { if (controller) { return controller.provideReplCompletions() } }
Return autocomplete-plus provider from provide function
Return autocomplete-plus provider from provide function
TypeScript
mit
idris-hackers/atom-language-idris
--- +++ @@ -37,6 +37,6 @@ export const provide = () => { if (controller) { - controller.provideReplCompletions() + return controller.provideReplCompletions() } }
71661ff68328776b0842d53dca128e2f536d370c
time/src/run-virtually.ts
time/src/run-virtually.ts
require('setimmediate'); function runVirtually (scheduler, done, currentTime, setTime, timeToRunTo = null) { function processEvent () { const nextEvent = scheduler.peek(); if (!nextEvent) { done(); return; } const outOfTime = timeToRunTo && nextEvent.time >= timeToRunTo; if (outOfTime) { done(); return; } const eventToProcess = scheduler.shiftNextEntry(); if (eventToProcess.cancelled) { setImmediate(processEvent); return; } const time = eventToProcess.time; setTime(time); if (eventToProcess.f) { eventToProcess.f(eventToProcess, time, scheduler.add, currentTime); } if (eventToProcess.type === 'next') { eventToProcess.stream.shamefullySendNext(eventToProcess.value); } if (eventToProcess.type === 'error') { eventToProcess.stream.shamefullySendError(eventToProcess.error); } if (eventToProcess.type === 'complete') { eventToProcess.stream.shamefullySendComplete(); } setImmediate(processEvent); } setImmediate(processEvent); } export { runVirtually }
require('setimmediate'); function processEvent (args) { const {scheduler, done, currentTime, setTime, timeToRunTo} = args; const nextEvent = scheduler.peek(); const outOfTime = nextEvent && timeToRunTo && nextEvent.time >= timeToRunTo; if (!nextEvent || outOfTime) { done(); return; } const eventToProcess = scheduler.shiftNextEntry(); if (eventToProcess.cancelled) { setImmediate(processEvent, args); return; } const time = eventToProcess.time; setTime(time); if (eventToProcess.f) { eventToProcess.f(eventToProcess, time, scheduler.add, currentTime); } if (eventToProcess.type === 'next') { eventToProcess.stream.shamefullySendNext(eventToProcess.value); } if (eventToProcess.type === 'error') { eventToProcess.stream.shamefullySendError(eventToProcess.error); } if (eventToProcess.type === 'complete') { eventToProcess.stream.shamefullySendComplete(); } setImmediate(processEvent, args); } function runVirtually (scheduler, done, currentTime, setTime, timeToRunTo = null) { const args = {scheduler, done, currentTime, setTime, timeToRunTo}; setImmediate(processEvent, args); } export { runVirtually }
Refactor runVirtually to pass arguments instead of closing over
Refactor runVirtually to pass arguments instead of closing over
TypeScript
mit
feliciousx-open-source/cyclejs,usm4n/cyclejs,feliciousx-open-source/cyclejs,feliciousx-open-source/cyclejs,cyclejs/cyclejs,ntilwalli/cyclejs,ntilwalli/cyclejs,cyclejs/cyclejs,ntilwalli/cyclejs,cyclejs/cyclejs,staltz/cycle,staltz/cycle,ntilwalli/cyclejs,cyclejs/cycle-core,cyclejs/cyclejs,usm4n/cyclejs,cyclejs/cycle-core,feliciousx-open-source/cyclejs,usm4n/cyclejs,usm4n/cyclejs
--- +++ @@ -1,52 +1,49 @@ require('setimmediate'); -function runVirtually (scheduler, done, currentTime, setTime, timeToRunTo = null) { - function processEvent () { - const nextEvent = scheduler.peek(); +function processEvent (args) { + const {scheduler, done, currentTime, setTime, timeToRunTo} = args; + const nextEvent = scheduler.peek(); + const outOfTime = nextEvent && timeToRunTo && nextEvent.time >= timeToRunTo; - if (!nextEvent) { - done(); - return; - } - - const outOfTime = timeToRunTo && nextEvent.time >= timeToRunTo; - - if (outOfTime) { - done(); - return; - } - - const eventToProcess = scheduler.shiftNextEntry(); - - if (eventToProcess.cancelled) { - setImmediate(processEvent); - return; - } - - const time = eventToProcess.time; - - setTime(time); - - if (eventToProcess.f) { - eventToProcess.f(eventToProcess, time, scheduler.add, currentTime); - } - - if (eventToProcess.type === 'next') { - eventToProcess.stream.shamefullySendNext(eventToProcess.value); - } - - if (eventToProcess.type === 'error') { - eventToProcess.stream.shamefullySendError(eventToProcess.error); - } - - if (eventToProcess.type === 'complete') { - eventToProcess.stream.shamefullySendComplete(); - } - - setImmediate(processEvent); + if (!nextEvent || outOfTime) { + done(); + return; } - setImmediate(processEvent); + const eventToProcess = scheduler.shiftNextEntry(); + + if (eventToProcess.cancelled) { + setImmediate(processEvent, args); + return; + } + + const time = eventToProcess.time; + + setTime(time); + + if (eventToProcess.f) { + eventToProcess.f(eventToProcess, time, scheduler.add, currentTime); + } + + if (eventToProcess.type === 'next') { + eventToProcess.stream.shamefullySendNext(eventToProcess.value); + } + + if (eventToProcess.type === 'error') { + eventToProcess.stream.shamefullySendError(eventToProcess.error); + } + + if (eventToProcess.type === 'complete') { + eventToProcess.stream.shamefullySendComplete(); + } + + setImmediate(processEvent, args); +} + +function runVirtually (scheduler, done, currentTime, setTime, timeToRunTo = null) { + const args = {scheduler, done, currentTime, setTime, timeToRunTo}; + + setImmediate(processEvent, args); } export {
a3eea8a2444dd93db3de190bec5b3398b3b762d7
src/app/_models/user.ts
src/app/_models/user.ts
export class User { id?: string; userName: string; firstName: string; lastName: string; password: string; country: string; email: string; birthdate: string; avatar: any; contacts?: Array<string>; }
export class User { id?: string; userName: string; firstName: string; lastName: string; password: string; country: string; email: string; birthdate: string; avatar: File; contacts?: Array<string>; }
Change avatar type to File
Change avatar type to File
TypeScript
mit
tallerify/admin-panel-ui,tallerify/admin-panel-ui,tallerify/admin-panel-ui
--- +++ @@ -7,6 +7,6 @@ country: string; email: string; birthdate: string; - avatar: any; + avatar: File; contacts?: Array<string>; }