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
d4be0888033df8452efa031cd29876084986b090
app/shared/utility.service.ts
app/shared/utility.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class UtilityService{ constructor(){} groupBy(collection: any[], prop: string){ let propertiesUniqueArray: any[] = []; collection.forEach((item)=> { let val = item[prop]; if(propertiesUniqueArray.indexOf(val) > -1) propertiesUniqueArray.push(val); }); var groupedBy = propertiesUniqueArray.map((propVal)=>{ return { key: propVal, values: collection.filter(item=> item[prop] === propVal) }; }) return groupedBy; } }
import { Injectable } from '@angular/core'; @Injectable() export class UtilityService{ constructor(){} groupBy(collection: any[], prop: string){ let propertiesUniqueArray: any[] = []; collection.forEach((item)=> { let val = item[prop]; if(propertiesUniqueArray.indexOf(val) === -1) propertiesUniqueArray.push(val); }); var groupedBy = propertiesUniqueArray.map((propVal)=>{ return { key: propVal, values: collection.filter(item=> item[prop] === propVal) }; }) return groupedBy; } }
Insert into keys array when element isn't present
Insert into keys array when element isn't present
TypeScript
mit
pankajparkar/bug-tracker,pankajparkar/bug-tracker,pankajparkar/bug-tracker
--- +++ @@ -7,7 +7,7 @@ let propertiesUniqueArray: any[] = []; collection.forEach((item)=> { let val = item[prop]; - if(propertiesUniqueArray.indexOf(val) > -1) + if(propertiesUniqueArray.indexOf(val) === -1) propertiesUniqueArray.push(val); }); var groupedBy = propertiesUniqueArray.map((propVal)=>{
5eaa85c9232daf0d946299a8dd481fef4da61719
src/ts/template/counterList.ts
src/ts/template/counterList.ts
/// <reference path="../core/template" /> /// <reference path="../model/counter" /> /// <reference path="counter" /> namespace YJMCNT { /** * CounterTemplate */ export class CounterListTemplate extends Core.Template{ constructor() { super(); } counters: Counter[]; render() { var context = $("<div>"); for (var index = 0; index < this.counters.length; index++) { var counter = this.counters[index]; var template = new CounterTemplate(); template.count = counter.show(); context.append(template.render()); } return context; } } }
/// <reference path="../core/template" /> /// <reference path="../model/counter" /> /// <reference path="counter" /> namespace YJMCNT { /** * CounterTemplate */ export class CounterListTemplate extends Core.Template{ constructor() { super(); } counters: Counter[]; render() { var context = $("<div>"); for (var index = 0; index < this.counters.length; index++) { var counter = this.counters[index]; var template = new CounterTemplate(); template.count = counter.show(); template.id = counter.id; context.append(template.render()); } return context; } } }
Add counter id into counterTemplate
Add counter id into counterTemplate
TypeScript
mit
yajamon/chrome-ext-counter,yajamon/chrome-ext-counter,yajamon/chrome-ext-counter
--- +++ @@ -20,6 +20,7 @@ var counter = this.counters[index]; var template = new CounterTemplate(); template.count = counter.show(); + template.id = counter.id; context.append(template.render()); }
eef85a650a8267ce6b9a035f3568bc05a6286cfb
src/use-authors/use-authors.ts
src/use-authors/use-authors.ts
import { Author } from './authors-frontmatter-query-result' import { useAuthorsAvatars64 } from './use-authors-avatar-64' import { useAuthorsAvatarsDefault } from './use-authors-avatar-default' type UseAuthorsParams = { authorId?: string avatarSize?: { width: 64 } } function toAuthorsFilter(props: UseAuthorsParams) { if (props.authorId) { return (author: Author) => props.authorId === author.authorId } return () => false } export const useAuthors = (props: UseAuthorsParams = {}) => { let data: Author[] switch (props.avatarSize?.width) { case 64: data = useAuthorsAvatars64() break; default: data = useAuthorsAvatarsDefault() break; } const authorsFilter = toAuthorsFilter(props) return data.filter(authorsFilter) }
import { Author } from './authors-frontmatter-query-result' import { useAuthorsAvatars64 } from './use-authors-avatar-64' import { useAuthorsAvatarsDefault } from './use-authors-avatar-default' type UseAuthorsParams = { authorId?: string avatarSize?: { width: 64 } } function toAuthorsFilter(props: UseAuthorsParams) { if (props.authorId) { return (author: Author) => props.authorId === author.authorId } return () => true } export const useAuthors = (props: UseAuthorsParams = {}) => { let data: Author[] switch (props.avatarSize?.width) { case 64: data = useAuthorsAvatars64() break; default: data = useAuthorsAvatarsDefault() break; } const authorsFilter = toAuthorsFilter(props) return data.filter(authorsFilter) }
Refactor authors loading - by default list all
Refactor authors loading - by default list all #292
TypeScript
mit
bright/new-www,bright/new-www
--- +++ @@ -11,7 +11,7 @@ if (props.authorId) { return (author: Author) => props.authorId === author.authorId } - return () => false + return () => true } export const useAuthors = (props: UseAuthorsParams = {}) => {
3dafeb24a898a5f0b5068f8b9d936bb8c6573bbf
todomvc-react-mobx-typescript/src/components/TodoItem.tsx
todomvc-react-mobx-typescript/src/components/TodoItem.tsx
import * as classNames from 'classnames' import * as React from 'react' import { Component } from 'react' import { observer } from 'mobx-react' import { Todo } from './Todo' interface Props { todo: Todo } @observer export class TodoItem extends Component<Props, void> { public render() { return ( <li className={ classNames({ 'completed': this.props.todo.completed }) } > <div className="view"> <input checked={this.props.todo.completed} className="toggle" id={this.props.todo.id} onChange={() => this.props.todo.toggleCompleted()} type="checkbox" /> <label htmlFor={this.props.todo.id}>{this.props.todo.text}</label> <button className="destroy" /> </div> <input className="edit" defaultValue={this.props.todo.text} /> </li> ) } }
import * as classNames from 'classnames' import * as React from 'react' import { Component } from 'react' import { observer } from 'mobx-react' import { Todo } from './Todo' interface Props { todo: Todo } interface State { mode: 'edit' | 'view' } @observer export class TodoItem extends Component<Props, State> { constructor(props: Props, context?: any) { super(props, context) this.state = { mode: 'view' } } public render() { return ( <li className={ classNames({ 'completed': this.props.todo.completed, 'editing': this.state.mode === 'edit' }) } > <div className="view"> <input checked={this.props.todo.completed} className="toggle" id={this.props.todo.id} onChange={() => this.props.todo.toggleCompleted()} type="checkbox" /> <label htmlFor={this.props.todo.id} onDoubleClick={() => this.switchToEditMode()} > {this.props.todo.text} </label> <button className="destroy" /> </div> <input className="edit" defaultValue={this.props.todo.text} onBlur={() => this.switchToViewMode()} /> </li> ) } private switchToEditMode() { this.setState({ mode: 'edit' }) } private switchToViewMode() { this.setState({ mode: 'view' }) } }
Switch beetween edit and view mode
Switch beetween edit and view mode
TypeScript
unlicense
janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations
--- +++ @@ -9,14 +9,27 @@ todo: Todo } +interface State { + mode: 'edit' | 'view' +} + @observer -export class TodoItem extends Component<Props, void> { +export class TodoItem extends Component<Props, State> { + constructor(props: Props, context?: any) { + super(props, context) + + this.state = { + mode: 'view' + } + } + public render() { return ( <li className={ classNames({ - 'completed': this.props.todo.completed + 'completed': this.props.todo.completed, + 'editing': this.state.mode === 'edit' }) } > @@ -28,11 +41,32 @@ onChange={() => this.props.todo.toggleCompleted()} type="checkbox" /> - <label htmlFor={this.props.todo.id}>{this.props.todo.text}</label> + <label + htmlFor={this.props.todo.id} + onDoubleClick={() => this.switchToEditMode()} + > + {this.props.todo.text} + </label> <button className="destroy" /> </div> - <input className="edit" defaultValue={this.props.todo.text} /> + <input + className="edit" + defaultValue={this.props.todo.text} + onBlur={() => this.switchToViewMode()} + /> </li> ) } + + private switchToEditMode() { + this.setState({ + mode: 'edit' + }) + } + + private switchToViewMode() { + this.setState({ + mode: 'view' + }) + } }
2a91e74991f213737518a078bb0eb05ec72942d4
src/server/src/rollbar/rollbar-exception.filter.ts
src/server/src/rollbar/rollbar-exception.filter.ts
import { ArgumentsHost, Catch, HttpException } from "@nestjs/common"; import { BaseExceptionFilter } from "@nestjs/core"; import { Request } from "express"; import { RollbarService } from "./rollbar.service"; @Catch() export class RollbarExceptionFilter extends BaseExceptionFilter { constructor(private rollbar: RollbarService) { // BaseExceptionFilter will load applicationRef itself if no argument is given super(); } catch(exception: HttpException, host: ArgumentsHost): void { const ctx = host.switchToHttp(); const request = ctx.getRequest<Request>(); this.rollbar.error(exception, request); // Delegate error messaging and response to default global exception filter super.catch(exception, host); } }
import { ArgumentsHost, Catch, HttpException, NotFoundException, ServiceUnavailableException, UnauthorizedException } from "@nestjs/common"; import { BaseExceptionFilter } from "@nestjs/core"; import { Request } from "express"; import { RollbarService } from "./rollbar.service"; function isWhitelisted(exception: HttpException) { // Note that we don't need to whitelist BadRequestException as it has it's // own exception filter already return ( exception instanceof NotFoundException || exception instanceof ServiceUnavailableException || exception instanceof UnauthorizedException ); } @Catch() export class RollbarExceptionFilter extends BaseExceptionFilter { constructor(private rollbar: RollbarService) { // BaseExceptionFilter will load applicationRef itself if no argument is given super(); } catch(exception: unknown, host: ArgumentsHost): void { if (exception instanceof HttpException && !isWhitelisted(exception)) { const ctx = host.switchToHttp(); const request = ctx.getRequest<Request>(); this.rollbar.error(exception, request); } // Delegate error messaging and response to default global exception filter super.catch(exception, host); } }
Whitelist a few exception types from being reported to Rollbar
Whitelist a few exception types from being reported to Rollbar These are "normal" exceptions that don't necessarily indicate an error with the website, and as such it would be wasteful to report them to Rollbar Closes #388
TypeScript
apache-2.0
PublicMapping/DistrictBuilder,PublicMapping/DistrictBuilder,PublicMapping/DistrictBuilder,PublicMapping/DistrictBuilder,PublicMapping/DistrictBuilder
--- +++ @@ -1,7 +1,24 @@ -import { ArgumentsHost, Catch, HttpException } from "@nestjs/common"; +import { + ArgumentsHost, + Catch, + HttpException, + NotFoundException, + ServiceUnavailableException, + UnauthorizedException +} from "@nestjs/common"; import { BaseExceptionFilter } from "@nestjs/core"; import { Request } from "express"; import { RollbarService } from "./rollbar.service"; + +function isWhitelisted(exception: HttpException) { + // Note that we don't need to whitelist BadRequestException as it has it's + // own exception filter already + return ( + exception instanceof NotFoundException || + exception instanceof ServiceUnavailableException || + exception instanceof UnauthorizedException + ); +} @Catch() export class RollbarExceptionFilter extends BaseExceptionFilter { @@ -10,11 +27,13 @@ super(); } - catch(exception: HttpException, host: ArgumentsHost): void { - const ctx = host.switchToHttp(); - const request = ctx.getRequest<Request>(); + catch(exception: unknown, host: ArgumentsHost): void { + if (exception instanceof HttpException && !isWhitelisted(exception)) { + const ctx = host.switchToHttp(); + const request = ctx.getRequest<Request>(); - this.rollbar.error(exception, request); + this.rollbar.error(exception, request); + } // Delegate error messaging and response to default global exception filter super.catch(exception, host);
4c0e83405b43c3da72e2a48bfc84c29f4d3b78ad
server/dbconnection.ts
server/dbconnection.ts
import mongo = require("mongodb"); const client = mongo.MongoClient; interface Db extends mongo.Db { users: mongo.Collection; } export const initialize = () => { if (!process.env.DB_CONNECTION_STRING) { console.error("No connection string found."); return; } client.connect(process.env.DB_CONNECTION_STRING, function (err, db: Db) { if (err) { return; } if (!db.users) { db.createCollection("users"); } }); }; export const upsertUser = (patreonId: string, accessKey: string, refreshKey: string, accountStatus: string, res) => { if (!process.env.DB_CONNECTION_STRING) { console.error("No connection string found."); return; } client.connect(process.env.DB_CONNECTION_STRING, function (err, db: Db) { if (err) { res.json(err); return; } db.users.updateOne( { patreonId }, { patreonId, accessKey, refreshKey, accountStatus }, { upsert: true }, (err, result) => { if (err) { res.json(err); } res.json(result); }); }); }
import mongo = require("mongodb"); const client = mongo.MongoClient; export const initialize = () => { if (!process.env.DB_CONNECTION_STRING) { console.error("No connection string found."); return; } client.connect(process.env.DB_CONNECTION_STRING, function (err, db: Db) { if (err) { return; } if (!db.users) { db.createCollection("users"); } }); }; export const upsertUser = (patreonId: string, accessKey: string, refreshKey: string, accountStatus: string, res) => { if (!process.env.DB_CONNECTION_STRING) { console.error("No connection string found."); return; } client.connect(process.env.DB_CONNECTION_STRING, function (err, db: mongo.Db) { if (err) { res.json(err); return; } const users = db.collection("users"); users.updateOne( { patreonId }, { patreonId, accessKey, refreshKey, accountStatus }, { upsert: true }, (err, result) => { if (err) { res.json(err); } res.json(result); }); }); }
Correct mongodb api collection access
Correct mongodb api collection access
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -1,10 +1,6 @@ import mongo = require("mongodb"); const client = mongo.MongoClient; -interface Db extends mongo.Db { - users: mongo.Collection; -} - export const initialize = () => { if (!process.env.DB_CONNECTION_STRING) { console.error("No connection string found."); @@ -28,12 +24,14 @@ return; } - client.connect(process.env.DB_CONNECTION_STRING, function (err, db: Db) { + client.connect(process.env.DB_CONNECTION_STRING, function (err, db: mongo.Db) { if (err) { res.json(err); return; } - db.users.updateOne( + + const users = db.collection("users"); + users.updateOne( { patreonId },
d9208fa1c51e90e637ec38ba64fd2e975f20c427
app/app.component.ts
app/app.component.ts
import { Component, ViewChild } from '@angular/core'; import { LayerType } from './core/layer'; import { CityMapComponent } from './city-map/city-map.component' @Component({ selector: 'aba-plan', templateUrl: 'app.component.html' }) export class AppComponent { title = "AbaPlan"; @ViewChild(CityMapComponent) mapComponent:CityMapComponent; public tabs: Array<any> = [ { heading: 'Plan OSM', kind : 'osm' }, { heading: 'Plan de quartier', kind : 'square' }, { heading: 'Plan de ville', kind : 'city' } ]; public activeTab: string = this.tabs[0].heading; public isActive(tab: any) { return tab.heading === this.activeTab; } public onSelect(tab: any) { this.activeTab = tab.heading; this.mapComponent.setLayerType(tab); } constructor() { // Select first tab // this.onSelect(this.tabs[0]); } }
import { Component, ViewChild } from '@angular/core'; import { LayerType } from './core/layer'; import { CityMapComponent } from './city-map/city-map.component' @Component({ selector: 'aba-plan', templateUrl: 'app.component.html' }) export class AppComponent { title = "AbaPlan"; @ViewChild(CityMapComponent) mapComponent:CityMapComponent; public tabs: Array<any> = [ { heading: 'Plan OSM', kind : 'osm' }, { heading: 'Plan de quartier', kind : 'square' }, { heading: 'Plan de ville', kind : 'city' } ]; public activeTab: string = this.tabs[0].heading; public isActive(tab: any) { return tab.heading === this.activeTab; } public onSelect(tab: any) { this.activeTab = tab.heading; this.mapComponent.setLayerType(tab); } ngAfterViewInit() { // Init first tab this.onSelect(this.tabs[0]); } constructor() { } }
Add default tab to first
Add default tab to first
TypeScript
mit
ABAPlan/abaplan-core,ABAPlan/abaplan-core,ABAPlan/abaplan-core
--- +++ @@ -39,9 +39,12 @@ this.mapComponent.setLayerType(tab); } + ngAfterViewInit() { + // Init first tab + this.onSelect(this.tabs[0]); + } + constructor() { - // Select first tab - // this.onSelect(this.tabs[0]); } }
3ec86215aa444ca34f19e1a7dba434e0c46791a0
rest/rest-tests.ts
rest/rest-tests.ts
/// <reference path="./rest.d.ts" /> import rest = require('rest'); import mime = require('rest/interceptor/mime'); import errorCode = require('rest/interceptor/errorCode'); import registry = require('rest/mime/registry'); rest('/').then(function(response) { console.log('response: ', response); }); var client = rest.wrap(mime); client({ path: '/data.json' }).then(function(response) { console.log('response: ', response); }); client = rest.wrap(mime).wrap(errorCode, { code: 500 }); client({ path: '/data.json' }).then( function(response) { console.log('response: ', response); }, function(response) { console.error('response error: ', response); } ); registry.register('application/vnd.com.example', { read: function(str: string) { var obj: any; // do string to object conversions return obj; }, write: function(obj: any) { var str: string; // do object to string conversions return str; } });
/// <reference path="./rest.d.ts" /> import rest = require('rest'); import mime = require('rest/interceptor/mime'); import errorCode = require('rest/interceptor/errorCode'); import registry = require('rest/mime/registry'); rest('/').then(function(response) { console.log('response: ', response); }); var client = rest.wrap(mime); client({ path: '/data.json' }).then(function(response) { console.log('response: ', response); }); client = rest.wrap(mime, { mime: 'application/json' }).wrap(errorCode, { code: 500 }); client({ path: '/data.json' }).then( function(response) { console.log('response: ', response); }, function(response) { console.error('response error: ', response); } ); registry.register('application/vnd.com.example', { read: function(str: string) { var obj: any; // do string to object conversions return obj; }, write: function(obj: any) { var str: string; // do object to string conversions return str; } });
Fix tests to check config from base `rest.wrap`
Fix tests to check config from base `rest.wrap`
TypeScript
mit
rcchen/DefinitelyTyped,olemp/DefinitelyTyped,shlomiassaf/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,PopSugar/DefinitelyTyped,Karabur/DefinitelyTyped,gandjustas/DefinitelyTyped,nycdotnet/DefinitelyTyped,acepoblete/DefinitelyTyped,pocke/DefinitelyTyped,tomtheisen/DefinitelyTyped,QuatroCode/DefinitelyTyped,frogcjn/DefinitelyTyped,nmalaguti/DefinitelyTyped,nobuoka/DefinitelyTyped,DeluxZ/DefinitelyTyped,jraymakers/DefinitelyTyped,arusakov/DefinitelyTyped,gildorwang/DefinitelyTyped,tinganho/DefinitelyTyped,spearhead-ea/DefinitelyTyped,shovon/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,lbguilherme/DefinitelyTyped,tomtarrot/DefinitelyTyped,mszczepaniak/DefinitelyTyped,eugenpodaru/DefinitelyTyped,DustinWehr/DefinitelyTyped,Jwsonic/DefinitelyTyped,abner/DefinitelyTyped,vpineda1996/DefinitelyTyped,awerlang/DefinitelyTyped,cherrydev/DefinitelyTyped,glenndierckx/DefinitelyTyped,mjjames/DefinitelyTyped,florentpoujol/DefinitelyTyped,georgemarshall/DefinitelyTyped,bennett000/DefinitelyTyped,YousefED/DefinitelyTyped,elisee/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,sclausen/DefinitelyTyped,one-pieces/DefinitelyTyped,olivierlemasle/DefinitelyTyped,pocesar/DefinitelyTyped,onecentlin/DefinitelyTyped,goaty92/DefinitelyTyped,Penryn/DefinitelyTyped,florentpoujol/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,Bobjoy/DefinitelyTyped,Ptival/DefinitelyTyped,raijinsetsu/DefinitelyTyped,aroder/DefinitelyTyped,musakarakas/DefinitelyTyped,hatz48/DefinitelyTyped,scriby/DefinitelyTyped,mrk21/DefinitelyTyped,Chris380/DefinitelyTyped,bdoss/DefinitelyTyped,DenEwout/DefinitelyTyped,jasonswearingen/DefinitelyTyped,musically-ut/DefinitelyTyped,Zenorbi/DefinitelyTyped,nfriend/DefinitelyTyped,jasonswearingen/DefinitelyTyped,moonpyk/DefinitelyTyped,jbrantly/DefinitelyTyped,danfma/DefinitelyTyped,lucyhe/DefinitelyTyped,damianog/DefinitelyTyped,behzad888/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,paulmorphy/DefinitelyTyped,benishouga/DefinitelyTyped,syuilo/DefinitelyTyped,IAPark/DefinitelyTyped,nakakura/DefinitelyTyped,gandjustas/DefinitelyTyped,Saneyan/DefinitelyTyped,vagarenko/DefinitelyTyped,Seikho/DefinitelyTyped,robl499/DefinitelyTyped,blink1073/DefinitelyTyped,nelsonmorais/DefinitelyTyped,ajtowf/DefinitelyTyped,stanislavHamara/DefinitelyTyped,jsaelhof/DefinitelyTyped,jtlan/DefinitelyTyped,YousefED/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,bkristensen/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,jeffbcross/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,zuzusik/DefinitelyTyped,igorsechyn/DefinitelyTyped,raijinsetsu/DefinitelyTyped,Dominator008/DefinitelyTyped,MarlonFan/DefinitelyTyped,kuon/DefinitelyTyped,fredgalvao/DefinitelyTyped,Kuniwak/DefinitelyTyped,Lorisu/DefinitelyTyped,EnableSoftware/DefinitelyTyped,hellopao/DefinitelyTyped,esperco/DefinitelyTyped,evandrewry/DefinitelyTyped,zalamtech/DefinitelyTyped,vsavkin/DefinitelyTyped,xStrom/DefinitelyTyped,bdoss/DefinitelyTyped,nodeframe/DefinitelyTyped,takenet/DefinitelyTyped,jsaelhof/DefinitelyTyped,pkhayundi/DefinitelyTyped,zensh/DefinitelyTyped,OpenMaths/DefinitelyTyped,chadoliver/DefinitelyTyped,hafenr/DefinitelyTyped,hellopao/DefinitelyTyped,chrilith/DefinitelyTyped,Trapulo/DefinitelyTyped,progre/DefinitelyTyped,shlomiassaf/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,digitalpixies/DefinitelyTyped,dsebastien/DefinitelyTyped,nainslie/DefinitelyTyped,greglockwood/DefinitelyTyped,CSharpFan/DefinitelyTyped,Pro/DefinitelyTyped,damianog/DefinitelyTyped,rushi216/DefinitelyTyped,isman-usoh/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,psnider/DefinitelyTyped,alexdresko/DefinitelyTyped,Karabur/DefinitelyTyped,xica/DefinitelyTyped,haskellcamargo/DefinitelyTyped,nitintutlani/DefinitelyTyped,mcrawshaw/DefinitelyTyped,PascalSenn/DefinitelyTyped,timramone/DefinitelyTyped,nmalaguti/DefinitelyTyped,mshmelev/DefinitelyTyped,Ptival/DefinitelyTyped,Dashlane/DefinitelyTyped,applesaucers/lodash-invokeMap,AgentME/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,schmuli/DefinitelyTyped,arusakov/DefinitelyTyped,donnut/DefinitelyTyped,maxlang/DefinitelyTyped,mhegazy/DefinitelyTyped,syuilo/DefinitelyTyped,zuzusik/DefinitelyTyped,stacktracejs/DefinitelyTyped,use-strict/DefinitelyTyped,Zzzen/DefinitelyTyped,mattblang/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,borisyankov/DefinitelyTyped,rolandzwaga/DefinitelyTyped,eekboom/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,alainsahli/DefinitelyTyped,lightswitch05/DefinitelyTyped,mshmelev/DefinitelyTyped,frogcjn/DefinitelyTyped,laco0416/DefinitelyTyped,sclausen/DefinitelyTyped,nakakura/DefinitelyTyped,OfficeDev/DefinitelyTyped,lukehoban/DefinitelyTyped,alextkachman/DefinitelyTyped,subash-a/DefinitelyTyped,wbuchwalter/DefinitelyTyped,michalczukm/DefinitelyTyped,xswordsx/DefinitelyTyped,corps/DefinitelyTyped,jraymakers/DefinitelyTyped,Pro/DefinitelyTyped,vincentw56/DefinitelyTyped,sledorze/DefinitelyTyped,behzad88/DefinitelyTyped,stacktracejs/DefinitelyTyped,alvarorahul/DefinitelyTyped,daptiv/DefinitelyTyped,philippstucki/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,rfranco/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,greglo/DefinitelyTyped,stephenjelfs/DefinitelyTyped,omidkrad/DefinitelyTyped,shiwano/DefinitelyTyped,vote539/DefinitelyTyped,mattanja/DefinitelyTyped,superduper/DefinitelyTyped,JaminFarr/DefinitelyTyped,hiraash/DefinitelyTyped,abbasmhd/DefinitelyTyped,QuatroCode/DefinitelyTyped,kanreisa/DefinitelyTyped,minodisk/DefinitelyTyped,rschmukler/DefinitelyTyped,dydek/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,abner/DefinitelyTyped,Ridermansb/DefinitelyTyped,georgemarshall/DefinitelyTyped,robertbaker/DefinitelyTyped,the41/DefinitelyTyped,MugeSo/DefinitelyTyped,lseguin42/DefinitelyTyped,emanuelhp/DefinitelyTyped,erosb/DefinitelyTyped,Litee/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,theyelllowdart/DefinitelyTyped,tdmckinn/DefinitelyTyped,dreampulse/DefinitelyTyped,vote539/DefinitelyTyped,evansolomon/DefinitelyTyped,greglo/DefinitelyTyped,syntax42/DefinitelyTyped,adamcarr/DefinitelyTyped,muenchdo/DefinitelyTyped,zhiyiting/DefinitelyTyped,felipe3dfx/DefinitelyTyped,stylelab-io/DefinitelyTyped,pocesar/DefinitelyTyped,teddyward/DefinitelyTyped,chrootsu/DefinitelyTyped,drinchev/DefinitelyTyped,emanuelhp/DefinitelyTyped,hesselink/DefinitelyTyped,UzEE/DefinitelyTyped,Zzzen/DefinitelyTyped,scatcher/DefinitelyTyped,mcliment/DefinitelyTyped,newclear/DefinitelyTyped,mhegazy/DefinitelyTyped,brentonhouse/DefinitelyTyped,gregoryagu/DefinitelyTyped,ayanoin/DefinitelyTyped,grahammendick/DefinitelyTyped,psnider/DefinitelyTyped,hatz48/DefinitelyTyped,rolandzwaga/DefinitelyTyped,deeleman/DefinitelyTyped,whoeverest/DefinitelyTyped,uestcNaldo/DefinitelyTyped,zuohaocheng/DefinitelyTyped,dumbmatter/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,MidnightDesign/DefinitelyTyped,Almouro/DefinitelyTyped,zuzusik/DefinitelyTyped,angelobelchior8/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,duongphuhiep/DefinitelyTyped,Zorgatone/DefinitelyTyped,tigerxy/DefinitelyTyped,ml-workshare/DefinitelyTyped,darkl/DefinitelyTyped,davidpricedev/DefinitelyTyped,Nemo157/DefinitelyTyped,lbesson/DefinitelyTyped,RedSeal-co/DefinitelyTyped,mweststrate/DefinitelyTyped,bpowers/DefinitelyTyped,behzad888/DefinitelyTyped,jacqt/DefinitelyTyped,Zorgatone/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,Syati/DefinitelyTyped,abmohan/DefinitelyTyped,dflor003/DefinitelyTyped,applesaucers/lodash-invokeMap,dsebastien/DefinitelyTyped,cvrajeesh/DefinitelyTyped,dariajung/DefinitelyTyped,Shiak1/DefinitelyTyped,Mek7/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,alvarorahul/DefinitelyTyped,martinduparc/DefinitelyTyped,algorithme/DefinitelyTyped,fredgalvao/DefinitelyTyped,adammartin1981/DefinitelyTyped,danfma/DefinitelyTyped,scsouthw/DefinitelyTyped,nobuoka/DefinitelyTyped,aqua89/DefinitelyTyped,egeland/DefinitelyTyped,herrmanno/DefinitelyTyped,glenndierckx/DefinitelyTyped,RX14/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,stephenjelfs/DefinitelyTyped,shiwano/DefinitelyTyped,opichals/DefinitelyTyped,gcastre/DefinitelyTyped,bardt/DefinitelyTyped,xStrom/DefinitelyTyped,mrozhin/DefinitelyTyped,dpsthree/DefinitelyTyped,mendix/DefinitelyTyped,pafflique/DefinitelyTyped,bennett000/DefinitelyTyped,amir-arad/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,dmoonfire/DefinitelyTyped,rschmukler/DefinitelyTyped,timjk/DefinitelyTyped,HereSinceres/DefinitelyTyped,schmuli/DefinitelyTyped,unknownloner/DefinitelyTyped,laball/DefinitelyTyped,bencoveney/DefinitelyTyped,benishouga/DefinitelyTyped,nitintutlani/DefinitelyTyped,DeadAlready/DefinitelyTyped,GregOnNet/DefinitelyTyped,nabeix/DefinitelyTyped,giggio/DefinitelyTyped,arcticwaters/DefinitelyTyped,mareek/DefinitelyTyped,dwango-js/DefinitelyTyped,sledorze/DefinitelyTyped,KonaTeam/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,TildaLabs/DefinitelyTyped,axelcostaspena/DefinitelyTyped,LordJZ/DefinitelyTyped,billccn/DefinitelyTyped,optical/DefinitelyTyped,mattblang/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,tjoskar/DefinitelyTyped,Pipe-shen/DefinitelyTyped,masonkmeyer/DefinitelyTyped,wcomartin/DefinitelyTyped,icereed/DefinitelyTyped,vasek17/DefinitelyTyped,teves-castro/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,ashwinr/DefinitelyTyped,arueckle/DefinitelyTyped,aindlq/DefinitelyTyped,almstrand/DefinitelyTyped,WritingPanda/DefinitelyTyped,rcchen/DefinitelyTyped,bilou84/DefinitelyTyped,NCARalph/DefinitelyTyped,Deathspike/DefinitelyTyped,samdark/DefinitelyTyped,jimthedev/DefinitelyTyped,leoromanovsky/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,olemp/DefinitelyTyped,pwelter34/DefinitelyTyped,kabogo/DefinitelyTyped,musicist288/DefinitelyTyped,tscho/DefinitelyTyped,tan9/DefinitelyTyped,jesseschalken/DefinitelyTyped,yuit/DefinitelyTyped,psnider/DefinitelyTyped,chocolatechipui/DefinitelyTyped,reppners/DefinitelyTyped,dydek/DefinitelyTyped,Dashlane/DefinitelyTyped,rerezz/DefinitelyTyped,aciccarello/DefinitelyTyped,maglar0/DefinitelyTyped,ashwinr/DefinitelyTyped,brettle/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,amanmahajan7/DefinitelyTyped,Carreau/DefinitelyTyped,martinduparc/DefinitelyTyped,optical/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,elisee/DefinitelyTyped,georgemarshall/DefinitelyTyped,bluong/DefinitelyTyped,munxar/DefinitelyTyped,progre/DefinitelyTyped,gorcz/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,davidsidlinger/DefinitelyTyped,forumone/DefinitelyTyped,jpevarnek/DefinitelyTyped,reppners/DefinitelyTyped,Penryn/DefinitelyTyped,subash-a/DefinitelyTyped,vagarenko/DefinitelyTyped,smrq/DefinitelyTyped,chrootsu/DefinitelyTyped,trystanclarke/DefinitelyTyped,philippstucki/DefinitelyTyped,fnipo/DefinitelyTyped,mattanja/DefinitelyTyped,Fraegle/DefinitelyTyped,paulmorphy/DefinitelyTyped,nycdotnet/DefinitelyTyped,borisyankov/DefinitelyTyped,johan-gorter/DefinitelyTyped,magny/DefinitelyTyped,alexdresko/DefinitelyTyped,RX14/DefinitelyTyped,micurs/DefinitelyTyped,MugeSo/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,aldo-roman/DefinitelyTyped,igorraush/DefinitelyTyped,furny/DefinitelyTyped,bjfletcher/DefinitelyTyped,takfjt/DefinitelyTyped,rockclimber90/DefinitelyTyped,minodisk/DefinitelyTyped,newclear/DefinitelyTyped,trystanclarke/DefinitelyTyped,basp/DefinitelyTyped,kalloc/DefinitelyTyped,UzEE/DefinitelyTyped,magny/DefinitelyTyped,sixinli/DefinitelyTyped,tan9/DefinitelyTyped,chrismbarr/DefinitelyTyped,chrismbarr/DefinitelyTyped,pocesar/DefinitelyTyped,AgentME/DefinitelyTyped,Minishlink/DefinitelyTyped,alextkachman/DefinitelyTyped,yuit/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,HPFOD/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,M-Zuber/DefinitelyTyped,gyohk/DefinitelyTyped,gcastre/DefinitelyTyped,gedaiu/DefinitelyTyped,Garciat/DefinitelyTyped,tarruda/DefinitelyTyped,AgentME/DefinitelyTyped,smrq/DefinitelyTyped,jimthedev/DefinitelyTyped,tboyce/DefinitelyTyped,drinchev/DefinitelyTyped,GodsBreath/DefinitelyTyped,hx0day/DefinitelyTyped,ryan10132/DefinitelyTyped,use-strict/DefinitelyTyped,benishouga/DefinitelyTyped,davidpricedev/DefinitelyTyped,markogresak/DefinitelyTyped,benliddicott/DefinitelyTyped,schmuli/DefinitelyTyped,hellopao/DefinitelyTyped,flyfishMT/DefinitelyTyped,HPFOD/DefinitelyTyped,arma-gast/DefinitelyTyped,nseckinoral/DefinitelyTyped,bruennijs/DefinitelyTyped,jaysoo/DefinitelyTyped,esperco/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,teves-castro/DefinitelyTyped,drillbits/DefinitelyTyped,paxibay/DefinitelyTyped,mcrawshaw/DefinitelyTyped,nainslie/DefinitelyTyped,Gmulti/DefinitelyTyped,amanmahajan7/DefinitelyTyped,manekovskiy/DefinitelyTyped,jeremyhayes/DefinitelyTyped,wilfrem/DefinitelyTyped,ciriarte/DefinitelyTyped,onecentlin/DefinitelyTyped,shahata/DefinitelyTyped,mareek/DefinitelyTyped,hypno2000/typings,nojaf/DefinitelyTyped,dmoonfire/DefinitelyTyped,wkrueger/DefinitelyTyped,Litee/DefinitelyTyped,jiaz/DefinitelyTyped,aciccarello/DefinitelyTyped,isman-usoh/DefinitelyTyped,ErykB2000/DefinitelyTyped,takenet/DefinitelyTyped,hor-crux/DefinitelyTyped,Dominator008/DefinitelyTyped,abbasmhd/DefinitelyTyped,fearthecowboy/DefinitelyTyped,scriby/DefinitelyTyped,subjectix/DefinitelyTyped,innerverse/DefinitelyTyped,ecramer89/DefinitelyTyped,samwgoldman/DefinitelyTyped,Seltzer/DefinitelyTyped,martinduparc/DefinitelyTyped,EnableSoftware/DefinitelyTyped,kmeurer/DefinitelyTyped,aciccarello/DefinitelyTyped,ajtowf/DefinitelyTyped,biomassives/DefinitelyTyped,pwelter34/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,gdi2290/DefinitelyTyped,jimthedev/DefinitelyTyped,TheBay0r/DefinitelyTyped,robert-voica/DefinitelyTyped,brainded/DefinitelyTyped,quantumman/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,NelsonLamprecht/DefinitelyTyped,gyohk/DefinitelyTyped,arusakov/DefinitelyTyped,flyfishMT/DefinitelyTyped,dragouf/DefinitelyTyped,egeland/DefinitelyTyped,mwain/DefinitelyTyped,ducin/DefinitelyTyped,richardTowers/DefinitelyTyped,mjjames/DefinitelyTyped,wilfrem/DefinitelyTyped,sandersky/DefinitelyTyped,johan-gorter/DefinitelyTyped,mvarblow/DefinitelyTyped,georgemarshall/DefinitelyTyped,arma-gast/DefinitelyTyped,donnut/DefinitelyTyped,arcticwaters/DefinitelyTyped,AgentME/DefinitelyTyped,Syati/DefinitelyTyped,OpenMaths/DefinitelyTyped,duncanmak/DefinitelyTyped,lekaha/DefinitelyTyped,chbrown/DefinitelyTyped,Riron/DefinitelyTyped
--- +++ @@ -15,7 +15,7 @@ console.log('response: ', response); }); -client = rest.wrap(mime).wrap(errorCode, { code: 500 }); +client = rest.wrap(mime, { mime: 'application/json' }).wrap(errorCode, { code: 500 }); client({ path: '/data.json' }).then( function(response) { console.log('response: ', response);
4546d92e40a253047d9648c0749578429dce1c3f
client/src/app/shared/shared-main/misc/channels-setup-message.component.ts
client/src/app/shared/shared-main/misc/channels-setup-message.component.ts
import { Component, Input, OnInit } from '@angular/core' import { AuthService, User } from '@app/core' import { VideoChannel } from '@app/shared/shared-main' @Component({ selector: 'my-channels-setup-message', templateUrl: './channels-setup-message.component.html', styleUrls: [ './channels-setup-message.component.scss' ] }) export class ChannelsSetupMessageComponent implements OnInit { @Input() hideLink = false user: User = null constructor ( private authService: AuthService ) {} get userInformationLoaded () { return this.authService.userInformationLoaded } get hasChannelNotConfigured () { return this.user.videoChannels .filter((channel: VideoChannel) => (!channel.avatar || !channel.description)) .length > 0 } ngOnInit () { this.user = this.authService.getUser() } }
import { Component, Input, OnInit } from '@angular/core' import { AuthService, User } from '@app/core' import { VideoChannel } from '@app/shared/shared-main' @Component({ selector: 'my-channels-setup-message', templateUrl: './channels-setup-message.component.html', styleUrls: [ './channels-setup-message.component.scss' ] }) export class ChannelsSetupMessageComponent implements OnInit { @Input() hideLink = false user: User = null constructor ( private authService: AuthService ) {} get hasChannelNotConfigured () { if (!this.user.videoChannels) return return this.user.videoChannels.filter((channel: VideoChannel) => (!channel.avatar || !channel.description)).length > 0 } ngOnInit () { this.user = this.authService.getUser() } }
Fix undefined this.user.videoChannels on production build
Fix undefined this.user.videoChannels on production build
TypeScript
agpl-3.0
Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube
--- +++ @@ -16,14 +16,10 @@ private authService: AuthService ) {} - get userInformationLoaded () { - return this.authService.userInformationLoaded - } + get hasChannelNotConfigured () { + if (!this.user.videoChannels) return - get hasChannelNotConfigured () { - return this.user.videoChannels - .filter((channel: VideoChannel) => (!channel.avatar || !channel.description)) - .length > 0 + return this.user.videoChannels.filter((channel: VideoChannel) => (!channel.avatar || !channel.description)).length > 0 } ngOnInit () {
fd87743f5454dfd4747674d32dd18bf7ad4f99fc
analysis/monkwindwalker/src/modules/resources/SpellChiCost.ts
analysis/monkwindwalker/src/modules/resources/SpellChiCost.ts
import SPELLS from 'common/SPELLS'; import RESOURCE_TYPES from 'game/RESOURCE_TYPES'; import { CastEvent } from 'parser/core/Events'; import SpellResourceCost from 'parser/shared/modules/SpellResourceCost'; class SpellChiCost extends SpellResourceCost { static resourceType = RESOURCE_TYPES.CHI; protected getRawResourceCost(event: CastEvent) { let cost = super.getRawResourceCost(event); // Blackout Kick costs 3 chi when learned, but is reduced in cost during levelling if (event.ability.guid === SPELLS.BLACKOUT_KICK.id) { cost = 1; } return cost; } protected getResourceCost(event: CastEvent) { let cost = super.getResourceCost(event); if (this.selectedCombatant.hasBuff(SPELLS.WEAPONS_OF_ORDER_CHI_DISCOUNT.id)) { cost -= 1; } return cost; } } export default SpellChiCost;
import SPELLS from 'common/SPELLS'; import RESOURCE_TYPES from 'game/RESOURCE_TYPES'; import { CastEvent } from 'parser/core/Events'; import SpellResourceCost from 'parser/shared/modules/SpellResourceCost'; class SpellChiCost extends SpellResourceCost { static resourceType = RESOURCE_TYPES.CHI; protected getRawResourceCost(event: CastEvent) { let cost = super.getRawResourceCost(event); // Blackout Kick costs 3 chi when learned, but is reduced in cost during levelling if (event.ability.guid === SPELLS.BLACKOUT_KICK.id) { cost = 1; } return cost; } protected getResourceCost(event: CastEvent) { let cost = super.getResourceCost(event); // Example // https://www.warcraftlogs.com/reports/GDqkTZ9JVr7AjH4X/#fight=33&source=4&type=damage-done if (this.selectedCombatant.hasBuff(SPELLS.WEAPONS_OF_ORDER_CHI_DISCOUNT.id)) { cost -= 1; } return cost; } } export default SpellChiCost;
Add example of WOO chi reduction
Add example of WOO chi reduction
TypeScript
agpl-3.0
sMteX/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer,sMteX/WoWAnalyzer
--- +++ @@ -20,6 +20,8 @@ protected getResourceCost(event: CastEvent) { let cost = super.getResourceCost(event); + // Example + // https://www.warcraftlogs.com/reports/GDqkTZ9JVr7AjH4X/#fight=33&source=4&type=damage-done if (this.selectedCombatant.hasBuff(SPELLS.WEAPONS_OF_ORDER_CHI_DISCOUNT.id)) { cost -= 1; }
559e8f85fdbe28686e6d9095db38440964d9d203
lib/commands/prop/prop-set.ts
lib/commands/prop/prop-set.ts
///<reference path="../../.d.ts"/> "use strict"; import projectPropertyCommandBaseLib = require("./prop-command-base"); export class SetProjectPropertyCommand extends projectPropertyCommandBaseLib.ProjectPropertyCommandBase implements ICommand { constructor($staticConfig: IStaticConfig, $injector: IInjector) { super($staticConfig, $injector); this.$project.ensureProject(); } canExecute(args: string[]): IFuture<boolean> { return (() => { var property = args[0]; var propertyValues = _.rest(args, 1); if(this.$project.validateProjectProperty(property, propertyValues, "set").wait()) { if(propertyValues.length === 1 && propertyValues[0]) { return true; } } return false; }).future<boolean>()(); } execute(args: string[]): IFuture<void> { return this.$project.updateProjectPropertyAndSave("set", args[0], _.rest(args, 1)); } allowedParameters: ICommandParameter[] = []; } $injector.registerCommand("prop|set", SetProjectPropertyCommand);
///<reference path="../../.d.ts"/> "use strict"; import projectPropertyCommandBaseLib = require("./prop-command-base"); export class SetProjectPropertyCommand extends projectPropertyCommandBaseLib.ProjectPropertyCommandBase implements ICommand { constructor($staticConfig: IStaticConfig, $injector: IInjector) { super($staticConfig, $injector); this.$project.ensureProject(); } canExecute(args: string[]): IFuture<boolean> { var property = args[0]; var propertyValues = _.rest(args, 1); return this.$project.validateProjectProperty(property, propertyValues, "set"); } execute(args: string[]): IFuture<void> { return this.$project.updateProjectPropertyAndSave("set", args[0], _.rest(args, 1)); } allowedParameters: ICommandParameter[] = []; } $injector.registerCommand("prop|set", SetProjectPropertyCommand);
Allow setting of multiple values with prop set
Allow setting of multiple values with prop set `$ appbuilder prop set` should work for setting array values. Remove incorrect validation logic which was allowing only singe value to be used. Fixes http://teampulse.telerik.com/view#item/289487
TypeScript
apache-2.0
Icenium/icenium-cli,Icenium/icenium-cli
--- +++ @@ -10,17 +10,9 @@ } canExecute(args: string[]): IFuture<boolean> { - return (() => { var property = args[0]; var propertyValues = _.rest(args, 1); - if(this.$project.validateProjectProperty(property, propertyValues, "set").wait()) { - if(propertyValues.length === 1 && propertyValues[0]) { - return true; - } - } - - return false; - }).future<boolean>()(); + return this.$project.validateProjectProperty(property, propertyValues, "set"); } execute(args: string[]): IFuture<void> {
2d3df0d6d9e7d173b2990c9f62ec923a000a9036
app/components/docedit/widgets/relationspick/relation-picker-group.component.ts
app/components/docedit/widgets/relationspick/relation-picker-group.component.ts
import {Component, Input, OnChanges} from '@angular/core'; import {isEmpty} from 'tsfun'; /** * @author Thomas Kleinke */ @Component({ moduleId: module.id, selector: 'relation-picker-group', templateUrl: './relation-picker-group.html' }) export class RelationPickerGroupComponent implements OnChanges { @Input() document: any; @Input() relationDefinition: any; @Input() primary: string; public relations: any; public ngOnChanges() { if (this.document) this.relations = this.document.resource.relations; } public createRelation() { if (!this.relations[this.relationDefinition.name]) this.relations[this.relationDefinition.name] = []; this.relations[this.relationDefinition.name].push('') } public validateNewest(): boolean { const index: number = this.relations[this.relationDefinition.name].length - 1; return (this.relations[this.relationDefinition.name][index] && this.relations[this.relationDefinition.name][index].length > 0); } // Button not shown when waiting for input public showPlusButton(): boolean { if (this.relationDefinition.name === 'isRecordedIn' && (this.relations[this.relationDefinition.name] && this.relations[this.relationDefinition.name].length > 0)) return false; return !this.relations[this.relationDefinition.name] || isEmpty(this.relations[this.relationDefinition.name]) || this.validateNewest(); } }
import {Component, Input, OnChanges} from '@angular/core'; import {isEmpty} from 'tsfun'; /** * @author Thomas Kleinke */ @Component({ moduleId: module.id, selector: 'relation-picker-group', templateUrl: './relation-picker-group.html' }) export class RelationPickerGroupComponent implements OnChanges { @Input() document: any; @Input() relationDefinition: any; @Input() primary: string; public relations: any; public ngOnChanges() { if (this.document) this.relations = this.document.resource.relations; } public createRelation() { if (!this.relations[this.relationDefinition.name]) this.relations[this.relationDefinition.name] = []; this.relations[this.relationDefinition.name].push('') } public validateNewest(): boolean { const index: number = this.relations[this.relationDefinition.name].length - 1; return (this.relations[this.relationDefinition.name][index] && this.relations[this.relationDefinition.name][index].length > 0); } // Button not shown when waiting for input public showPlusButton(): boolean { if (this.relationDefinition.name === 'isRecordedIn' && (this.relations[this.relationDefinition.name] && this.relations[this.relationDefinition.name].length > 0)) return false; return !this.relations[this.relationDefinition.name] || isEmpty(this.relations[this.relationDefinition.name]) || this.validateNewest(); } }
Fix spacing to account for code style
Fix spacing to account for code style
TypeScript
apache-2.0
codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client
--- +++ @@ -23,7 +23,8 @@ if (this.document) this.relations = this.document.resource.relations; } - + + public createRelation() { if (!this.relations[this.relationDefinition.name]) @@ -41,6 +42,7 @@ && this.relations[this.relationDefinition.name][index].length > 0); } + // Button not shown when waiting for input public showPlusButton(): boolean {
199cc12a78e749e0b78f711006ff2c02f6eb555b
src/app/shared/courses.service.ts
src/app/shared/courses.service.ts
import { Injectable } from '@angular/core'; import { Course } from './course-interface'; const courses: Course[] = [{ id: 1, name: 'Name 1', duration: 45, date: 'date', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' }, { id: 2, name: 'Name 2', duration: 75, date: 'ame', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' }]; @Injectable() export class CoursesService { public getCourses(): Promise<Course[]> { return Promise.resolve(courses); } public getCourseById(id: number): Promise<Course> { return Promise.resolve(courses.find((course) => course.id === id)); } public addCourse(course: Course): Course[] { console.log('Added course:', course); return courses; } public deleteCourse(id: number): Course[] { console.log('Deleted course:', id); return courses; } }
import { Injectable } from '@angular/core'; import { Course } from './course-interface'; const courses: Course[] = [{ id: 1, name: 'Name 1', duration: 45, date: 'date', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' }, { id: 2, name: 'Name 2', duration: 75, date: 'ame', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.' }]; @Injectable() export class CoursesService { public getCourses(): Promise<Course[]> { return Promise.resolve(courses); } public getCourseById(id: number): Promise<Course> { return Promise.resolve(courses.find((course) => course.id === id)); } public addCourse(course: Course): Course[] { console.log('Added course:', course); return courses; } public deleteCourse(id: number): Course[] { console.log('Deleted course:', id); return courses; } public updateCourse(course: Course): Course { console.log('Updated course:', course); return course; } }
Add method for updating course
Add method for updating course
TypeScript
mit
yusk90/courses-app,yusk90/courses-app,yusk90/courses-app
--- +++ @@ -35,4 +35,9 @@ console.log('Deleted course:', id); return courses; } + + public updateCourse(course: Course): Course { + console.log('Updated course:', course); + return course; + } }
688ff42a1141529049db39694eaf09feaa3829e8
src/getResource.ts
src/getResource.ts
import cachedFetch, { type CachedFetchOptions } from './cachedFetch'; export let apiUrl = 'https://pokeapi.co/api/'; export let apiVersion = 'v2'; export async function getResource(resource: string, options: CachedFetchOptions) { let resourceSplit = resource.split('/'); resourceSplit[1] = resourceSplit[1].replace('undefined', ''); resource = resourceSplit.join('/'); try { const response = await cachedFetch( apiUrl + apiVersion + '/' + resource, options ); // handle HTTP response if (response.ok) { return await response.json(); } else { throw response.status + ' ' + response.statusText; } } catch (error) { // handle network error throw error; } } export function getResourceFromUrl(url: string, options: CachedFetchOptions) { if (url.indexOf(apiUrl) !== -1 && url.indexOf(apiVersion) !== -1) { return getResource(url.split('/').slice(5, 7).join('/'), options); } }
import cachedFetch, { type CachedFetchOptions } from './cachedFetch'; export let apiUrl = 'https://pokeapi.co/api/'; export let apiVersion = 'v2'; export async function getResource(resource: string, options: CachedFetchOptions) { let resourceSplit = resource.split('/'); resourceSplit[1] = resourceSplit[1].replace('undefined', ''); resource = resourceSplit.join('/'); const response = await cachedFetch( apiUrl + apiVersion + '/' + resource, options ); // handle HTTP response if (response.ok) { return await response.json(); } else { throw response.status + ' ' + response.statusText; } } export function getResourceFromUrl(url: string, options: CachedFetchOptions) { if (url.indexOf(apiUrl) !== -1 && url.indexOf(apiVersion) !== -1) { return getResource(url.split('/').slice(5, 7).join('/'), options); } }
Stop catching just to throw again
Stop catching just to throw again
TypeScript
apache-2.0
16patsle/pokeapi.js,16patsle/pokeapi.js
--- +++ @@ -8,20 +8,15 @@ resourceSplit[1] = resourceSplit[1].replace('undefined', ''); resource = resourceSplit.join('/'); - try { - const response = await cachedFetch( - apiUrl + apiVersion + '/' + resource, - options - ); - // handle HTTP response - if (response.ok) { - return await response.json(); - } else { - throw response.status + ' ' + response.statusText; - } - } catch (error) { - // handle network error - throw error; + const response = await cachedFetch( + apiUrl + apiVersion + '/' + resource, + options + ); + // handle HTTP response + if (response.ok) { + return await response.json(); + } else { + throw response.status + ' ' + response.statusText; } }
662b9e228c4d7ca0aa8e2f0e15386c59df937d0c
medtimeline/src/app/data-selector-element/data-selector-element.component.ts
medtimeline/src/app/data-selector-element/data-selector-element.component.ts
// Copyright 2018 Verily Life Sciences Inc. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import {Component, Input} from '@angular/core'; import {APP_TIMESPAN} from 'src/constants'; import {DisplayGrouping} from '../clinicalconcepts/display-grouping'; import {ResourceCodesForCard} from '../clinicalconcepts/resource-code-manager'; @Component({ selector: 'app-data-selector-element', templateUrl: './data-selector-element.component.html', styleUrls: ['./data-selector-element.component.css'] }) // This class represents one element in a list or menu of ResourceCodesForCards // that can be added to the main CardContainer. export class DataSelectorElementComponent { // The ResourceCodes for the card represented by this DataSelectorElement. @Input() resourceCodesForCard: ResourceCodesForCard; // The DisplayGrouping for the card represented by this DataSelectorElement. @Input() conceptGroupKey: DisplayGrouping; // Hold an instance of the app time interval so we can display it in the HTML readonly appTimeIntervalString = APP_TIMESPAN.start.toFormat('dd/MM/yyyy') + ' and ' + APP_TIMESPAN.end.toFormat('dd/MM/yyyy'); }
// Copyright 2018 Verily Life Sciences Inc. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import {Component, Input} from '@angular/core'; import {APP_TIMESPAN} from 'src/constants'; import {DisplayGrouping} from '../clinicalconcepts/display-grouping'; import {ResourceCodesForCard} from '../clinicalconcepts/resource-code-manager'; @Component({ selector: 'app-data-selector-element', templateUrl: './data-selector-element.component.html', styleUrls: ['./data-selector-element.component.css'] }) // This class represents one element in a list or menu of ResourceCodesForCards // that can be added to the main CardContainer. export class DataSelectorElementComponent { // The ResourceCodes for the card represented by this DataSelectorElement. @Input() resourceCodesForCard: ResourceCodesForCard; // The DisplayGrouping for the card represented by this DataSelectorElement. @Input() conceptGroupKey: DisplayGrouping; // Hold an instance of the app time interval so we can display it in the HTML readonly appTimeIntervalString = APP_TIMESPAN.start.toFormat('MM/dd/yyyy') + ' and ' + APP_TIMESPAN.end.toFormat('MM/dd/yyyy'); }
Fix bad date formatting for menu buttons
b/123535294: Fix bad date formatting for menu buttons Change-Id: Icb90c754a40c0446437eb1a114c5165e083309c1 GitOrigin-RevId: 4679bca337ed7e918133e0a13aca579effc04c97
TypeScript
bsd-3-clause
verilylifesciences/medtimeline,verilylifesciences/medtimeline,verilylifesciences/medtimeline,verilylifesciences/medtimeline,verilylifesciences/medtimeline
--- +++ @@ -23,6 +23,6 @@ // The DisplayGrouping for the card represented by this DataSelectorElement. @Input() conceptGroupKey: DisplayGrouping; // Hold an instance of the app time interval so we can display it in the HTML - readonly appTimeIntervalString = APP_TIMESPAN.start.toFormat('dd/MM/yyyy') + - ' and ' + APP_TIMESPAN.end.toFormat('dd/MM/yyyy'); + readonly appTimeIntervalString = APP_TIMESPAN.start.toFormat('MM/dd/yyyy') + + ' and ' + APP_TIMESPAN.end.toFormat('MM/dd/yyyy'); }
32f062f1c5fd7800ad7a8fddc18339244a6d6e1e
packages/@sanity/util/src/reduceConfig.ts
packages/@sanity/util/src/reduceConfig.ts
/* eslint-disable no-process-env */ import {mergeWith} from 'lodash' const sanityEnv = process.env.SANITY_ENV || 'production' const apiHosts = { staging: 'https://api.sanity.work', development: 'http://api.sanity.wtf' } const processEnvConfig = { project: process.env.STUDIO_BASEPATH ? {basePath: process.env.STUDIO_BASEPATH} : {} } function merge(objValue, srcValue, key) { if (Array.isArray(objValue)) { return objValue.concat(srcValue) } // Pass on to default merging strategy return undefined } export default (rawConfig, env = 'development') => { const apiHost = apiHosts[sanityEnv] const sanityConf = apiHost ? {api: {apiHost}} : {} const envConfig = (rawConfig.env || {})[env] || {} const config = mergeWith({}, rawConfig, envConfig, sanityConf, processEnvConfig, merge) delete config.env return config }
/* eslint-disable no-process-env */ import {mergeWith} from 'lodash' const sanityEnv = process.env.SANITY_ENV || 'production' const basePath = process.env.SANITY_STUDIO_BASEPATH || process.env.STUDIO_BASEPATH const apiHosts = { staging: 'https://api.sanity.work', development: 'http://api.sanity.wtf' } const projectId = process.env.SANITY_STUDIO_PROJECT_ID || undefined const dataset = process.env.SANITY_STUDIO_DATASET || undefined const processEnvConfig = { project: basePath ? {basePath} : {} } function clean(obj) { return Object.keys(obj).reduce((acc, key) => (obj[key] ? {...acc, [key]: obj[key]} : acc), {}) } function merge(objValue, srcValue, key) { if (Array.isArray(objValue)) { return objValue.concat(srcValue) } // Pass on to default merging strategy return undefined } export default (rawConfig, env = 'development') => { const apiHost = apiHosts[sanityEnv] const api = clean({apiHost, projectId, dataset}) const sanityConf = {api} const envConfig = (rawConfig.env || {})[env] || {} const config = mergeWith({}, rawConfig, envConfig, sanityConf, processEnvConfig, merge) delete config.env return config }
Allow setting projectId/dataset through environment variables
[util] Allow setting projectId/dataset through environment variables
TypeScript
mit
sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity
--- +++ @@ -2,13 +2,21 @@ import {mergeWith} from 'lodash' const sanityEnv = process.env.SANITY_ENV || 'production' +const basePath = process.env.SANITY_STUDIO_BASEPATH || process.env.STUDIO_BASEPATH const apiHosts = { staging: 'https://api.sanity.work', development: 'http://api.sanity.wtf' } +const projectId = process.env.SANITY_STUDIO_PROJECT_ID || undefined +const dataset = process.env.SANITY_STUDIO_DATASET || undefined + const processEnvConfig = { - project: process.env.STUDIO_BASEPATH ? {basePath: process.env.STUDIO_BASEPATH} : {} + project: basePath ? {basePath} : {} +} + +function clean(obj) { + return Object.keys(obj).reduce((acc, key) => (obj[key] ? {...acc, [key]: obj[key]} : acc), {}) } function merge(objValue, srcValue, key) { @@ -22,7 +30,8 @@ export default (rawConfig, env = 'development') => { const apiHost = apiHosts[sanityEnv] - const sanityConf = apiHost ? {api: {apiHost}} : {} + const api = clean({apiHost, projectId, dataset}) + const sanityConf = {api} const envConfig = (rawConfig.env || {})[env] || {} const config = mergeWith({}, rawConfig, envConfig, sanityConf, processEnvConfig, merge) delete config.env
c6bd8acbc878e8168e4f75caf520f439eecbf453
src/mercator/mercator/static/js/Packages/Mercator/Module.ts
src/mercator/mercator/static/js/Packages/Mercator/Module.ts
import * as AdhMercator2015Module from "./2015/Module"; import * as AdhMercator2016Module from "./2016/Module"; export var moduleName = "adhMercator"; export var register = (angular) => { AdhMercator2015Module.register(angular); AdhMercator2016Module.register(angular); angular .module(moduleName, [ AdhMercator2015Module.moduleName, AdhMercator2016Module.moduleName ]); };
import * as AdhMercator2016Module from "./2016/Module"; export var moduleName = "adhMercator"; export var register = (angular) => { AdhMercator2016Module.register(angular); angular .module(moduleName, [ AdhMercator2016Module.moduleName ]); };
Use just the new controller
Use just the new controller
TypeScript
agpl-3.0
liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator
--- +++ @@ -1,16 +1,13 @@ -import * as AdhMercator2015Module from "./2015/Module"; import * as AdhMercator2016Module from "./2016/Module"; export var moduleName = "adhMercator"; export var register = (angular) => { - AdhMercator2015Module.register(angular); AdhMercator2016Module.register(angular); angular .module(moduleName, [ - AdhMercator2015Module.moduleName, AdhMercator2016Module.moduleName ]); };
1dea898acfdb12e37f905024573f0e76de859df1
src/search.ts
src/search.ts
import { getMoves } from './moves'; import { evaluate } from './evaluation'; import { makeMove } from './game'; export function getBestMove(grid: boolean[], forX: boolean, depth?: number): number { if (depth == undefined) depth = grid.length; const moves = getMoves(grid); const movesWithScores = moves.map(move => { const newGrid = makeMove(grid, move, forX); const evaluation = evaluate(newGrid); return { move, score: forX ? evaluation : -evaluation }; }); const sortedMovesWithScores = movesWithScores.sort((x, y) => x.score - y.score); const sortedMoves = sortedMovesWithScores.map(x => x.move); // Return the move with the best evaluation so far return sortedMoves[0]; }
import { getMoves } from './moves'; import { evaluate } from './evaluation'; import { makeMove } from './game'; export function getBestMove(grid: boolean[], forX: boolean, depth?: number): number { if (depth == undefined) depth = grid.length; const moves = getMoves(grid); const movesWithScores = moves.map(move => { const newGrid = makeMove(grid, move, forX); const evaluation = evaluate(newGrid); return { move, score: forX ? evaluation : -evaluation }; }); const sortedMovesWithScores = movesWithScores.sort((a, b) => b.score - a.score); const sortedMoves = sortedMovesWithScores.map(x => x.move); // Return the move with the best evaluation so far return sortedMoves[0]; }
Fix sort to be descending instead of ascending
Fix sort to be descending instead of ascending
TypeScript
mit
artfuldev/tictactoe-ai,artfuldev/tictactoe-ai
--- +++ @@ -14,7 +14,7 @@ score: forX ? evaluation : -evaluation }; }); - const sortedMovesWithScores = movesWithScores.sort((x, y) => x.score - y.score); + const sortedMovesWithScores = movesWithScores.sort((a, b) => b.score - a.score); const sortedMoves = sortedMovesWithScores.map(x => x.move); // Return the move with the best evaluation so far return sortedMoves[0];
1c8828975ab778dba8acee66014b6347c48b5eef
test/unitTests/Fakes/FakeOptions.ts
test/unitTests/Fakes/FakeOptions.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Options } from "../../../src/omnisharp/options"; export function getEmptyOptions(): Options { return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, "", ""); }
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Options } from "../../../src/omnisharp/options"; export function getEmptyOptions(): Options { return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, 0, 0, "", ""); }
Fix 'npm run compile' after merge with latest
Fix 'npm run compile' after merge with latest
TypeScript
mit
OmniSharp/omnisharp-vscode,gregg-miskelly/omnisharp-vscode,OmniSharp/omnisharp-vscode,OmniSharp/omnisharp-vscode,OmniSharp/omnisharp-vscode,OmniSharp/omnisharp-vscode,gregg-miskelly/omnisharp-vscode,gregg-miskelly/omnisharp-vscode,gregg-miskelly/omnisharp-vscode
--- +++ @@ -6,5 +6,5 @@ import { Options } from "../../../src/omnisharp/options"; export function getEmptyOptions(): Options { - return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, "", ""); + return new Options("", "", false, "", false, 0, 0, false, false, false, false, false, false, 0, 0, "", ""); }
53a6bb46b83d60dcd035079524e62ddb0843796b
ui/src/api/document.ts
ui/src/api/document.ts
import { Geometry } from 'geojson'; import { ResultDocument } from './result'; export interface Document { created: ChangeEvent; modified: ChangeEvent[]; project: string; resource: Resource; } export interface ChangeEvent { user: string; date: string; } export interface Resource { category: LabeledValue; id: string; identifier: string; shortDescription: string; groups: FieldGroup[]; geometry: Geometry; childrenCount: number; parent: string; } export interface FieldGroup { name: string; fields: Field[]; relations: Relation[]; } export interface Field { description: I18nString; label: I18nString; name: string; value: any; } export interface LabeledValue { name: string; label: I18nString; } export type I18nString = { [languageCode: string]: string }; export interface Relation { description: I18nString; label: I18nString; name: string; targets: ResultDocument[]; } export function getImages(document: Document): ResultDocument[] { return document.resource.groups.find((group: FieldGroup) => group.name === 'stem') .relations.find((rel: Relation) => rel.name === 'isDepictedIn')?.targets; }
import { Geometry } from 'geojson'; import { ResultDocument } from './result'; export interface Document { created: ChangeEvent; modified: ChangeEvent[]; project: string; resource: Resource; } export interface ChangeEvent { user: string; date: string; } export interface Resource { category: LabeledValue; id: string; identifier: string; shortDescription: string; groups: FieldGroup[]; geometry: Geometry; childrenCount: number; parentId: string; } export interface FieldGroup { name: string; fields: Field[]; relations: Relation[]; } export interface Field { description: I18nString; label: I18nString; name: string; value: any; } export interface LabeledValue { name: string; label: I18nString; } export type I18nString = { [languageCode: string]: string }; export interface Relation { description: I18nString; label: I18nString; name: string; targets: ResultDocument[]; } export function getImages(document: Document): ResultDocument[] { return document.resource.groups.find((group: FieldGroup) => group.name === 'stem') .relations.find((rel: Relation) => rel.name === 'isDepictedIn')?.targets; }
Rename parent to parentId in Resource interface
Rename parent to parentId in Resource interface
TypeScript
apache-2.0
dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web
--- +++ @@ -24,7 +24,7 @@ groups: FieldGroup[]; geometry: Geometry; childrenCount: number; - parent: string; + parentId: string; }
a0815316b126acef0ad6cee058b6129400c55909
src/entry/collapsed-entry-options.tsx
src/entry/collapsed-entry-options.tsx
import * as React from 'react' import {bindActionCreators} from 'redux' import flowRight from 'lodash-es/flowRight' import {translate} from 'react-i18next' import {connect} from 'react-redux' import Button from '@material-ui/core/Button' import {EntryOptions} from './entry-options' import {toggleOptionOpenAction} from './actions/toggle-option-open' import {Dispatch, IRootState, ITranslateMixin} from '../types' import style from './entry.css' const mapStateToProps = (state: IRootState) => ({ optionsOpened: state.entry.optionsOpened }) const mapDispatchToProps = (dispatch: Dispatch) => bindActionCreators({toggleOptionOpen: toggleOptionOpenAction}, dispatch) type stateType = ReturnType<typeof mapStateToProps> type dispatchType = ReturnType<typeof mapDispatchToProps> type CollapsedEntryOptionsProps = stateType & dispatchType & ITranslateMixin export function CollapsedEntryOptionsImpl({toggleOptionOpen, optionsOpened, t}: CollapsedEntryOptionsProps) { const collapseCss = [style.collapse] if (optionsOpened) { collapseCss.push(style.collapseOpen) } return ( <div> <Button variant="contained" onClick={toggleOptionOpen} className={style.optionsBtn}>{t('Options')}</Button> {/* TODO Use Collapse from material-ui */} {/* FIXME Regression: The container is too compact */} <div className={collapseCss.join(' ')}> <EntryOptions /> </div> </div> ) } export const CollapsedEntryOptions = flowRight( translate(), connect(mapStateToProps, mapDispatchToProps) )(CollapsedEntryOptionsImpl)
import * as React from 'react' import {translate} from 'react-i18next' import Button from '@material-ui/core/Button' import {EntryOptions} from './entry-options' import {ITranslateMixin} from '../types' import style from './entry.css' import Collapse from '@material-ui/core/Collapse/Collapse' interface ICollapsedEntryOptionsState { expanded: boolean } export class CollapsedEntryOptionsImpl extends React.Component<ITranslateMixin, ICollapsedEntryOptionsState> { public state = { expanded: false } public render() { const {t} = this.props const {expanded} = this.state return ( <div className={style.optionsSection}> <Button variant="contained" onClick={this._toggleOptionOpen} className={style.optionsBtn}>{t('Options')}</Button> <Collapse in={expanded}> <EntryOptions/> </Collapse> </div> ) } private _toggleOptionOpen = () => { this.setState(state => ({ expanded: !state.expanded })) } } export const CollapsedEntryOptions = translate()(CollapsedEntryOptionsImpl)
Use collapse component from material-ui for entry options
Use collapse component from material-ui for entry options
TypeScript
mit
Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc
--- +++ @@ -1,45 +1,39 @@ import * as React from 'react' -import {bindActionCreators} from 'redux' -import flowRight from 'lodash-es/flowRight' import {translate} from 'react-i18next' -import {connect} from 'react-redux' import Button from '@material-ui/core/Button' import {EntryOptions} from './entry-options' -import {toggleOptionOpenAction} from './actions/toggle-option-open' -import {Dispatch, IRootState, ITranslateMixin} from '../types' +import {ITranslateMixin} from '../types' import style from './entry.css' +import Collapse from '@material-ui/core/Collapse/Collapse' -const mapStateToProps = (state: IRootState) => ({ - optionsOpened: state.entry.optionsOpened -}) +interface ICollapsedEntryOptionsState { + expanded: boolean +} -const mapDispatchToProps = (dispatch: Dispatch) => - bindActionCreators({toggleOptionOpen: toggleOptionOpenAction}, dispatch) - -type stateType = ReturnType<typeof mapStateToProps> -type dispatchType = ReturnType<typeof mapDispatchToProps> - -type CollapsedEntryOptionsProps = stateType & dispatchType & ITranslateMixin - -export function CollapsedEntryOptionsImpl({toggleOptionOpen, optionsOpened, t}: CollapsedEntryOptionsProps) { - const collapseCss = [style.collapse] - if (optionsOpened) { - collapseCss.push(style.collapseOpen) +export class CollapsedEntryOptionsImpl extends React.Component<ITranslateMixin, ICollapsedEntryOptionsState> { + public state = { + expanded: false } - return ( - <div> - <Button variant="contained" onClick={toggleOptionOpen} className={style.optionsBtn}>{t('Options')}</Button> - {/* TODO Use Collapse from material-ui */} - {/* FIXME Regression: The container is too compact */} - <div className={collapseCss.join(' ')}> - <EntryOptions /> + public render() { + const {t} = this.props + const {expanded} = this.state + + return ( + <div className={style.optionsSection}> + <Button variant="contained" onClick={this._toggleOptionOpen} className={style.optionsBtn}>{t('Options')}</Button> + <Collapse in={expanded}> + <EntryOptions/> + </Collapse> </div> - </div> - ) + ) + } + + private _toggleOptionOpen = () => { + this.setState(state => ({ + expanded: !state.expanded + })) + } } -export const CollapsedEntryOptions = flowRight( - translate(), - connect(mapStateToProps, mapDispatchToProps) -)(CollapsedEntryOptionsImpl) +export const CollapsedEntryOptions = translate()(CollapsedEntryOptionsImpl)
fdc612bbdeca195bf95f6c210772ce9dc6355991
src/parser/priest/shadow/constants.ts
src/parser/priest/shadow/constants.ts
import SPELLS from 'common/SPELLS'; export const DISPERSION_BASE_CD = 90; export const DISPERSION_UPTIME_MS = 6000; export const MINDBENDER_UPTIME_MS = 15000; export const MS_BUFFER = 100; export const SPIRIT_DAMAGE_MULTIPLIER = 1.3; export const SPIRIT_INSANITY_GENERATION = 1; export const TWIST_OF_FATE_INCREASE = 1.1; export const VOID_TORRENT_MAX_TIME = 4000; export const VOID_FORM_ACTIVATORS = [ SPELLS.VOID_ERUPTION.id, SPELLS.SURRENDER_TO_MADNESS_TALENT.id, ];
import SPELLS from 'common/SPELLS'; export const DISPERSION_BASE_CD = 90; export const DISPERSION_UPTIME_MS = 6000; export const MINDBENDER_UPTIME_MS = 15000; export const MS_BUFFER = 100; export const SPIRIT_DAMAGE_MULTIPLIER = 1.3; export const SPIRIT_INSANITY_GENERATION = 1; export const TWIST_OF_FATE_INCREASE = 1.1; export const VOID_TORRENT_MAX_TIME = 3000; export const VOID_FORM_ACTIVATORS = [ SPELLS.VOID_ERUPTION.id, SPELLS.SURRENDER_TO_MADNESS_TALENT.id, ];
Fix void torrent duration 4s -> 3s
Fix void torrent duration 4s -> 3s
TypeScript
agpl-3.0
anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,yajinni/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer,sMteX/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,Juko8/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,Juko8/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer
--- +++ @@ -7,10 +7,9 @@ export const SPIRIT_DAMAGE_MULTIPLIER = 1.3; export const SPIRIT_INSANITY_GENERATION = 1; export const TWIST_OF_FATE_INCREASE = 1.1; -export const VOID_TORRENT_MAX_TIME = 4000; +export const VOID_TORRENT_MAX_TIME = 3000; export const VOID_FORM_ACTIVATORS = [ SPELLS.VOID_ERUPTION.id, SPELLS.SURRENDER_TO_MADNESS_TALENT.id, ]; -
b3c6ec748b87e5d142a2efc1c6eeb6626844412d
src/adhocracy/adhocracy/frontend/static/js/Adhocracy/Services/CrossWindowMessaging.ts
src/adhocracy/adhocracy/frontend/static/js/Adhocracy/Services/CrossWindowMessaging.ts
export interface IMessage { data: {}; name: string; sender: string; } export class Service { private uid : number; constructor(public _postMessage) { var _self = this; } private postMessage(name: string, data: {}) : void { var _self = this; var message : IMessage = { data: data, name: name, sender: _self.uid }; _self._postMessage(JSON.stringify(message)); } postResize(height: number) : void { var _self = this; _self.postMessage( "resize", {height: height} ); } } export var factory = ($window) => new Service((...args) => $window.postMessage.apply($window, args));
export interface IMessage { data: {}; name: string; sender: string; } export class Service { private uid : number; constructor(public _postMessage) { var _self = this; } private postMessage(name: string, data: {}) : void { var _self = this; var message : IMessage = { data: data, name: name, sender: _self.uid }; _self._postMessage(JSON.stringify(message), "*"); } postResize(height: number) : void { var _self = this; _self.postMessage( "resize", {height: height} ); } } export var factory = ($window) => new Service((...args) => $window.postMessage.apply($window, args));
Send message to all windows (for now)
Send message to all windows (for now)
TypeScript
agpl-3.0
fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,fhartwig/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator,fhartwig/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,liqd/adhocracy3.mercator,xs2maverick/adhocracy3.mercator,liqd/adhocracy3.mercator,fhartwig/adhocracy3.mercator
--- +++ @@ -22,7 +22,7 @@ sender: _self.uid }; - _self._postMessage(JSON.stringify(message)); + _self._postMessage(JSON.stringify(message), "*"); } postResize(height: number) : void {
37f9090435d5529f9de5497a265a2fa6b40c171d
client/app/not-found/not-found.component.spec.ts
client/app/not-found/not-found.component.spec.ts
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NotFoundComponent } from './not-found.component'; describe('Component: NotFound', () => { let component: NotFoundComponent; let fixture: ComponentFixture<NotFoundComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ NotFoundComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(NotFoundComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should display the page header text', () => { const el = fixture.debugElement.query(By.css('h4')).nativeElement; expect(el.textContent).toContain('404 Not Found'); }); });
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { NotFoundComponent } from './not-found.component'; describe('Component: NotFound', () => { let component: NotFoundComponent; let fixture: ComponentFixture<NotFoundComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ NotFoundComponent ] }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(NotFoundComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); it('should display the page header text', () => { const el = fixture.debugElement.query(By.css('h4')).nativeElement; expect(el.textContent).toContain('404 Not Found'); }); it('should display the link for homepage', () => { const el = fixture.debugElement.query(By.css('a')).nativeElement; expect(el.getAttribute('routerLink')).toBe('/'); expect(el.textContent).toContain('Homepage'); }); });
Add one more unit test in not found component
Add one more unit test in not found component
TypeScript
mit
DavideViolante/Angular-Full-Stack,DavideViolante/Angular-Full-Stack,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular-Full-Stack,DavideViolante/Angular2-Express-Mongoose,DavideViolante/Angular-Full-Stack
--- +++ @@ -28,4 +28,10 @@ const el = fixture.debugElement.query(By.css('h4')).nativeElement; expect(el.textContent).toContain('404 Not Found'); }); + + it('should display the link for homepage', () => { + const el = fixture.debugElement.query(By.css('a')).nativeElement; + expect(el.getAttribute('routerLink')).toBe('/'); + expect(el.textContent).toContain('Homepage'); + }); });
6807a610c6b964d44cdcfe89ab4ab56e4310aa28
src/diagram.tsx
src/diagram.tsx
import * as React from 'react'; import * as d3 from 'd3'; export class Diagram extends React.Component<{}, {}> { static displayName = 'Diagram'; static propTypes = { title: React.PropTypes.string, }; constructor () { super(); } getDefaultProps () { return { title: "Unknown diagram", }; } render () { return ( <div> Like Foo </div> ); } }
import * as React from 'react'; import * as d3 from 'd3'; export class Diagram extends React.Component<{}, {}> { static displayName = 'Diagram'; static propTypes = { title: React.PropTypes.string, }; constructor (props) { super(props); } render () { return ( <div> Like Foo </div> ); } }
Remove getDefaultProps and fix constructor.
Remove getDefaultProps and fix constructor.
TypeScript
mit
hodgestar/rrd-hacky,hodgestar/rrd-hacky,hodgestar/rrd-hacky
--- +++ @@ -9,14 +9,8 @@ title: React.PropTypes.string, }; - constructor () { - super(); - } - - getDefaultProps () { - return { - title: "Unknown diagram", - }; + constructor (props) { + super(props); } render () {
b6ad38c0e666508196118b150c62578296b6f8bb
source/services/dataContracts/converters/aliasConverter/aliasConverter.ts
source/services/dataContracts/converters/aliasConverter/aliasConverter.ts
import * as _ from 'lodash'; import { IConverter } from '../converters'; export class AliasConverter<TDataType> implements IConverter<TDataType> { constructor(private alias: string , private composedConverter?: IConverter<TDataType>) { } fromServer: { (raw: any, parent: any): TDataType } = (raw: any, parent: any): TDataType => { if (!_.has(parent, this.alias)) { return null; } raw = parent[this.alias]; parent[this.alias] = null; if (this.composedConverter != null) { return this.composedConverter.fromServer(raw, parent); } return raw; } toServer: {(data: TDataType, parent: any): any} = (data: TDataType, parent: any): any => { if (this.composedConverter != null) { data = this.composedConverter.toServer(data, parent); } parent[this.alias] = data; return null; } }
import * as _ from 'lodash'; import { IConverter } from '../converters'; export class AliasConverter<TDataType> implements IConverter<TDataType> { constructor(private alias: string , private composedConverter?: IConverter<TDataType>) { } fromServer: { (raw: any, parent: any): TDataType } = (raw: any, parent: any): TDataType => { if (!_.has(parent, this.alias)) { return null; } raw = parent[this.alias]; delete parent[this.alias]; if (this.composedConverter != null) { return this.composedConverter.fromServer(raw, parent); } return raw; } toServer: {(data: TDataType, parent: any): any} = (data: TDataType, parent: any): any => { if (this.composedConverter != null) { data = this.composedConverter.toServer(data, parent); } parent[this.alias] = data; return null; } }
Delete the property instead of setting it to null.
Delete the property instead of setting it to null.
TypeScript
mit
RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities
--- +++ @@ -12,7 +12,7 @@ } raw = parent[this.alias]; - parent[this.alias] = null; + delete parent[this.alias]; if (this.composedConverter != null) { return this.composedConverter.fromServer(raw, parent);
0f011e4c92c64347c3dae634bbb58eaac900ee84
src/client/src/rt-util/getAppName.ts
src/client/src/rt-util/getAppName.ts
import { getEnvironment } from 'rt-util' import { currencyFormatter } from './' const name = 'Reactive Trader' const prodEnvs = ['demo'] export const APP_PATHS = { LAUNCHER: '/launcher', TRADER: '/', STYLEGUIDE: '/styleguide', BLOTTER: '/blotter', ANALYTICS: '/analytics', TILES: '/tiles', } export const appTitles = { [APP_PATHS.LAUNCHER]: 'Reactive Launcher', [APP_PATHS.TRADER]: 'Reactive Trader', [APP_PATHS.STYLEGUIDE]: 'Style Guide for Reactive Trader', [APP_PATHS.BLOTTER]: 'Blotter', [APP_PATHS.ANALYTICS]: 'Analytics', [APP_PATHS.TILES]: 'Live Rates', } const currencyPairs = [ 'EURUSD', 'USDJPY', 'GBPUSD', 'GBPJPY', 'EURJPY', 'AUDUSD', 'NZDUSD', 'EURCAD', 'EURAUD', ] export function getAppName(pathname?: string): string { const env = getEnvironment() || 'unknown' const envFormatted = prodEnvs.includes(env) ? '' : ` (${env.toUpperCase()})` const ccy = pathname ? pathname.slice(6, 12) : `` const areaTitle = currencyPairs.includes(ccy) ? currencyFormatter(ccy) : pathname && pathname !== '/' ? ` - ${appTitles[pathname]}` : `` return `${name}${envFormatted}${` ${areaTitle}`}` }
import { getEnvironment } from 'rt-util' import { currencyFormatter } from './' const name = 'Reactive Trader' const prodEnvs = ['demo'] export const APP_PATHS = { LAUNCHER: '/launcher', TRADER: '/', STYLEGUIDE: '/styleguide', BLOTTER: '/blotter', ANALYTICS: '/analytics', TILES: '/tiles', } export const appTitles = { [APP_PATHS.LAUNCHER]: 'Reactive Launcher', [APP_PATHS.TRADER]: 'Reactive Trader', [APP_PATHS.STYLEGUIDE]: 'Style Guide for Reactive Trader', [APP_PATHS.BLOTTER]: 'Blotter', [APP_PATHS.ANALYTICS]: 'Analytics', [APP_PATHS.TILES]: 'Live Rates', } const currencyPairs = [ 'EURUSD', 'USDJPY', 'GBPUSD', 'GBPJPY', 'EURJPY', 'AUDUSD', 'NZDUSD', 'EURCAD', 'EURAUD', ] export function getAppName(pathname?: string): string { const env = getEnvironment() || 'unknown' const envFormatted = prodEnvs.includes(env) ? '' : ` (${env.toUpperCase()})` const ccy = pathname ? pathname.slice(6, 12) : `` const areaTitle = currencyPairs.includes(ccy) ? `- ${currencyFormatter(ccy)}` : pathname && pathname !== '/' ? ` - ${appTitles[pathname]}` : `` return `${name}${envFormatted}${` ${areaTitle}`}` }
Fix title on popped out ccy pair tile
Fix title on popped out ccy pair tile
TypeScript
apache-2.0
AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud
--- +++ @@ -40,7 +40,7 @@ const ccy = pathname ? pathname.slice(6, 12) : `` const areaTitle = currencyPairs.includes(ccy) - ? currencyFormatter(ccy) + ? `- ${currencyFormatter(ccy)}` : pathname && pathname !== '/' ? ` - ${appTitles[pathname]}` : ``
233a88eea11c71005aa03d8ffb6097520bf8a190
src/js/Actions/UIActions/Settings.ts
src/js/Actions/UIActions/Settings.ts
import { updatePollPeriod } from 'Actions/Settings'; /** * @param {string} pollPeriod */ export function configurePollPeriod(pollPeriod: string) { return dispatch => { dispatch(updatePollPeriod(pollPeriod)); }; };
import InstanceCache from 'Core/InstanceCache'; import { updatePollPeriod } from 'Actions/Settings'; import { configurePollingScheduler } from 'Helpers/System/Scheduler'; /** * @param {string} pollPeriod */ export function configurePollPeriod(pollPeriod: string) { let scheduler = InstanceCache.getInstance<IScheduler>('IScheduler'); return dispatch => { dispatch(updatePollPeriod(pollPeriod)); configurePollingScheduler(pollPeriod); }; };
Configure scheduling when the value is updated
Configure scheduling when the value is updated
TypeScript
mit
harksys/HawkEye,harksys/HawkEye,harksys/HawkEye
--- +++ @@ -1,12 +1,18 @@ +import InstanceCache from 'Core/InstanceCache'; + import { updatePollPeriod } from 'Actions/Settings'; +import { configurePollingScheduler } from 'Helpers/System/Scheduler'; /** * @param {string} pollPeriod */ export function configurePollPeriod(pollPeriod: string) { + let scheduler = InstanceCache.getInstance<IScheduler>('IScheduler'); + return dispatch => { dispatch(updatePollPeriod(pollPeriod)); + configurePollingScheduler(pollPeriod); }; };
69a01949b04827fcdae38b2bbea81420362755d5
src/xrm-mock/attributes/stringattribute/stringattribute.mock.ts
src/xrm-mock/attributes/stringattribute/stringattribute.mock.ts
import { ItemCollectionMock } from "../../collection/itemcollection/itemcollection.mock"; import { ControlMock } from "../../controls/control/control.mock"; import { StringControlMock } from "../../controls/stringcontrol/stringcontrol.mock"; import { AttributeMock, IAttributeComponents } from "../attribute/attribute.mock"; export class StringAttributeMock extends AttributeMock<StringControlMock, string> implements Xrm.Attributes.StringAttribute { public static create(name: string, value?: string): StringAttributeMock { return new StringAttributeMock({ name, value } as any as IStringAttributeComponents); } private static defaultComponents(components: IStringAttributeComponents): IStringAttributeComponents { components.attributeType = "string"; return components; } public maxLength: number; constructor(components: IStringAttributeComponents) { super(StringAttributeMock.defaultComponents(components)); this.format = components.format || "text"; this.maxLength = components.maxLength || 100; } public getFormat(): Xrm.Attributes.StringAttributeFormat { return super.getFormat() as Xrm.Attributes.StringAttributeFormat; } public getMaxLength(): number { return this.maxLength; } public setValue(value: string): void { if (this.maxLength && value.length > this.maxLength) { throw new Error(("value cannot be greater than " + this.maxLength)); } else { super.setValue(value); } } } export interface IStringAttributeComponents extends IAttributeComponents<StringControlMock, string> { format?: Xrm.Attributes.StringAttributeFormat; maxLength?: number; }
import { ItemCollectionMock } from "../../collection/itemcollection/itemcollection.mock"; import { ControlMock } from "../../controls/control/control.mock"; import { StringControlMock } from "../../controls/stringcontrol/stringcontrol.mock"; import { AttributeMock, IAttributeComponents } from "../attribute/attribute.mock"; export class StringAttributeMock extends AttributeMock<StringControlMock, string> implements Xrm.Attributes.StringAttribute { public static create(name: string, value?: string): StringAttributeMock { return new StringAttributeMock({ name, value } as any as IStringAttributeComponents); } private static defaultComponents(components: IStringAttributeComponents): IStringAttributeComponents { components.attributeType = "string"; return components; } public maxLength: number; constructor(components: IStringAttributeComponents) { super(StringAttributeMock.defaultComponents(components)); this.format = components.format || "text"; this.maxLength = components.maxLength || 100; } public getFormat(): Xrm.Attributes.StringAttributeFormat { return super.getFormat() as Xrm.Attributes.StringAttributeFormat; } public getMaxLength(): number { return this.maxLength; } public setValue(value: string): void { if (value && this.maxLength && value.length > this.maxLength) { throw new Error(("value cannot be greater than " + this.maxLength)); } else { super.setValue(value); } } } export interface IStringAttributeComponents extends IAttributeComponents<StringControlMock, string> { format?: Xrm.Attributes.StringAttributeFormat; maxLength?: number; }
Allow for Strings being set to null
Allow for Strings being set to null
TypeScript
mit
camelCaseDave/xrm-mock,camelCaseDave/xrm-mock
--- +++ @@ -32,7 +32,7 @@ } public setValue(value: string): void { - if (this.maxLength && value.length > this.maxLength) { + if (value && this.maxLength && value.length > this.maxLength) { throw new Error(("value cannot be greater than " + this.maxLength)); } else { super.setValue(value);
890361dff04f652f24da3ed3611bf123053ba3e6
typescript-react/src/interfaces.d.ts
typescript-react/src/interfaces.d.ts
import NowShowingFilter from "./NowShowingFilter"; export type ChangeFunction = () => any; export interface IAppProps { model: ITodoModel; } export interface IAppState { editing?: string; nowShowing?: NowShowingFilter; } export interface ITodo { id: string; title: string; completed: boolean; } export interface ITodoItemProps { key: string; todo: ITodo; editing?: boolean; onSave: (val: any) => void; onDestroy: () => void; onEdit: () => void; onCancel: (event: any) => void; onToggle: () => void; } export interface ITodoItemState { editText: string; } export interface ITodoFooterProps { completedCount: number; onClearCompleted: any; nowShowing: NowShowingFilter; count: number; } export interface ITodoModel { key: any; todos: Array<ITodo>; onChanges: Array<ChangeFunction>; subscribe(onChange: ChangeFunction); inform(); addTodo(title: string); toggleAll(checked: boolean); toggle(todoToToggle: ITodo); destroy(todo: ITodo); save(todoToSave: ITodo, text: string); clearCompleted(); }
import NowShowingFilter from "./NowShowingFilter"; export type ChangeFunction = () => any; export interface IAppProps { model: ITodoModel; } export interface IAppState { editing?: string; nowShowing?: NowShowingFilter; } export interface ITodoFooterProps { completedCount: number; onClearCompleted: any; nowShowing: NowShowingFilter; count: number; } export interface ITodo { id: string; title: string; completed: boolean; } export interface ITodoItemProps { key: string; todo: ITodo; editing?: boolean; onSave: (val: any) => void; onDestroy: () => void; onEdit: () => void; onCancel: (event: any) => void; onToggle: () => void; } export interface ITodoItemState { editText: string; } export interface ITodoModel { key: any; todos: Array<ITodo>; onChanges: Array<ChangeFunction>; subscribe(onChange: ChangeFunction); inform(); addTodo(title: string); toggleAll(checked: boolean); toggle(todoToToggle: ITodo); destroy(todo: ITodo); save(todoToSave: ITodo, text: string); clearCompleted(); }
Move IFooterProps out of the way
Move IFooterProps out of the way
TypeScript
unlicense
janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations,janaagaard75/framework-investigations
--- +++ @@ -9,6 +9,13 @@ export interface IAppState { editing?: string; nowShowing?: NowShowingFilter; +} + +export interface ITodoFooterProps { + completedCount: number; + onClearCompleted: any; + nowShowing: NowShowingFilter; + count: number; } export interface ITodo { @@ -32,13 +39,6 @@ editText: string; } -export interface ITodoFooterProps { - completedCount: number; - onClearCompleted: any; - nowShowing: NowShowingFilter; - count: number; -} - export interface ITodoModel { key: any; todos: Array<ITodo>;
617e929e1af5b949da3caacd6df281a8fc99303d
server/src/lib/utils/RequestUrlGetter.ts
server/src/lib/utils/RequestUrlGetter.ts
import Constants = require("../../../../../shared/constants"); import Express = require("express"); import GetHeader from "../../utils/GetHeader"; import HasHeader from "../..//utils/HasHeader"; export class RequestUrlGetter { static getOriginalUrl(req: Express.Request): string { if (HasHeader(req, Constants.HEADER_X_ORIGINAL_URL)) { return GetHeader(req, Constants.HEADER_X_ORIGINAL_URL); } const proto = GetHeader(req, Constants.HEADER_X_FORWARDED_PROTO); const host = GetHeader(req, Constants.HEADER_X_FORWARDED_HOST); const port = GetHeader(req, Constants.HEADER_X_FORWARDED_PORT); const uri = GetHeader(req, Constants.HEADER_X_FORWARDED_URI); return "${proto}://${host}:${port}${uri}"; } }
import Constants = require("../../../../shared/constants"); import Express = require("express"); import GetHeader from "./GetHeader"; import HasHeader from "./HasHeader"; export class RequestUrlGetter { static getOriginalUrl(req: Express.Request): string { if (HasHeader(req, Constants.HEADER_X_ORIGINAL_URL)) { return GetHeader(req, Constants.HEADER_X_ORIGINAL_URL); } const proto = GetHeader(req, Constants.HEADER_X_FORWARDED_PROTO); const host = GetHeader(req, Constants.HEADER_X_FORWARDED_HOST); const port = GetHeader(req, Constants.HEADER_X_FORWARDED_PORT); const uri = GetHeader(req, Constants.HEADER_X_FORWARDED_URI); if (!proto || !host || !port) { throw new Error("Missing headers holding requested URL. Requires X-Original-Url or X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port") } return "${proto}://${host}:${port}${uri}"; } }
Fix relative paths and add error handling
Fix relative paths and add error handling
TypeScript
mit
clems4ever/authelia,clems4ever/two-factor-auth-server,clems4ever/authelia,clems4ever/two-factor-auth-server,clems4ever/authelia,clems4ever/authelia,clems4ever/authelia
--- +++ @@ -1,7 +1,7 @@ -import Constants = require("../../../../../shared/constants"); +import Constants = require("../../../../shared/constants"); import Express = require("express"); -import GetHeader from "../../utils/GetHeader"; -import HasHeader from "../..//utils/HasHeader"; +import GetHeader from "./GetHeader"; +import HasHeader from "./HasHeader"; export class RequestUrlGetter { static getOriginalUrl(req: Express.Request): string { @@ -15,6 +15,11 @@ const port = GetHeader(req, Constants.HEADER_X_FORWARDED_PORT); const uri = GetHeader(req, Constants.HEADER_X_FORWARDED_URI); + if (!proto || !host || !port) { + throw new Error("Missing headers holding requested URL. Requires X-Original-Url or X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port") + } + return "${proto}://${host}:${port}${uri}"; + } }
b6709a2153d0be4410963917392ad6ab914f2179
src/aws-token-helper/aws-token-helper.ts
src/aws-token-helper/aws-token-helper.ts
// tslint:disable-next-line:no-require-imports import open = require("open"); const generateQuery = (params: { [key: string]: string }) => Object.keys(params) .map((key: string) => key + "=" + params[key]) .join("&"); function prompt(question: string): Promise<string> { return new Promise((resolve, reject) => { const stdin = process.stdin; const stdout = process.stdout; stdin.resume(); stdout.write(question + " "); stdin.once("data", data => { resolve(data.toString().trim()); }); }); } prompt("Client ID?").then(clientId => { prompt("Product Id?").then(productId => { prompt("Redirect URI (allowed return URL)?").then(redirectURI => { const scopeData = { "alexa:all": { productID: productId, productInstanceAttributes: { deviceSerialNumber: 123, // can be anything }, }, }; const getParams = generateQuery({ client_id: clientId, scope: "alexa:all", scope_data: JSON.stringify(scopeData), response_type: "code", redirect_uri: redirectURI, }); const authUrl = `https://www.amazon.com/ap/oa?${getParams}`; open(authUrl); process.exit(); }); }); });
// tslint:disable-next-line:no-require-imports import open = require("open"); const generateQuery = (params: { [key: string]: string }) => Object.keys(params) .map((key: string) => key + "=" + params[key]) .join("&"); function prompt(question: string): Promise<string> { return new Promise((resolve, reject) => { const stdin = process.stdin; const stdout = process.stdout; stdin.resume(); stdout.write(question + " "); stdin.once("data", data => { resolve(data.toString().trim()); }); }); } console.log("Welcome to the Amazon auth helper!"); console.log("I will need three things from you:"); console.log("- Client ID"); console.log("- Product ID"); console.log("- Allowed return URL"); prompt("[Press any key to continue]").then(() => { prompt("Client ID?").then(clientId => { prompt("Product Id?").then(productId => { prompt("Redirect URI (allowed return URL)?").then(redirectURI => { prompt( "Great! Next I will now open a browser where you can authorize your Alexa product\n[Press any key to continue]", ).then(() => { const scopeData = { "alexa:all": { productID: productId, productInstanceAttributes: { deviceSerialNumber: 123, // can be anything }, }, }; const getParams = generateQuery({ client_id: clientId, scope: "alexa:all", scope_data: JSON.stringify(scopeData), response_type: "code", redirect_uri: redirectURI, }); const authUrl = `https://www.amazon.com/ap/oa?${getParams}`; open(authUrl); process.exit(); }); }); }); }); });
Make script easier to understand
Make script easier to understand
TypeScript
mit
dolanmiu/MMM-awesome-alexa,dolanmiu/MMM-awesome-alexa
--- +++ @@ -20,29 +20,41 @@ }); } -prompt("Client ID?").then(clientId => { - prompt("Product Id?").then(productId => { - prompt("Redirect URI (allowed return URL)?").then(redirectURI => { - const scopeData = { - "alexa:all": { - productID: productId, - productInstanceAttributes: { - deviceSerialNumber: 123, // can be anything - }, - }, - }; - const getParams = generateQuery({ - client_id: clientId, - scope: "alexa:all", - scope_data: JSON.stringify(scopeData), - response_type: "code", - redirect_uri: redirectURI, +console.log("Welcome to the Amazon auth helper!"); +console.log("I will need three things from you:"); +console.log("- Client ID"); +console.log("- Product ID"); +console.log("- Allowed return URL"); + +prompt("[Press any key to continue]").then(() => { + prompt("Client ID?").then(clientId => { + prompt("Product Id?").then(productId => { + prompt("Redirect URI (allowed return URL)?").then(redirectURI => { + prompt( + "Great! Next I will now open a browser where you can authorize your Alexa product\n[Press any key to continue]", + ).then(() => { + const scopeData = { + "alexa:all": { + productID: productId, + productInstanceAttributes: { + deviceSerialNumber: 123, // can be anything + }, + }, + }; + const getParams = generateQuery({ + client_id: clientId, + scope: "alexa:all", + scope_data: JSON.stringify(scopeData), + response_type: "code", + redirect_uri: redirectURI, + }); + + const authUrl = `https://www.amazon.com/ap/oa?${getParams}`; + + open(authUrl); + process.exit(); + }); }); - - const authUrl = `https://www.amazon.com/ap/oa?${getParams}`; - - open(authUrl); - process.exit(); }); }); });
b7411dd3a2fca8db7370bad802263b02f0908c16
src/Icon.tsx
src/Icon.tsx
import * as React from 'react'; export enum ActionType { zoomIn = 1, zoomOut = 2, prev = 3, next = 4, rotateLeft = 5, rotateRight = 6, reset = 7, close = 8, scaleX = 9, scaleY = 10, download = 11, } export interface IconProps { type: ActionType; } export default class Icon extends React.Component<IconProps, any> { render() { let prefixCls = 'react-viewer-icon'; return ( <i className={`${prefixCls} ${prefixCls}-${ActionType[this.props.type]}`}></i> ); } }
import * as React from 'react'; export enum ActionType { zoomIn = 1, zoomOut = 2, prev = 3, next = 4, rotateLeft = 5, rotateRight = 6, reset = 7, close = 8, scaleX = 9, scaleY = 10, download = 11, } export interface IconProps { type: ActionType; } export default function Icon(props: IconProps) { let prefixCls = 'react-viewer-icon'; return ( <i className={`${prefixCls} ${prefixCls}-${ActionType[props.type]}`}></i> ); }
Fix "TypeError: Super expression must either be null or a function"
Fix "TypeError: Super expression must either be null or a function"
TypeScript
mit
infeng/react-viewer,infeng/react-viewer
--- +++ @@ -18,12 +18,10 @@ type: ActionType; } -export default class Icon extends React.Component<IconProps, any> { - render() { - let prefixCls = 'react-viewer-icon'; +export default function Icon(props: IconProps) { + let prefixCls = 'react-viewer-icon'; - return ( - <i className={`${prefixCls} ${prefixCls}-${ActionType[this.props.type]}`}></i> - ); - } + return ( + <i className={`${prefixCls} ${prefixCls}-${ActionType[props.type]}`}></i> + ); }
e3afa9992b81c7de03d9d9a7827ee39358a17484
src/index.ts
src/index.ts
export default null;
export type NodeId = number | string; export interface Graph { nodes: Node[]; edges: Edge[]; } export interface Node { id: NodeId; location: Point; } export interface Edge { startNode: NodeId; endNode: NodeId; innerPoints?: Point[]; } export interface Point { x: number; y: number; } export interface Destination { edgeIndex: number; distance: number; } export default function shortestPath(graph: Graph, start: Destination, end: Destination): NodeId[] { return []; }
Make some initial type definitions
Make some initial type definitions
TypeScript
mit
dphilipson/graphs-and-paths
--- +++ @@ -1 +1,32 @@ -export default null; +export type NodeId = number | string; + + +export interface Graph { + nodes: Node[]; + edges: Edge[]; +} + +export interface Node { + id: NodeId; + location: Point; +} + +export interface Edge { + startNode: NodeId; + endNode: NodeId; + innerPoints?: Point[]; +} + +export interface Point { + x: number; + y: number; +} + +export interface Destination { + edgeIndex: number; + distance: number; +} + +export default function shortestPath(graph: Graph, start: Destination, end: Destination): NodeId[] { + return []; +}
c71ff5707a9f543551d705d4f261448329063e51
src/utils.ts
src/utils.ts
import { commands } from "vscode"; export function setContext(key: string, value: any) { return commands.executeCommand("setContext", key, value); } export function executeCommand(cmd: string, args: any) { if (Array.isArray(args)) { const arr = args as any[]; return commands.executeCommand(cmd, ...arr); } else if (args) { // undefined from the object chainning/indexing or // null from the json deserialization return commands.executeCommand(cmd, args); } else { return commands.executeCommand(cmd); } } export async function executeCommands(cmds: string[], args: any) { for (let i = 0; i < cmds.length; i++) { const cmd = cmds[i]; const arg = args?.[i]; await executeCommand(cmd, arg); } } export function specializeBindingKey(s: string) { return s.replace(/ /g, '␣').replace(/\t/g, '↹'); }
import { commands } from "vscode"; export function setContext(key: string, value: any) { return commands.executeCommand("setContext", key, value); } export function executeCommand(cmd: string, args: any) { if (Array.isArray(args)) { const arr = args as any[]; return commands.executeCommand(cmd, ...arr); } else if (args) { // undefined from the object chainning/indexing or // null from the json deserialization return commands.executeCommand(cmd, args); } else { return commands.executeCommand(cmd); } } export async function executeCommands(cmds: string[], args: any) { for (let i = 0; i < cmds.length; i++) { const cmd = cmds[i]; const arg = args?.[i]; await executeCommand(cmd, arg); } } // https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) export function toFullWidthKey(s: string) { let key = ""; for (const symbol of s) { const codePoint = symbol.codePointAt(0); if (s.length === 1 && codePoint && codePoint >= 33 && codePoint <= 126) { // Only replace single character string to full width // ASCII character into full width characters key += String.fromCodePoint(codePoint + 65248); } else if (codePoint === 32) { // Space key += '␣'; } else if (codePoint === 9) { // tab key += '↹'; } else { key += symbol; } } return key; } export function specializeBindingKey(s: string) { let key = ""; for (const symbol of s) { const codePoint = symbol.codePointAt(0); if (codePoint === 32) { // Space key += '␣'; } else if (codePoint === 9) { // tab key += '↹'; } else { key += symbol; } } return key; }
Implement to full width key
Implement to full width key
TypeScript
mit
VSpaceCode/vscode-which-key,VSpaceCode/vscode-which-key
--- +++ @@ -25,6 +25,43 @@ } } +// https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block) +export function toFullWidthKey(s: string) { + let key = ""; + for (const symbol of s) { + const codePoint = symbol.codePointAt(0); + if (s.length === 1 && codePoint && codePoint >= 33 && codePoint <= 126) { + // Only replace single character string to full width + // ASCII character into full width characters + key += String.fromCodePoint(codePoint + 65248); + } else if (codePoint === 32) { + // Space + key += '␣'; + } else if (codePoint === 9) { + // tab + key += '↹'; + } else { + key += symbol; + } + } + + return key; +} + export function specializeBindingKey(s: string) { - return s.replace(/ /g, '␣').replace(/\t/g, '↹'); + let key = ""; + for (const symbol of s) { + const codePoint = symbol.codePointAt(0); + if (codePoint === 32) { + // Space + key += '␣'; + } else if (codePoint === 9) { + // tab + key += '↹'; + } else { + key += symbol; + } + } + + return key; }
e8b85f0f4875496c710a5d4bc4ccad388d21915c
ftp/ftp-tests.ts
ftp/ftp-tests.ts
/// <reference path="ftp.d.ts" /> /// <reference path="../node/node.d.ts" /> import Client = require("ftp"); import fs = require("fs"); var c = new Client(); c.on('ready', (): void => { c.get('foo.txt', function(err: Error, stream: NodeJS.ReadableStream): void { if (err) throw err; stream.once('close', function(): void { c.end(); }); stream.pipe(fs.createWriteStream('foo.local-copy.txt')); }); }); // connect to localhost:21 as anonymous c.connect(); c.connect({ host: "127.0.0.1", port: 21, user: "Boo", password: "secret" });
/// <reference path="ftp.d.ts" /> /// <reference path="../node/node.d.ts" /> import Client = require("ftp"); import fs = require("fs"); var c = new Client(); c.on('ready', (): void => { c.get('foo.txt', function(err: Error, stream: NodeJS.ReadableStream): void { if (err) throw err; stream.once('close', function(): void { c.end(); }); stream.pipe(fs.createWriteStream('foo.local-copy.txt')); }); }); // connect to localhost:21 as anonymous c.connect(); c.connect({ host: "127.0.0.1", port: 21, user: "Boo", password: "secret" });
Normalize to tabs even though they're awful in 'ftp'.
Normalize to tabs even though they're awful in 'ftp'.
TypeScript
mit
TrabacchinLuigi/DefinitelyTyped,olivierlemasle/DefinitelyTyped,RX14/DefinitelyTyped,nakakura/DefinitelyTyped,jesseschalken/DefinitelyTyped,Gmulti/DefinitelyTyped,scriby/DefinitelyTyped,rockclimber90/DefinitelyTyped,zuzusik/DefinitelyTyped,igorsechyn/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,Zenorbi/DefinitelyTyped,lbguilherme/DefinitelyTyped,OpenMaths/DefinitelyTyped,arma-gast/DefinitelyTyped,jaysoo/DefinitelyTyped,sclausen/DefinitelyTyped,maxlang/DefinitelyTyped,HPFOD/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,nabeix/DefinitelyTyped,OpenMaths/DefinitelyTyped,mcrawshaw/DefinitelyTyped,scatcher/DefinitelyTyped,QuatroCode/DefinitelyTyped,robert-voica/DefinitelyTyped,subash-a/DefinitelyTyped,ajtowf/DefinitelyTyped,GodsBreath/DefinitelyTyped,igorraush/DefinitelyTyped,chrismbarr/DefinitelyTyped,magny/DefinitelyTyped,PascalSenn/DefinitelyTyped,philippstucki/DefinitelyTyped,TheBay0r/DefinitelyTyped,onecentlin/DefinitelyTyped,eekboom/DefinitelyTyped,Trapulo/DefinitelyTyped,hellopao/DefinitelyTyped,xStrom/DefinitelyTyped,ml-workshare/DefinitelyTyped,zuohaocheng/DefinitelyTyped,Saneyan/DefinitelyTyped,lseguin42/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,georgemarshall/DefinitelyTyped,Minishlink/DefinitelyTyped,benliddicott/DefinitelyTyped,erosb/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,mcrawshaw/DefinitelyTyped,markogresak/DefinitelyTyped,laco0416/DefinitelyTyped,Kuniwak/DefinitelyTyped,evandrewry/DefinitelyTyped,amanmahajan7/DefinitelyTyped,muenchdo/DefinitelyTyped,chrootsu/DefinitelyTyped,damianog/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,bilou84/DefinitelyTyped,frogcjn/DefinitelyTyped,hx0day/DefinitelyTyped,Litee/DefinitelyTyped,dflor003/DefinitelyTyped,Ridermansb/DefinitelyTyped,giggio/DefinitelyTyped,Almouro/DefinitelyTyped,magny/DefinitelyTyped,jraymakers/DefinitelyTyped,chbrown/DefinitelyTyped,M-Zuber/DefinitelyTyped,drinchev/DefinitelyTyped,benishouga/DefinitelyTyped,Syati/DefinitelyTyped,rerezz/DefinitelyTyped,jimthedev/DefinitelyTyped,ayanoin/DefinitelyTyped,UzEE/DefinitelyTyped,deeleman/DefinitelyTyped,abner/DefinitelyTyped,stephenjelfs/DefinitelyTyped,innerverse/DefinitelyTyped,danfma/DefinitelyTyped,progre/DefinitelyTyped,mshmelev/DefinitelyTyped,bruennijs/DefinitelyTyped,brainded/DefinitelyTyped,raijinsetsu/DefinitelyTyped,reppners/DefinitelyTyped,nelsonmorais/DefinitelyTyped,rschmukler/DefinitelyTyped,donnut/DefinitelyTyped,smrq/DefinitelyTyped,alextkachman/DefinitelyTyped,gyohk/DefinitelyTyped,fredgalvao/DefinitelyTyped,teddyward/DefinitelyTyped,abmohan/DefinitelyTyped,donnut/DefinitelyTyped,danfma/DefinitelyTyped,newclear/DefinitelyTyped,EnableSoftware/DefinitelyTyped,behzad888/DefinitelyTyped,UzEE/DefinitelyTyped,greglo/DefinitelyTyped,bluong/DefinitelyTyped,paulmorphy/DefinitelyTyped,amanmahajan7/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,frogcjn/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,syuilo/DefinitelyTyped,abbasmhd/DefinitelyTyped,jraymakers/DefinitelyTyped,davidsidlinger/DefinitelyTyped,flyfishMT/DefinitelyTyped,alexdresko/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,dragouf/DefinitelyTyped,wbuchwalter/DefinitelyTyped,dsebastien/DefinitelyTyped,drillbits/DefinitelyTyped,stylelab-io/DefinitelyTyped,stacktracejs/DefinitelyTyped,martinduparc/DefinitelyTyped,kalloc/DefinitelyTyped,GregOnNet/DefinitelyTyped,shovon/DefinitelyTyped,ashwinr/DefinitelyTyped,mareek/DefinitelyTyped,AgentME/DefinitelyTyped,aldo-roman/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,gcastre/DefinitelyTyped,acepoblete/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,stanislavHamara/DefinitelyTyped,dydek/DefinitelyTyped,vincentw56/DefinitelyTyped,one-pieces/DefinitelyTyped,munxar/DefinitelyTyped,stephenjelfs/DefinitelyTyped,timjk/DefinitelyTyped,DeluxZ/DefinitelyTyped,tan9/DefinitelyTyped,RX14/DefinitelyTyped,teves-castro/DefinitelyTyped,nobuoka/DefinitelyTyped,schmuli/DefinitelyTyped,scriby/DefinitelyTyped,mareek/DefinitelyTyped,jsaelhof/DefinitelyTyped,vagarenko/DefinitelyTyped,DenEwout/DefinitelyTyped,pkhayundi/DefinitelyTyped,jeremyhayes/DefinitelyTyped,isman-usoh/DefinitelyTyped,Dashlane/DefinitelyTyped,takenet/DefinitelyTyped,Penryn/DefinitelyTyped,whoeverest/DefinitelyTyped,nainslie/DefinitelyTyped,nitintutlani/DefinitelyTyped,superduper/DefinitelyTyped,georgemarshall/DefinitelyTyped,nfriend/DefinitelyTyped,tan9/DefinitelyTyped,psnider/DefinitelyTyped,mweststrate/DefinitelyTyped,arcticwaters/DefinitelyTyped,micurs/DefinitelyTyped,TildaLabs/DefinitelyTyped,martinduparc/DefinitelyTyped,jsaelhof/DefinitelyTyped,glenndierckx/DefinitelyTyped,mcliment/DefinitelyTyped,rschmukler/DefinitelyTyped,abbasmhd/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,lightswitch05/DefinitelyTyped,gandjustas/DefinitelyTyped,nojaf/DefinitelyTyped,georgemarshall/DefinitelyTyped,optical/DefinitelyTyped,mvarblow/DefinitelyTyped,martinduparc/DefinitelyTyped,teves-castro/DefinitelyTyped,dmoonfire/DefinitelyTyped,ryan10132/DefinitelyTyped,smrq/DefinitelyTyped,raijinsetsu/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,reppners/DefinitelyTyped,hiraash/DefinitelyTyped,mhegazy/DefinitelyTyped,alextkachman/DefinitelyTyped,johan-gorter/DefinitelyTyped,hafenr/DefinitelyTyped,nakakura/DefinitelyTyped,damianog/DefinitelyTyped,hatz48/DefinitelyTyped,florentpoujol/DefinitelyTyped,chrootsu/DefinitelyTyped,mattanja/DefinitelyTyped,nmalaguti/DefinitelyTyped,alainsahli/DefinitelyTyped,pwelter34/DefinitelyTyped,flyfishMT/DefinitelyTyped,esperco/DefinitelyTyped,emanuelhp/DefinitelyTyped,Mek7/DefinitelyTyped,paulmorphy/DefinitelyTyped,philippstucki/DefinitelyTyped,algorithme/DefinitelyTyped,syntax42/DefinitelyTyped,trystanclarke/DefinitelyTyped,dpsthree/DefinitelyTyped,bennett000/DefinitelyTyped,rushi216/DefinitelyTyped,chadoliver/DefinitelyTyped,wcomartin/DefinitelyTyped,nitintutlani/DefinitelyTyped,lbesson/DefinitelyTyped,tboyce/DefinitelyTyped,jimthedev/DefinitelyTyped,shlomiassaf/DefinitelyTyped,arcticwaters/DefinitelyTyped,bpowers/DefinitelyTyped,lekaha/DefinitelyTyped,nainslie/DefinitelyTyped,syuilo/DefinitelyTyped,nycdotnet/DefinitelyTyped,RedSeal-co/DefinitelyTyped,johan-gorter/DefinitelyTyped,shahata/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,mattblang/DefinitelyTyped,bdoss/DefinitelyTyped,pwelter34/DefinitelyTyped,egeland/DefinitelyTyped,emanuelhp/DefinitelyTyped,nmalaguti/DefinitelyTyped,spearhead-ea/DefinitelyTyped,arusakov/DefinitelyTyped,davidpricedev/DefinitelyTyped,dsebastien/DefinitelyTyped,robl499/DefinitelyTyped,Zzzen/DefinitelyTyped,bjfletcher/DefinitelyTyped,tjoskar/DefinitelyTyped,WritingPanda/DefinitelyTyped,Ptival/DefinitelyTyped,alvarorahul/DefinitelyTyped,QuatroCode/DefinitelyTyped,Zorgatone/DefinitelyTyped,fnipo/DefinitelyTyped,elisee/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,borisyankov/DefinitelyTyped,Penryn/DefinitelyTyped,OfficeDev/DefinitelyTyped,KonaTeam/DefinitelyTyped,JaminFarr/DefinitelyTyped,sixinli/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,olemp/DefinitelyTyped,fredgalvao/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,gcastre/DefinitelyTyped,Zorgatone/DefinitelyTyped,dydek/DefinitelyTyped,MarlonFan/DefinitelyTyped,angelobelchior8/DefinitelyTyped,rcchen/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,sledorze/DefinitelyTyped,tscho/DefinitelyTyped,herrmanno/DefinitelyTyped,use-strict/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,vagarenko/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,billccn/DefinitelyTyped,gregoryagu/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,AgentME/DefinitelyTyped,applesaucers/lodash-invokeMap,Shiak1/DefinitelyTyped,wilfrem/DefinitelyTyped,nobuoka/DefinitelyTyped,adammartin1981/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,aindlq/DefinitelyTyped,vasek17/DefinitelyTyped,pocesar/DefinitelyTyped,tdmckinn/DefinitelyTyped,mhegazy/DefinitelyTyped,biomassives/DefinitelyTyped,paxibay/DefinitelyTyped,scsouthw/DefinitelyTyped,olemp/DefinitelyTyped,Pro/DefinitelyTyped,trystanclarke/DefinitelyTyped,ciriarte/DefinitelyTyped,hor-crux/DefinitelyTyped,amir-arad/DefinitelyTyped,pocesar/DefinitelyTyped,esperco/DefinitelyTyped,cvrajeesh/DefinitelyTyped,benishouga/DefinitelyTyped,mshmelev/DefinitelyTyped,florentpoujol/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,greglo/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,dariajung/DefinitelyTyped,davidpricedev/DefinitelyTyped,drinchev/DefinitelyTyped,Pro/DefinitelyTyped,schmuli/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,gandjustas/DefinitelyTyped,zalamtech/DefinitelyTyped,dumbmatter/DefinitelyTyped,Riron/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,omidkrad/DefinitelyTyped,mattanja/DefinitelyTyped,subash-a/DefinitelyTyped,DeadAlready/DefinitelyTyped,Bobjoy/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,elisee/DefinitelyTyped,rolandzwaga/DefinitelyTyped,kuon/DefinitelyTyped,HPFOD/DefinitelyTyped,jasonswearingen/DefinitelyTyped,progre/DefinitelyTyped,nycdotnet/DefinitelyTyped,maglar0/DefinitelyTyped,bennett000/DefinitelyTyped,schmuli/DefinitelyTyped,digitalpixies/DefinitelyTyped,shlomiassaf/DefinitelyTyped,mwain/DefinitelyTyped,arusakov/DefinitelyTyped,Lorisu/DefinitelyTyped,zuzusik/DefinitelyTyped,adamcarr/DefinitelyTyped,felipe3dfx/DefinitelyTyped,axelcostaspena/DefinitelyTyped,goaty92/DefinitelyTyped,Pipe-shen/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,mjjames/DefinitelyTyped,onecentlin/DefinitelyTyped,aciccarello/DefinitelyTyped,fearthecowboy/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,Karabur/DefinitelyTyped,eugenpodaru/DefinitelyTyped,sclausen/DefinitelyTyped,MugeSo/DefinitelyTyped,behzad888/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,jimthedev/DefinitelyTyped,Dominator008/DefinitelyTyped,wilfrem/DefinitelyTyped,Dominator008/DefinitelyTyped,Ptival/DefinitelyTyped,psnider/DefinitelyTyped,PopSugar/DefinitelyTyped,hatz48/DefinitelyTyped,benishouga/DefinitelyTyped,alexdresko/DefinitelyTyped,sledorze/DefinitelyTyped,mendix/DefinitelyTyped,arma-gast/DefinitelyTyped,zuzusik/DefinitelyTyped,IAPark/DefinitelyTyped,NCARalph/DefinitelyTyped,takenet/DefinitelyTyped,mjjames/DefinitelyTyped,dmoonfire/DefinitelyTyped,Syati/DefinitelyTyped,musicist288/DefinitelyTyped,Litee/DefinitelyTyped,moonpyk/DefinitelyTyped,chocolatechipui/DefinitelyTyped,aroder/DefinitelyTyped,basp/DefinitelyTyped,mszczepaniak/DefinitelyTyped,ajtowf/DefinitelyTyped,hellopao/DefinitelyTyped,rolandzwaga/DefinitelyTyped,borisyankov/DefinitelyTyped,ashwinr/DefinitelyTyped,Jwsonic/DefinitelyTyped,chrismbarr/DefinitelyTyped,masonkmeyer/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,isman-usoh/DefinitelyTyped,forumone/DefinitelyTyped,jbrantly/DefinitelyTyped,egeland/DefinitelyTyped,MugeSo/DefinitelyTyped,timramone/DefinitelyTyped,gildorwang/DefinitelyTyped,Zzzen/DefinitelyTyped,arusakov/DefinitelyTyped,uestcNaldo/DefinitelyTyped,mattblang/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,bdoss/DefinitelyTyped,use-strict/DefinitelyTyped,Karabur/DefinitelyTyped,YousefED/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,minodisk/DefinitelyTyped,jasonswearingen/DefinitelyTyped,YousefED/DefinitelyTyped,stacktracejs/DefinitelyTyped,psnider/DefinitelyTyped,subjectix/DefinitelyTyped,opichals/DefinitelyTyped,xStrom/DefinitelyTyped,optical/DefinitelyTyped,AgentME/DefinitelyTyped,daptiv/DefinitelyTyped,vsavkin/DefinitelyTyped,rcchen/DefinitelyTyped,abner/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,almstrand/DefinitelyTyped,Chris380/DefinitelyTyped,yuit/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,applesaucers/lodash-invokeMap,richardTowers/DefinitelyTyped,newclear/DefinitelyTyped,pocesar/DefinitelyTyped,gyohk/DefinitelyTyped,aciccarello/DefinitelyTyped,minodisk/DefinitelyTyped,aciccarello/DefinitelyTyped,alvarorahul/DefinitelyTyped,ErykB2000/DefinitelyTyped,zhiyiting/DefinitelyTyped,Dashlane/DefinitelyTyped,glenndierckx/DefinitelyTyped,wkrueger/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,nodeframe/DefinitelyTyped,EnableSoftware/DefinitelyTyped,ecramer89/DefinitelyTyped,sandersky/DefinitelyTyped,yuit/DefinitelyTyped,hellopao/DefinitelyTyped
--- +++ @@ -19,8 +19,8 @@ c.connect({ host: "127.0.0.1", - port: 21, - user: "Boo", + port: 21, + user: "Boo", password: "secret" });
bc0bbbce9c58f37f9a4fc9c49e8f97a4816719ee
source/types/itemList.ts
source/types/itemList.ts
import * as _ from 'lodash'; export interface IItem { value: number; name: string; display: string; } export interface IItemList<TItemType extends IItem> { get(value: number | string): TItemType; all(): TItemType[]; } export class ItemList<TItemType extends IItem> implements IItemList<TItemType> { private items: TItemType[]; setItems(items: TItemType[]): void { this.items = items; } get(value: number | string): TItemType { var predicate: { (item: TItemType): boolean }; if (typeof value === 'string') { predicate = (item: TItemType): boolean => { return (item.name === value); }; } else { predicate = (item: TItemType): boolean => { return (item.value === value); }; } return _.find(this.items, predicate); } all(): TItemType[] { return this.items; } } export class SortedItemList<TItemType extends IItem> extends ItemList<TItemType> { setItems(items: TItemType[]): void { super.setItems(items.sort((i1, i2) => { return i1.display.localeCompare(i2.display); })); } }
import * as _ from 'lodash'; export interface IItem { value: number; name: string; display: string; } export interface IItemList<TItemType extends IItem> { get(value: number | string): TItemType; all(): TItemType[]; } export class ItemList<TItemType extends IItem> implements IItemList<TItemType> { private items: TItemType[]; setItems(items: TItemType[]): void { this.items = items; } get(value: number | string): TItemType { var predicate: { (item: TItemType): boolean }; if (typeof value === 'string') { predicate = (item: TItemType): boolean => { return (item.name === value); }; } else { predicate = (item: TItemType): boolean => { return (item.value === value); }; } return _.find(this.items, predicate); } all(): TItemType[] { return this.items; } } export class SortedItemList<TItemType extends IItem> extends ItemList<TItemType> { setItems(items: TItemType[]): void { super.setItems(_.sortBy(items, x => x.display)); } }
Use lodash sort instead of native one.
Use lodash sort instead of native one. This is a bit easier to read.
TypeScript
mit
RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities
--- +++ @@ -41,8 +41,6 @@ export class SortedItemList<TItemType extends IItem> extends ItemList<TItemType> { setItems(items: TItemType[]): void { - super.setItems(items.sort((i1, i2) => { - return i1.display.localeCompare(i2.display); - })); + super.setItems(_.sortBy(items, x => x.display)); } }
d765b09a5b71d361e2bb7ea4be31b4f15b6e2053
src/Test/Ast/NakedUrl.ts
src/Test/Ast/NakedUrl.ts
import { expect } from 'chai' import * as Up from '../../index' import { insideDocumentAndParagraph } from './Helpers' import { LinkNode } from '../../SyntaxNodes/LinkNode' import { DocumentNode } from '../../SyntaxNodes/DocumentNode' import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' import { StressNode } from '../../SyntaxNodes/StressNode' import { InlineCodeNode } from '../../SyntaxNodes/InlineCodeNode' import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode' import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode' import { SpoilerNode } from '../../SyntaxNodes/SpoilerNode' import { ParagraphNode } from '../../SyntaxNodes/ParagraphNode' import { SectionSeparatorNode } from '../../SyntaxNodes/SectionSeparatorNode' describe('A naked URL', () => { it('produces a link node. The content of the link is the URL minus its protocol', () => { expect(Up.toAst('https://archive.org')).to.be.eql( insideDocumentAndParagraph([ new LinkNode([ new PlainTextNode('archive.org') ], 'https://archive.org') ])) }) })
import { expect } from 'chai' import * as Up from '../../index' import { insideDocumentAndParagraph } from './Helpers' import { LinkNode } from '../../SyntaxNodes/LinkNode' import { DocumentNode } from '../../SyntaxNodes/DocumentNode' import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode' import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode' import { StressNode } from '../../SyntaxNodes/StressNode' import { InlineCodeNode } from '../../SyntaxNodes/InlineCodeNode' import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode' import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode' import { SpoilerNode } from '../../SyntaxNodes/SpoilerNode' import { ParagraphNode } from '../../SyntaxNodes/ParagraphNode' import { SectionSeparatorNode } from '../../SyntaxNodes/SectionSeparatorNode' describe('A naked URL', () => { it('produces a link node. The content of the link is the URL minus its protocol', () => { expect(Up.toAst('https://archive.org')).to.be.eql( insideDocumentAndParagraph([ new LinkNode([ new PlainTextNode('archive.org') ], 'https://archive.org') ])) }) it('is terminated by a space', () => { expect(Up.toAst('https://archive.org ')).to.be.eql( insideDocumentAndParagraph([ new LinkNode([ new PlainTextNode('archive.org') ], 'https://archive.org') ])) }) })
Add passing naked URL test
Add passing naked URL test
TypeScript
mit
start/up,start/up
--- +++ @@ -24,5 +24,13 @@ ], 'https://archive.org') ])) }) + + it('is terminated by a space', () => { + expect(Up.toAst('https://archive.org ')).to.be.eql( + insideDocumentAndParagraph([ + new LinkNode([ + new PlainTextNode('archive.org') + ], 'https://archive.org') + ])) + }) }) -
a26ff5411cff6383bd00186d3321e6e1d911af92
packages/lesswrong/components/posts/PostsCompareRevisions.tsx
packages/lesswrong/components/posts/PostsCompareRevisions.tsx
import React from 'react'; import { Components, registerComponent } from '../../lib/vulcan-lib'; import { Posts } from '../../lib/collections/posts'; import { useLocation } from '../../lib/routeUtil'; import { useSingle } from '../../lib/crud/withSingle'; import { styles } from './PostsPage/PostsPage'; const PostsCompareRevisions = ({ classes }: { classes: ClassesType }) => { const { params, query } = useLocation(); const postId = params._id; const versionBefore = query.before; const versionAfter = query.after; // Load the post, just for the current title const { document: post, loading: loadingPost } = useSingle({ documentId: postId, collection: Posts, fragmentName: "PostsWithNavigation", }); const { CompareRevisions, PostsPagePostHeader, RevisionComparisonNotice, Loading } = Components; if (loadingPost || !post) return <Loading/> return <div className={classes.centralColumn}> <PostsPagePostHeader post={post}/> <RevisionComparisonNotice before={versionBefore} after={versionAfter} /> <div className={classes.postContent}> <CompareRevisions collectionName="Posts" fieldName="contents" documentId={postId} versionBefore={versionBefore} versionAfter={versionAfter} /> </div> </div>; } const PostsCompareRevisionsComponent = registerComponent("PostsCompareRevisions", PostsCompareRevisions, {styles}); declare global { interface ComponentTypes { PostsCompareRevisions: typeof PostsCompareRevisionsComponent } }
import React from 'react'; import { Components, registerComponent } from '../../lib/vulcan-lib'; import { Posts } from '../../lib/collections/posts'; import { useLocation } from '../../lib/routeUtil'; import { useSingle } from '../../lib/crud/withSingle'; import { styles } from './PostsPage/PostsPage'; const PostsCompareRevisions = ({ classes }: { classes: ClassesType }) => { const { params, query } = useLocation(); const postId = params._id; const versionBefore = query.before; const versionAfter = query.after; // Load the post, just for the current title const { document: post, loading: loadingPost } = useSingle({ documentId: postId, collection: Posts, fragmentName: "PostsWithNavigation", extraVariables: { sequenceId: 'String' }, extraVariablesValues: { sequenceId: null }, }); const { CompareRevisions, PostsPagePostHeader, RevisionComparisonNotice, Loading } = Components; if (loadingPost || !post) return <Loading/> return <div className={classes.centralColumn}> <PostsPagePostHeader post={post}/> <RevisionComparisonNotice before={versionBefore} after={versionAfter} /> <div className={classes.postContent}> <CompareRevisions collectionName="Posts" fieldName="contents" documentId={postId} versionBefore={versionBefore} versionAfter={versionAfter} /> </div> </div>; } const PostsCompareRevisionsComponent = registerComponent("PostsCompareRevisions", PostsCompareRevisions, {styles}); declare global { interface ComponentTypes { PostsCompareRevisions: typeof PostsCompareRevisionsComponent } }
Fix a crash on the post revision-comparison page
Fix a crash on the post revision-comparison page
TypeScript
mit
Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope
--- +++ @@ -18,6 +18,8 @@ documentId: postId, collection: Posts, fragmentName: "PostsWithNavigation", + extraVariables: { sequenceId: 'String' }, + extraVariablesValues: { sequenceId: null }, }); const { CompareRevisions, PostsPagePostHeader, RevisionComparisonNotice, Loading } = Components;
486a33c886ebd022682737ef86fcf8f12910004d
src/app/shell/Destiny.tsx
src/app/shell/Destiny.tsx
import * as React from 'react'; import { UIView } from "@uirouter/react"; import ManifestProgress from './ManifestProgress'; import { $rootScope } from 'ngimport'; import { hotkeys } from '../ngimport-more'; import { t } from 'i18next'; import { itemTags } from '../settings/settings'; import { DestinyAccount } from '../accounts/destiny-account.service'; interface Props { account: DestinyAccount; } /** * Base view for pages that show Destiny content. */ export default class Destiny extends React.Component<Props> { private $scope = $rootScope.$new(true); componentDidMount() { const hot = hotkeys.bindTo(this.$scope); hot.add({ combo: ['i'], description: t('Hotkey.ToggleDetails'), callback() { $rootScope.$broadcast('dim-toggle-item-details'); } }); itemTags.forEach((tag) => { if (tag.hotkey) { hot.add({ combo: [tag.hotkey], description: t('Hotkey.MarkItemAs', { tag: t(tag.label) }), callback() { $rootScope.$broadcast('dim-item-tag', { tag: tag.type }); } }); } }); } componentWillUnmount() { this.$scope.$destroy(); } render() { return ( <> <div id="content"> <UIView/> </div> <div className="store-bounds"/> <ManifestProgress destinyVersion={this.props.account.destinyVersion} /> </> ); } }
import * as React from 'react'; import { UIView } from "@uirouter/react"; import ManifestProgress from './ManifestProgress'; import { $rootScope } from 'ngimport'; import { hotkeys } from '../ngimport-more'; import { t } from 'i18next'; import { itemTags } from '../settings/settings'; import { DestinyAccount } from '../accounts/destiny-account.service'; interface Props { account: DestinyAccount; } /** * Base view for pages that show Destiny content. */ export default class Destiny extends React.Component<Props> { private $scope = $rootScope.$new(true); componentDidMount() { const hot = hotkeys.bindTo(this.$scope); hot.add({ combo: ['i'], description: t('Hotkey.ToggleDetails'), callback() { $rootScope.$broadcast('dim-toggle-item-details'); } }); itemTags.forEach((tag) => { if (tag.hotkey) { hot.add({ combo: [tag.hotkey], description: t('Hotkey.MarkItemAs', { tag: t(tag.label) }), callback() { $rootScope.$broadcast('dim-item-tag', { tag: tag.type }); } }); } }); } componentWillUnmount() { this.$scope.$destroy(); } render() { return ( <> <div className="store-bounds"/> <div id="content"> <UIView/> </div> <ManifestProgress destinyVersion={this.props.account.destinyVersion} /> </> ); } }
Fix iOS layout thrashing bug
Fix iOS layout thrashing bug
TypeScript
mit
bhollis/DIM,bhollis/DIM,chrisfried/DIM,delphiactual/DIM,chrisfried/DIM,chrisfried/DIM,delphiactual/DIM,DestinyItemManager/DIM,bhollis/DIM,DestinyItemManager/DIM,delphiactual/DIM,bhollis/DIM,delphiactual/DIM,DestinyItemManager/DIM,chrisfried/DIM,DestinyItemManager/DIM
--- +++ @@ -49,10 +49,10 @@ render() { return ( <> + <div className="store-bounds"/> <div id="content"> <UIView/> </div> - <div className="store-bounds"/> <ManifestProgress destinyVersion={this.props.account.destinyVersion} /> </> );
35ce084572b3da9103949de464c81a5c4cc348e5
packages/hint-performance-budget/src/meta.ts
packages/hint-performance-budget/src/meta.ts
import { Category } from 'hint/dist/src/lib/enums/category'; import { HintScope } from 'hint/dist/src/lib/enums/hintscope'; import { HintMetadata } from 'hint/dist/src/lib/types'; import * as Connections from './connections'; const meta: HintMetadata = { docs: { category: Category.performance, description: `Performance budget checks if your site will load fast enough based on the size of your resources and a given connection speed`, name: 'Performance budget' }, id: 'performance-budget', schema: [{ additionalProperties: false, properties: { connectionType: { oneOf: [{ enum: Connections.ids }], type: 'string' }, loadTime: { minimum: 1, type: 'number' } }, type: 'object' }], scope: HintScope.site }; export default meta;
import { Category } from 'hint/dist/src/lib/enums/category'; import { HintScope } from 'hint/dist/src/lib/enums/hintscope'; import { HintMetadata } from 'hint/dist/src/lib/types'; import * as Connections from './connections'; const meta: HintMetadata = { docs: { category: Category.performance, description: `Performance budget checks if your site will load fast enough based on the size of your resources and a given connection speed`, name: 'Performance budget' }, id: 'performance-budget', schema: [{ additionalProperties: false, properties: { connectionType: { enum: Connections.ids, type: 'string' }, loadTime: { minimum: 1, type: 'number' } }, type: 'object' }], scope: HintScope.site }; export default meta;
Use `enum` instead of `oneOf` in schema
Fix: Use `enum` instead of `oneOf` in schema
TypeScript
apache-2.0
sonarwhal/sonar,sonarwhal/sonar,sonarwhal/sonar
--- +++ @@ -15,7 +15,7 @@ additionalProperties: false, properties: { connectionType: { - oneOf: [{ enum: Connections.ids }], + enum: Connections.ids, type: 'string' }, loadTime: {
1815ad7a1858625b543bc3f0bae9f1b4eb624d85
developer/js/tests/test-parse-wordlist.ts
developer/js/tests/test-parse-wordlist.ts
import {parseWordList} from '../lexical-model-compiler/build-trie'; import {assert} from 'chai'; import 'mocha'; import path = require('path'); const BOM = '\ufeff'; describe('parseWordList', function () { it('should remove the UTF-8 byte order mark from files', function () { let word = 'hello'; let count = 1; let expected = [ [word, count] ]; let file = `# this is a comment\n${word}\t${count}`; let withoutBOM = parseWordList(file); assert.deepEqual(withoutBOM, expected, "expected regular file to parse properly"); let withBOM = parseWordList(`${BOM}${file}`) assert.deepEqual(withBOM, expected, "expected BOM to be ignored"); }); });
import {parseWordList} from '../dist/lexical-model-compiler/build-trie'; import {assert} from 'chai'; import 'mocha'; const BOM = '\ufeff'; describe('parseWordList', function () { it('should remove the UTF-8 byte order mark from files', function () { let word = 'hello'; let count = 1; let expected = [ [word, count] ]; let file = `# this is a comment\n${word}\t${count}`; let withoutBOM = parseWordList(file); assert.deepEqual(withoutBOM, expected, "expected regular file to parse properly"); let withBOM = parseWordList(`${BOM}${file}`) assert.deepEqual(withBOM, expected, "expected BOM to be ignored"); }); });
Fix paths issue from merge.
Fix paths issue from merge.
TypeScript
apache-2.0
tavultesoft/keymanweb,tavultesoft/keymanweb
--- +++ @@ -1,8 +1,6 @@ -import {parseWordList} from '../lexical-model-compiler/build-trie'; +import {parseWordList} from '../dist/lexical-model-compiler/build-trie'; import {assert} from 'chai'; import 'mocha'; - -import path = require('path'); const BOM = '\ufeff';
c9b380771adf25308913eab670740731be28c155
src/messages.component.ts
src/messages.component.ts
import { Component, Input, Optional, OnInit } from '@angular/core'; import { AbstractControl } from '@angular/forms'; import { ValidationMessagesConfiguration, defaultConfig } from './config'; import { MessageProvider } from './message-provider'; @Component({ selector: 'ng2-mdf-validation-message', template: '<span *ngIf="errorMessage !== null" [class]="config.class">{{errorMessage}}</span>' }) export class ValidationMessageComponent implements OnInit { @Input() control: AbstractControl; @Input() class: string; config: ValidationMessagesConfiguration; messageProvider: MessageProvider; constructor( @Optional() private customConfig: ValidationMessagesConfiguration) { this.config = Object.assign({}, defaultConfig); if (customConfig) { this.config = Object.assign({}, defaultConfig, customConfig); } this.messageProvider = new MessageProvider(this.config.defaultErrorMessages); } ngOnInit(): void { this._mergeWithLocalConfiguration(); } get errorMessage(): string { for (let errorPropertyName in this.control.errors) { return this.messageProvider.getErrorMessage(errorPropertyName, this.control.errors[errorPropertyName]); } return null; } /** * Merge instance specific configuration with the default and/or custom one. */ private _mergeWithLocalConfiguration(): void { if (this.class) { this.config.class = this.class; } } }
import { Component, Input, Optional, OnInit } from '@angular/core'; import { AbstractControl } from '@angular/forms'; import { ValidationMessagesConfiguration, defaultConfig } from './config'; import { MessageProvider } from './message-provider'; @Component({ selector: 'ng2-mdf-validation-message', template: '<span *ngIf="errorMessage !== null" [class]="config.class">{{errorMessage}}</span>' }) export class ValidationMessageComponent implements OnInit { @Input() control: AbstractControl; @Input() class: string; config: ValidationMessagesConfiguration; messageProvider: MessageProvider; constructor( @Optional() private customConfig: ValidationMessagesConfiguration) { this.config = Object.assign({}, defaultConfig); if (customConfig) { this.config = Object.assign({}, defaultConfig, customConfig); } const errorMessages = Object.assign({}, defaultConfig.defaultErrorMessages, this.config.defaultErrorMessages); this.messageProvider = new MessageProvider(errorMessages); } ngOnInit(): void { this._mergeWithLocalConfiguration(); } get errorMessage(): string { for (let errorPropertyName in this.control.errors) { return this.messageProvider.getErrorMessage(errorPropertyName, this.control.errors[errorPropertyName]); } return null; } /** * Merge instance specific configuration with the default and/or custom one. */ private _mergeWithLocalConfiguration(): void { if (this.class) { this.config.class = this.class; } } }
Change to be able to override a single error message instead of having to override all of them
Change to be able to override a single error message instead of having to override all of them
TypeScript
mit
d-kostov-dev/ng2-mdf-validation-messages,d-kostov-dev/ng2-mdf-validation-messages,d-kostov-dev/ng2-mdf-validation-messages
--- +++ @@ -22,7 +22,8 @@ this.config = Object.assign({}, defaultConfig, customConfig); } - this.messageProvider = new MessageProvider(this.config.defaultErrorMessages); + const errorMessages = Object.assign({}, defaultConfig.defaultErrorMessages, this.config.defaultErrorMessages); + this.messageProvider = new MessageProvider(errorMessages); } ngOnInit(): void {
5ad1ba260be6eaee38c2b4a6e22b1db938ddbbf9
src/node/NodeUtilities.ts
src/node/NodeUtilities.ts
/// <reference path="../../typedefinitions/node.d.ts" /> /// <reference path="../core/JSUtilities.ts" /> const fs = require("fs"); class NodeUtilities { static argvWithoutProcessName() { return process.argv.slice(2); } static parseArguments(argumentsWithValues: Array<string>, optionCallback: (option: string, value: string) => void, errorCallback: (errorString: string) => void) { let remainingArguments = new Array<string>(); let argv = this.argvWithoutProcessName(); while (argv.length > 0) { let argument = argv.shift(); if (argument.diplographStartsWith("-")) { let value: string = undefined; if (argumentsWithValues.indexOf(argument) !== -1) { value = argv.shift(); if (value === undefined || value.diplographStartsWith("-")) { errorCallback("Option " + argument + " expects a value."); return; } } optionCallback(argument, value); } else { remainingArguments.push(argument); } } return remainingArguments; } }
/// <reference path="../../typedefinitions/node.d.ts" /> /// <reference path="../core/JSUtilities.ts" /> const fs = require("fs"); const path = require("path"); class NodeUtilities { static argvWithoutProcessName() { return process.argv.slice(2); } static parseArguments(argumentsWithValues: Array<string>, optionCallback: (option: string, value: string) => void, errorCallback: (errorString: string) => void) { let remainingArguments = new Array<string>(); let argv = this.argvWithoutProcessName(); while (argv.length > 0) { let argument = argv.shift(); if (argument.diplographStartsWith("-")) { let value: string = undefined; if (argumentsWithValues.indexOf(argument) !== -1) { value = argv.shift(); if (value === undefined || value.diplographStartsWith("-")) { errorCallback("Option " + argument + " expects a value."); return; } } optionCallback(argument, value); } else { remainingArguments.push(argument); } } return remainingArguments; } static recursiveReadPathSync(currentPath: string) { let results = new Array<string>(); let stat = fs.statSync(currentPath); if (stat === undefined) { return results; } else { results.push(currentPath); if (stat.isDirectory()) { let children = fs.readdirSync(currentPath); for (let child of children) { let childPath = path.join(currentPath, child); results = results.concat(this.recursiveReadPathSync(childPath)); } } } return results; } }
Add a method that recurses through a directory and returns a list of all files. This will be used by the test driver to seek out all test files in a directory.
Add a method that recurses through a directory and returns a list of all files. This will be used by the test driver to seek out all test files in a directory.
TypeScript
mit
paulymer/CRISP-8
--- +++ @@ -2,6 +2,7 @@ /// <reference path="../core/JSUtilities.ts" /> const fs = require("fs"); +const path = require("path"); class NodeUtilities { static argvWithoutProcessName() { @@ -31,4 +32,24 @@ return remainingArguments; } + + static recursiveReadPathSync(currentPath: string) { + let results = new Array<string>(); + + let stat = fs.statSync(currentPath); + if (stat === undefined) { + return results; + } else { + results.push(currentPath); + if (stat.isDirectory()) { + let children = fs.readdirSync(currentPath); + for (let child of children) { + let childPath = path.join(currentPath, child); + results = results.concat(this.recursiveReadPathSync(childPath)); + } + } + } + + return results; + } }
66d8b0568e1f6e91fcc2914239f5385c58759f88
src/lib/commitTypes.ts
src/lib/commitTypes.ts
import { SelectOption } from '../dependencies/cliffy.ts'; import { stoyle, theme } from '../dependencies/stoyle.ts'; export const COMMIT_TYPES: Record<string, SelectOption> = { FEAT: { value: 'feat', name: stoyle`${'feat'} when working on a feature`({ nodes: [ theme.strong ] }) }, FIX: { value: 'fix', name: stoyle`${'fix'} when working on a bug fix`({ nodes: [ theme.strong ] }) }, TEST: { value: 'test', name: stoyle`${'test'} when working on tests`({ nodes: [ theme.strong ] }) }, CHORE: { value: 'chore', name: stoyle`${'chore'} when working on anything else`({ nodes: [ theme.strong ] }) }, }; export const COMMIT_TYPES_SELECTION: SelectOption[] = Object.values(COMMIT_TYPES);
import { SelectOption } from '../dependencies/cliffy.ts'; import { stoyle, theme } from '../dependencies/stoyle.ts'; export const COMMIT_TYPES: Record<string, SelectOption> = { FEAT: { value: 'feat', name: stoyle`${'feat'} when working on a feature`({ nodes: [ theme.strong ] }) }, FIX: { value: 'fix', name: stoyle`${'fix'} when working on a bug fix`({ nodes: [ theme.strong ] }) }, DOC: { value: 'doc', name: stoyle`${'doc'} when working on documentation`({ nodes: [ theme.strong ] }) }, TEST: { value: 'test', name: stoyle`${'test'} when working on tests`({ nodes: [ theme.strong ] }) }, CHORE: { value: 'chore', name: stoyle`${'chore'} when working on anything else`({ nodes: [ theme.strong ] }) }, }; export const COMMIT_TYPES_SELECTION: SelectOption[] = Object.values(COMMIT_TYPES);
Add doc commit type for angular message format
:new: Add doc commit type for angular message format
TypeScript
apache-2.0
quilicicf/Gut,quilicicf/Gut
--- +++ @@ -4,6 +4,7 @@ export const COMMIT_TYPES: Record<string, SelectOption> = { FEAT: { value: 'feat', name: stoyle`${'feat'} when working on a feature`({ nodes: [ theme.strong ] }) }, FIX: { value: 'fix', name: stoyle`${'fix'} when working on a bug fix`({ nodes: [ theme.strong ] }) }, + DOC: { value: 'doc', name: stoyle`${'doc'} when working on documentation`({ nodes: [ theme.strong ] }) }, TEST: { value: 'test', name: stoyle`${'test'} when working on tests`({ nodes: [ theme.strong ] }) }, CHORE: { value: 'chore', name: stoyle`${'chore'} when working on anything else`({ nodes: [ theme.strong ] }) }, };
88b4ec57704662a9d422aa3558890bd1751e9749
tether/tether.d.ts
tether/tether.d.ts
// Type definitions for Tether v0.6 // Project: http://github.hubspot.com/tether/ // Definitions by: Adi Dahiya <https://github.com/adidahiya> // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module tether { interface TetherStatic { new(options: ITetherOptions): Tether; } interface ITetherOptions { attachment?: string; classes?: {[className: string]: boolean}; classPrefix?: string; constraints?: ITetherConstraint[]; element?: Element | string | any /* JQuery */; enabled?: boolean; offset?: string; optimizations?: any; target?: Element | string | any /* JQuery */; targetAttachment?: string; targetOffset?: string; targetModifier?: string; } interface ITetherConstraint { attachment?: string; outOfBoundsClass?: string; pin?: boolean | string[]; pinnedClass?: string; to?: string | Element | number[]; } interface Tether { setOptions(options: ITetherOptions): void; disable(): void; enable(): void; destroy(): void; position(): void; } } declare module "tether" { export = tether; } declare var Tether: tether.TetherStatic;
// Type definitions for Tether v0.6 // Project: http://github.hubspot.com/tether/ // Definitions by: Adi Dahiya <https://github.com/adidahiya> // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module tether { interface TetherStatic { new(options: ITetherOptions): Tether; } interface ITetherOptions { attachment?: string; classes?: {[className: string]: boolean}; classPrefix?: string; constraints?: ITetherConstraint[]; element?: HTMLElement | string | any /* JQuery */; enabled?: boolean; offset?: string; optimizations?: any; target?: HTMLElement | string | any /* JQuery */; targetAttachment?: string; targetOffset?: string; targetModifier?: string; } interface ITetherConstraint { attachment?: string; outOfBoundsClass?: string; pin?: boolean | string[]; pinnedClass?: string; to?: string | HTMLElement | number[]; } interface Tether { setOptions(options: ITetherOptions): void; disable(): void; enable(): void; destroy(): void; position(): void; } } declare module "tether" { export = tether; } declare var Tether: tether.TetherStatic;
Use stricter Element type in tether options
Use stricter Element type in tether options
TypeScript
mit
paxibay/DefinitelyTyped,NCARalph/DefinitelyTyped,muenchdo/DefinitelyTyped,acepoblete/DefinitelyTyped,dmoonfire/DefinitelyTyped,michalczukm/DefinitelyTyped,sclausen/DefinitelyTyped,jacqt/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,darkl/DefinitelyTyped,ecramer89/DefinitelyTyped,rcchen/DefinitelyTyped,QuatroCode/DefinitelyTyped,esperco/DefinitelyTyped,HPFOD/DefinitelyTyped,adamcarr/DefinitelyTyped,the41/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,dpsthree/DefinitelyTyped,bdoss/DefinitelyTyped,kmeurer/DefinitelyTyped,TildaLabs/DefinitelyTyped,whoeverest/DefinitelyTyped,psnider/DefinitelyTyped,adammartin1981/DefinitelyTyped,rcchen/DefinitelyTyped,mattblang/DefinitelyTyped,ciriarte/DefinitelyTyped,mjjames/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,AgentME/DefinitelyTyped,hatz48/DefinitelyTyped,emanuelhp/DefinitelyTyped,paulmorphy/DefinitelyTyped,KonaTeam/DefinitelyTyped,chadoliver/DefinitelyTyped,innerverse/DefinitelyTyped,bdoss/DefinitelyTyped,cherrydev/DefinitelyTyped,mattanja/DefinitelyTyped,elisee/DefinitelyTyped,goaty92/DefinitelyTyped,lightswitch05/DefinitelyTyped,minodisk/DefinitelyTyped,egeland/DefinitelyTyped,robl499/DefinitelyTyped,raijinsetsu/DefinitelyTyped,chbrown/DefinitelyTyped,one-pieces/DefinitelyTyped,nfriend/DefinitelyTyped,aindlq/DefinitelyTyped,laball/DefinitelyTyped,philippstucki/DefinitelyTyped,CSharpFan/DefinitelyTyped,vsavkin/DefinitelyTyped,mhegazy/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,brainded/DefinitelyTyped,dydek/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,deeleman/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,donnut/DefinitelyTyped,musakarakas/DefinitelyTyped,psnider/DefinitelyTyped,gregoryagu/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,behzad888/DefinitelyTyped,hatz48/DefinitelyTyped,eugenpodaru/DefinitelyTyped,drinchev/DefinitelyTyped,subash-a/DefinitelyTyped,OfficeDev/DefinitelyTyped,jraymakers/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,richardTowers/DefinitelyTyped,timramone/DefinitelyTyped,takfjt/DefinitelyTyped,wilfrem/DefinitelyTyped,applesaucers/lodash-invokeMap,jsaelhof/DefinitelyTyped,reppners/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,bencoveney/DefinitelyTyped,ErykB2000/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,elisee/DefinitelyTyped,olivierlemasle/DefinitelyTyped,Seikho/DefinitelyTyped,fredgalvao/DefinitelyTyped,mvarblow/DefinitelyTyped,benishouga/DefinitelyTyped,DeadAlready/DefinitelyTyped,almstrand/DefinitelyTyped,mcliment/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,gorcz/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,ducin/DefinitelyTyped,masonkmeyer/DefinitelyTyped,haskellcamargo/DefinitelyTyped,dmoonfire/DefinitelyTyped,grahammendick/DefinitelyTyped,drillbits/DefinitelyTyped,esperco/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,rschmukler/DefinitelyTyped,sledorze/DefinitelyTyped,teves-castro/DefinitelyTyped,jeremyhayes/DefinitelyTyped,mattanja/DefinitelyTyped,manekovskiy/DefinitelyTyped,pocesar/DefinitelyTyped,hellopao/DefinitelyTyped,mweststrate/DefinitelyTyped,Zorgatone/DefinitelyTyped,Ptival/DefinitelyTyped,chrismbarr/DefinitelyTyped,mcrawshaw/DefinitelyTyped,newclear/DefinitelyTyped,leoromanovsky/DefinitelyTyped,bpowers/DefinitelyTyped,shahata/DefinitelyTyped,lucyhe/DefinitelyTyped,benliddicott/DefinitelyTyped,tan9/DefinitelyTyped,glenndierckx/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,cvrajeesh/DefinitelyTyped,sclausen/DefinitelyTyped,shovon/DefinitelyTyped,spearhead-ea/DefinitelyTyped,uestcNaldo/DefinitelyTyped,Zenorbi/DefinitelyTyped,abner/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,florentpoujol/DefinitelyTyped,samwgoldman/DefinitelyTyped,giggio/DefinitelyTyped,aciccarello/DefinitelyTyped,benishouga/DefinitelyTyped,pafflique/DefinitelyTyped,syuilo/DefinitelyTyped,nmalaguti/DefinitelyTyped,laco0416/DefinitelyTyped,progre/DefinitelyTyped,Dashlane/DefinitelyTyped,kalloc/DefinitelyTyped,Karabur/DefinitelyTyped,munxar/DefinitelyTyped,axelcostaspena/DefinitelyTyped,subash-a/DefinitelyTyped,DenEwout/DefinitelyTyped,Pro/DefinitelyTyped,ajtowf/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,bruennijs/DefinitelyTyped,fearthecowboy/DefinitelyTyped,gandjustas/DefinitelyTyped,pocke/DefinitelyTyped,tjoskar/DefinitelyTyped,arcticwaters/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,ashwinr/DefinitelyTyped,forumone/DefinitelyTyped,egeland/DefinitelyTyped,arma-gast/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,dsebastien/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,georgemarshall/DefinitelyTyped,mshmelev/DefinitelyTyped,dumbmatter/DefinitelyTyped,evandrewry/DefinitelyTyped,benishouga/DefinitelyTyped,opichals/DefinitelyTyped,chrootsu/DefinitelyTyped,alvarorahul/DefinitelyTyped,bjfletcher/DefinitelyTyped,jimthedev/DefinitelyTyped,abbasmhd/DefinitelyTyped,donnut/DefinitelyTyped,Riron/DefinitelyTyped,nabeix/DefinitelyTyped,gdi2290/DefinitelyTyped,dsebastien/DefinitelyTyped,tinganho/DefinitelyTyped,minodisk/DefinitelyTyped,vpineda1996/DefinitelyTyped,M-Zuber/DefinitelyTyped,LordJZ/DefinitelyTyped,Dominator008/DefinitelyTyped,YousefED/DefinitelyTyped,Deathspike/DefinitelyTyped,icereed/DefinitelyTyped,florentpoujol/DefinitelyTyped,abner/DefinitelyTyped,use-strict/DefinitelyTyped,olemp/DefinitelyTyped,igorsechyn/DefinitelyTyped,jeffbcross/DefinitelyTyped,optical/DefinitelyTyped,smrq/DefinitelyTyped,johan-gorter/DefinitelyTyped,kuon/DefinitelyTyped,greglo/DefinitelyTyped,Zzzen/DefinitelyTyped,hypno2000/typings,nainslie/DefinitelyTyped,furny/DefinitelyTyped,jtlan/DefinitelyTyped,stanislavHamara/DefinitelyTyped,raijinsetsu/DefinitelyTyped,lseguin42/DefinitelyTyped,JaminFarr/DefinitelyTyped,eekboom/DefinitelyTyped,bluong/DefinitelyTyped,Garciat/DefinitelyTyped,alexdresko/DefinitelyTyped,Syati/DefinitelyTyped,georgemarshall/DefinitelyTyped,abmohan/DefinitelyTyped,dflor003/DefinitelyTyped,trystanclarke/DefinitelyTyped,Penryn/DefinitelyTyped,zhiyiting/DefinitelyTyped,sixinli/DefinitelyTyped,jasonswearingen/DefinitelyTyped,gyohk/DefinitelyTyped,dariajung/DefinitelyTyped,nobuoka/DefinitelyTyped,syuilo/DefinitelyTyped,vagarenko/DefinitelyTyped,pwelter34/DefinitelyTyped,hellopao/DefinitelyTyped,mhegazy/DefinitelyTyped,zensh/DefinitelyTyped,hor-crux/DefinitelyTyped,mrk21/DefinitelyTyped,emanuelhp/DefinitelyTyped,stacktracejs/DefinitelyTyped,AgentME/DefinitelyTyped,brettle/DefinitelyTyped,jimthedev/DefinitelyTyped,aroder/DefinitelyTyped,wkrueger/DefinitelyTyped,MugeSo/DefinitelyTyped,YousefED/DefinitelyTyped,gandjustas/DefinitelyTyped,danfma/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,jaysoo/DefinitelyTyped,mwain/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,rschmukler/DefinitelyTyped,alextkachman/DefinitelyTyped,bennett000/DefinitelyTyped,martinduparc/DefinitelyTyped,tscho/DefinitelyTyped,markogresak/DefinitelyTyped,rockclimber90/DefinitelyTyped,teves-castro/DefinitelyTyped,UzEE/DefinitelyTyped,xStrom/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,tboyce/DefinitelyTyped,abbasmhd/DefinitelyTyped,amir-arad/DefinitelyTyped,duongphuhiep/DefinitelyTyped,blink1073/DefinitelyTyped,unknownloner/DefinitelyTyped,lbguilherme/DefinitelyTyped,jpevarnek/DefinitelyTyped,vasek17/DefinitelyTyped,tdmckinn/DefinitelyTyped,rushi216/DefinitelyTyped,felipe3dfx/DefinitelyTyped,newclear/DefinitelyTyped,bennett000/DefinitelyTyped,musicist288/DefinitelyTyped,takenet/DefinitelyTyped,subjectix/DefinitelyTyped,Dominator008/DefinitelyTyped,takenet/DefinitelyTyped,gcastre/DefinitelyTyped,mendix/DefinitelyTyped,glenndierckx/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,Trapulo/DefinitelyTyped,RX14/DefinitelyTyped,billccn/DefinitelyTyped,yuit/DefinitelyTyped,chrilith/DefinitelyTyped,UzEE/DefinitelyTyped,jesseschalken/DefinitelyTyped,tomtheisen/DefinitelyTyped,danfma/DefinitelyTyped,Nemo157/DefinitelyTyped,vagarenko/DefinitelyTyped,mrozhin/DefinitelyTyped,Syati/DefinitelyTyped,shlomiassaf/DefinitelyTyped,chrootsu/DefinitelyTyped,aciccarello/DefinitelyTyped,nojaf/DefinitelyTyped,alexdresko/DefinitelyTyped,nodeframe/DefinitelyTyped,basp/DefinitelyTyped,jasonswearingen/DefinitelyTyped,arusakov/DefinitelyTyped,davidsidlinger/DefinitelyTyped,rolandzwaga/DefinitelyTyped,xica/DefinitelyTyped,chocolatechipui/DefinitelyTyped,nycdotnet/DefinitelyTyped,maxlang/DefinitelyTyped,magny/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,optical/DefinitelyTyped,syntax42/DefinitelyTyped,nakakura/DefinitelyTyped,Almouro/DefinitelyTyped,bkristensen/DefinitelyTyped,scriby/DefinitelyTyped,gyohk/DefinitelyTyped,frogcjn/DefinitelyTyped,Minishlink/DefinitelyTyped,mattblang/DefinitelyTyped,amanmahajan7/DefinitelyTyped,ajtowf/DefinitelyTyped,alextkachman/DefinitelyTyped,wilfrem/DefinitelyTyped,RX14/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,tomtarrot/DefinitelyTyped,brentonhouse/DefinitelyTyped,pocesar/DefinitelyTyped,use-strict/DefinitelyTyped,stephenjelfs/DefinitelyTyped,robertbaker/DefinitelyTyped,Kuniwak/DefinitelyTyped,micurs/DefinitelyTyped,igorraush/DefinitelyTyped,tigerxy/DefinitelyTyped,flyfishMT/DefinitelyTyped,wcomartin/DefinitelyTyped,PascalSenn/DefinitelyTyped,musically-ut/DefinitelyTyped,xStrom/DefinitelyTyped,algorithme/DefinitelyTyped,psnider/DefinitelyTyped,davidpricedev/DefinitelyTyped,timjk/DefinitelyTyped,georgemarshall/DefinitelyTyped,philippstucki/DefinitelyTyped,nainslie/DefinitelyTyped,arusakov/DefinitelyTyped,Karabur/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,sledorze/DefinitelyTyped,Seltzer/DefinitelyTyped,chrismbarr/DefinitelyTyped,nseckinoral/DefinitelyTyped,arma-gast/DefinitelyTyped,stacktracejs/DefinitelyTyped,Litee/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,Ptival/DefinitelyTyped,jimthedev/DefinitelyTyped,stylelab-io/DefinitelyTyped,theyelllowdart/DefinitelyTyped,alvarorahul/DefinitelyTyped,kanreisa/DefinitelyTyped,biomassives/DefinitelyTyped,reppners/DefinitelyTyped,ashwinr/DefinitelyTyped,erosb/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,omidkrad/DefinitelyTyped,mjjames/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,damianog/DefinitelyTyped,teddyward/DefinitelyTyped,zuohaocheng/DefinitelyTyped,greglo/DefinitelyTyped,MarlonFan/DefinitelyTyped,maglar0/DefinitelyTyped,nmalaguti/DefinitelyTyped,martinduparc/DefinitelyTyped,Saneyan/DefinitelyTyped,bilou84/DefinitelyTyped,johan-gorter/DefinitelyTyped,Dashlane/DefinitelyTyped,Zorgatone/DefinitelyTyped,Pipe-shen/DefinitelyTyped,scriby/DefinitelyTyped,wbuchwalter/DefinitelyTyped,gcastre/DefinitelyTyped,aciccarello/DefinitelyTyped,pocesar/DefinitelyTyped,nelsonmorais/DefinitelyTyped,zuzusik/DefinitelyTyped,hesselink/DefinitelyTyped,borisyankov/DefinitelyTyped,ml-workshare/DefinitelyTyped,hellopao/DefinitelyTyped,IAPark/DefinitelyTyped,vincentw56/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,dwango-js/DefinitelyTyped,rerezz/DefinitelyTyped,zuzusik/DefinitelyTyped,nycdotnet/DefinitelyTyped,jraymakers/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,TheBay0r/DefinitelyTyped,schmuli/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,applesaucers/lodash-invokeMap,gedaiu/DefinitelyTyped,Pro/DefinitelyTyped,Fraegle/DefinitelyTyped,DustinWehr/DefinitelyTyped,aqua89/DefinitelyTyped,davidpricedev/DefinitelyTyped,trystanclarke/DefinitelyTyped,Shiak1/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,EnableSoftware/DefinitelyTyped,mshmelev/DefinitelyTyped,xswordsx/DefinitelyTyped,yuit/DefinitelyTyped,rfranco/DefinitelyTyped,pwelter34/DefinitelyTyped,martinduparc/DefinitelyTyped,dragouf/DefinitelyTyped,angelobelchior8/DefinitelyTyped,frogcjn/DefinitelyTyped,olemp/DefinitelyTyped,scatcher/DefinitelyTyped,GodsBreath/DefinitelyTyped,Zzzen/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,fnipo/DefinitelyTyped,greglockwood/DefinitelyTyped,schmuli/DefinitelyTyped,isman-usoh/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,Ridermansb/DefinitelyTyped,damianog/DefinitelyTyped,Gmulti/DefinitelyTyped,dydek/DefinitelyTyped,QuatroCode/DefinitelyTyped,progre/DefinitelyTyped,Carreau/DefinitelyTyped,mareek/DefinitelyTyped,ayanoin/DefinitelyTyped,Penryn/DefinitelyTyped,hafenr/DefinitelyTyped,nitintutlani/DefinitelyTyped,WritingPanda/DefinitelyTyped,tarruda/DefinitelyTyped,onecentlin/DefinitelyTyped,jsaelhof/DefinitelyTyped,Bobjoy/DefinitelyTyped,mcrawshaw/DefinitelyTyped,stephenjelfs/DefinitelyTyped,aldo-roman/DefinitelyTyped,gildorwang/DefinitelyTyped,dreampulse/DefinitelyTyped,Litee/DefinitelyTyped,fredgalvao/DefinitelyTyped,mszczepaniak/DefinitelyTyped,quantumman/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,kabogo/DefinitelyTyped,superduper/DefinitelyTyped,Chris380/DefinitelyTyped,lbesson/DefinitelyTyped,paulmorphy/DefinitelyTyped,daptiv/DefinitelyTyped,jiaz/DefinitelyTyped,arcticwaters/DefinitelyTyped,moonpyk/DefinitelyTyped,lekaha/DefinitelyTyped,PopSugar/DefinitelyTyped,DeluxZ/DefinitelyTyped,nitintutlani/DefinitelyTyped,onecentlin/DefinitelyTyped,smrq/DefinitelyTyped,shlomiassaf/DefinitelyTyped,zalamtech/DefinitelyTyped,Lorisu/DefinitelyTyped,OpenMaths/DefinitelyTyped,herrmanno/DefinitelyTyped,tan9/DefinitelyTyped,AgentME/DefinitelyTyped,bardt/DefinitelyTyped,corps/DefinitelyTyped,drinchev/DefinitelyTyped,borisyankov/DefinitelyTyped,digitalpixies/DefinitelyTyped,pkhayundi/DefinitelyTyped,RedSeal-co/DefinitelyTyped,hiraash/DefinitelyTyped,MidnightDesign/DefinitelyTyped,GregOnNet/DefinitelyTyped,flyfishMT/DefinitelyTyped,schmuli/DefinitelyTyped,jbrantly/DefinitelyTyped,amanmahajan7/DefinitelyTyped,hx0day/DefinitelyTyped,nakakura/DefinitelyTyped,isman-usoh/DefinitelyTyped,Mek7/DefinitelyTyped,EnableSoftware/DefinitelyTyped,OpenMaths/DefinitelyTyped,MugeSo/DefinitelyTyped,behzad888/DefinitelyTyped,mareek/DefinitelyTyped,scsouthw/DefinitelyTyped,AgentME/DefinitelyTyped,nobuoka/DefinitelyTyped,robert-voica/DefinitelyTyped,sandersky/DefinitelyTyped,alainsahli/DefinitelyTyped,HereSinceres/DefinitelyTyped,HPFOD/DefinitelyTyped,Jwsonic/DefinitelyTyped,duncanmak/DefinitelyTyped,ryan10132/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,magny/DefinitelyTyped,arusakov/DefinitelyTyped,georgemarshall/DefinitelyTyped,zuzusik/DefinitelyTyped
--- +++ @@ -14,11 +14,11 @@ classes?: {[className: string]: boolean}; classPrefix?: string; constraints?: ITetherConstraint[]; - element?: Element | string | any /* JQuery */; + element?: HTMLElement | string | any /* JQuery */; enabled?: boolean; offset?: string; optimizations?: any; - target?: Element | string | any /* JQuery */; + target?: HTMLElement | string | any /* JQuery */; targetAttachment?: string; targetOffset?: string; targetModifier?: string; @@ -29,7 +29,7 @@ outOfBoundsClass?: string; pin?: boolean | string[]; pinnedClass?: string; - to?: string | Element | number[]; + to?: string | HTMLElement | number[]; } interface Tether {
a0c2221847d97b3ed3e8ed604c319acff5b83c47
packages/components/components/sidebar/SidebarListItemHeaderLink.tsx
packages/components/components/sidebar/SidebarListItemHeaderLink.tsx
import React from 'react'; import Icon from '../icon/Icon'; import AppLink, { Props as LinkProps } from '../link/AppLink'; interface Props extends LinkProps { icon: string; info: string; } export const SidebarListItemHeaderLinkButton = ({ info, icon, ...rest }: Props) => { return ( <AppLink className="navigation-link-header-group-link flex-item-noshrink" type="button" {...rest}> <Icon name={icon} className="navigation-icon" /> <span className="sr-only">{info}</span> </AppLink> ); }; export default SidebarListItemHeaderLinkButton;
import React from 'react'; import Icon from '../icon/Icon'; import AppLink, { Props as LinkProps } from '../link/AppLink'; interface Props extends LinkProps { icon: string; info: string; } export const SidebarListItemHeaderLinkButton = ({ info, icon, ...rest }: Props) => { return ( <AppLink className="flex navigation-link-header-group-link flex-item-noshrink" type="button" {...rest}> <Icon name={icon} className="navigation-icon" /> <span className="sr-only">{info}</span> </AppLink> ); }; export default SidebarListItemHeaderLinkButton;
Add flex to align items
Add flex to align items
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -8,7 +8,7 @@ } export const SidebarListItemHeaderLinkButton = ({ info, icon, ...rest }: Props) => { return ( - <AppLink className="navigation-link-header-group-link flex-item-noshrink" type="button" {...rest}> + <AppLink className="flex navigation-link-header-group-link flex-item-noshrink" type="button" {...rest}> <Icon name={icon} className="navigation-icon" /> <span className="sr-only">{info}</span> </AppLink>
b976adc747d62253e923ba1c658222425954468a
tests/dummy/app/helpers/typed-help.ts
tests/dummy/app/helpers/typed-help.ts
import { helper } from '@ember/component/helper'; export function typedHelp(/*params, hash*/) { return 'my type of help'; } export default helper(typedHelp);
import Ember from 'ember'; import { helper } from '@ember/component/helper'; export function typedHelp(/*params, hash*/) { return 'my type of help'; } export default helper(typedHelp);
Make the declaration emitter happy with our Helper usage
Make the declaration emitter happy with our Helper usage
TypeScript
mit
emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript
--- +++ @@ -1,3 +1,4 @@ +import Ember from 'ember'; import { helper } from '@ember/component/helper'; export function typedHelp(/*params, hash*/) {
0d9bf3ccc55f4d643f8aed95065bb435ca91fa0c
frontend/sequences/step_tiles/__tests__/tile_toggle_pin_test.tsx
frontend/sequences/step_tiles/__tests__/tile_toggle_pin_test.tsx
import * as React from "react"; import { TileTogglePin } from "../tile_toggle_pin"; import { mount } from "enzyme"; import { fakeSequence } from "../../../__test_support__/fake_state/resources"; import { TogglePin } from "farmbot"; import { emptyState } from "../../../resources/reducer"; import { StepParams } from "../../interfaces"; describe("<TileTogglePin/>", () => { const currentStep: TogglePin = { kind: "toggle_pin", args: { pin_number: 13 } }; const fakeProps = (): StepParams => ({ currentSequence: fakeSequence(), currentStep: currentStep, dispatch: jest.fn(), index: 0, resources: emptyState().index, confirmStepDeletion: false, }); it("renders inputs", () => { const block = mount(<TileTogglePin {...fakeProps()} />); const inputs = block.find("input"); const labels = block.find("label"); expect(inputs.length).toEqual(2); expect(labels.length).toEqual(1); expect(inputs.first().props().placeholder).toEqual("Toggle Pin"); expect(labels.at(0).text()).toContain("Pin"); expect(inputs.at(1).props().value).toEqual(13); }); });
import * as React from "react"; import { TileTogglePin } from "../tile_toggle_pin"; import { mount } from "enzyme"; import { fakeSequence } from "../../../__test_support__/fake_state/resources"; import { TogglePin } from "farmbot"; import { emptyState } from "../../../resources/reducer"; import { StepParams } from "../../interfaces"; describe("<TileTogglePin/>", () => { const currentStep: TogglePin = { kind: "toggle_pin", args: { pin_number: 13 } }; const fakeProps = (): StepParams => ({ currentSequence: fakeSequence(), currentStep: currentStep, dispatch: jest.fn(), index: 0, resources: emptyState().index, confirmStepDeletion: false, }); it("renders inputs", () => { const block = mount(<TileTogglePin {...fakeProps()} />); const inputs = block.find("input"); const labels = block.find("label"); expect(inputs.length).toEqual(1); expect(labels.length).toEqual(1); expect(inputs.first().props().placeholder).toEqual("Toggle Pin"); expect(labels.at(0).text()).toContain("Peripheral"); }); });
Fix test breakage due to refactoring
Fix test breakage due to refactoring
TypeScript
mit
gabrielburnworth/Farmbot-Web-App,gabrielburnworth/Farmbot-Web-App,gabrielburnworth/Farmbot-Web-App,gabrielburnworth/Farmbot-Web-App,FarmBot/farmbot-web-app,FarmBot/Farmbot-Web-API,FarmBot/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,FarmBot/farmbot-web-app
--- +++ @@ -27,10 +27,9 @@ const block = mount(<TileTogglePin {...fakeProps()} />); const inputs = block.find("input"); const labels = block.find("label"); - expect(inputs.length).toEqual(2); + expect(inputs.length).toEqual(1); expect(labels.length).toEqual(1); expect(inputs.first().props().placeholder).toEqual("Toggle Pin"); - expect(labels.at(0).text()).toContain("Pin"); - expect(inputs.at(1).props().value).toEqual(13); + expect(labels.at(0).text()).toContain("Peripheral"); }); });
271dd88a09b65c7947a64d6f575847aedd0b5529
modules/katamari/src/test/ts/atomic/api/option/OptionGetOrTest.ts
modules/katamari/src/test/ts/atomic/api/option/OptionGetOrTest.ts
import { Option } from 'ephox/katamari/api/Option'; import * as Fun from 'ephox/katamari/api/Fun'; import { Assert, UnitTest } from '@ephox/bedrock-client'; import fc from 'fast-check'; UnitTest.test('Option.getOr', () => { fc.assert(fc.property(fc.anything(), (x) => { Assert.eq('none', x, Option.none().getOr(x)); Assert.eq('none', x, Option.none().getOrThunk(() => x)); })); fc.assert(fc.property(fc.anything(), fc.anything(), (x, y) => { Assert.eq('some', x, Option.some(x).getOr(y)); Assert.eq('some', x, Option.some(x).getOrThunk(Fun.die('boom'))); })); });
import { Option } from 'ephox/katamari/api/Option'; import * as Fun from 'ephox/katamari/api/Fun'; import { Assert, UnitTest } from '@ephox/bedrock-client'; import fc from 'fast-check'; UnitTest.test('Option.getOr', () => { fc.assert(fc.property(fc.integer(), (x) => { Assert.eq('none', x, Option.none().getOr(x)); Assert.eq('none', x, Option.none().getOrThunk(() => x)); })); fc.assert(fc.property(fc.integer(), fc.integer(), (x, y) => { Assert.eq('some', x, Option.some(x).getOr(y)); Assert.eq('some', x, Option.some(x).getOrThunk(Fun.die('boom'))); })); });
Test failed on NaN, so just use an integer.
Test failed on NaN, so just use an integer.
TypeScript
lgpl-2.1
FernCreek/tinymce,TeamupCom/tinymce,FernCreek/tinymce,tinymce/tinymce,TeamupCom/tinymce,tinymce/tinymce,FernCreek/tinymce,tinymce/tinymce
--- +++ @@ -4,11 +4,11 @@ import fc from 'fast-check'; UnitTest.test('Option.getOr', () => { - fc.assert(fc.property(fc.anything(), (x) => { + fc.assert(fc.property(fc.integer(), (x) => { Assert.eq('none', x, Option.none().getOr(x)); Assert.eq('none', x, Option.none().getOrThunk(() => x)); })); - fc.assert(fc.property(fc.anything(), fc.anything(), (x, y) => { + fc.assert(fc.property(fc.integer(), fc.integer(), (x, y) => { Assert.eq('some', x, Option.some(x).getOr(y)); Assert.eq('some', x, Option.some(x).getOrThunk(Fun.die('boom'))); }));
36d1df8c383002cdc75b66808e1b135607bd4883
cli.ts
cli.ts
#!/usr/bin/env node /** * Entry point for CLI. * Validate args and kick off electron process so user doesn't have to invoke * electron directly. */ import * as Child from "child_process"; import * as Path from "path"; import * as Yargs from "yargs"; import * as Args from "./arg-parsing"; // Parse cli args before requiring running electron. const argv: Yargs.Arguments = Args.parse(); Child.exec(`electron ${Path.join(__dirname, "cli-electron.js")} ` + process.argv.slice(2), (err: Error, stdout: string, errout: string) => { console.log("Error:", errout); });
#!/usr/bin/env node /** * Entry point for CLI. * Validate args and kick off electron process so user doesn't have to invoke * electron directly. */ import * as Child from "child_process"; import * as Path from "path"; import * as Yargs from "yargs"; import * as Args from "./arg-parsing"; // Parse cli args before requiring running electron. const argv: Yargs.Arguments = Args.parse(); Child.exec(`./node_modules/.bin/electron ${Path.join(__dirname, "cli-electron.js")} ` + process.argv.slice(2), (err: Error, stdout: string, errout: string) => { console.log("Error:", errout); });
Use local version of electron
Use local version of electron
TypeScript
mit
trodi/peer-review-cli,trodi/peer-review-cli
--- +++ @@ -14,7 +14,7 @@ // Parse cli args before requiring running electron. const argv: Yargs.Arguments = Args.parse(); -Child.exec(`electron ${Path.join(__dirname, "cli-electron.js")} ` + process.argv.slice(2), +Child.exec(`./node_modules/.bin/electron ${Path.join(__dirname, "cli-electron.js")} ` + process.argv.slice(2), (err: Error, stdout: string, errout: string) => { console.log("Error:", errout); });
b06f2510c00d064f5549fab9b735e36e3b4e2dbf
docs/docs/snippets/providers/getting-started-serverloader.ts
docs/docs/snippets/providers/getting-started-serverloader.ts
import {Configuration} from "@tsed/common"; import {CalendarsCtrl} from "./controllers/CalendarsCtrl"; import {CalendarsService} from "./services/CalendarsService"; @Configuration({ mount: { "/rest": [CalendarsCtrl] }, componentsScan: [ CalendarsService ] }) export class Server { }
import {Configuration} from "@tsed/common"; import {CalendarsCtrl} from "./controllers/CalendarsCtrl"; @Configuration({ mount: { "/rest": [CalendarsCtrl] } }) export class Server { }
Update example to import controller
docs: Update example to import controller
TypeScript
mit
Romakita/ts-express-decorators,Romakita/ts-express-decorators,Romakita/ts-express-decorators,Romakita/ts-express-decorators
--- +++ @@ -1,14 +1,10 @@ import {Configuration} from "@tsed/common"; import {CalendarsCtrl} from "./controllers/CalendarsCtrl"; -import {CalendarsService} from "./services/CalendarsService"; @Configuration({ mount: { "/rest": [CalendarsCtrl] - }, - componentsScan: [ - CalendarsService - ] + } }) export class Server { }
9636a6cacfbd6fc79ff8890878ba62fd1712e8f8
backend/common/src/entities/nominator.ts
backend/common/src/entities/nominator.ts
import { Affiliation, Household } from 'cmpd-common-api'; import { BaseEntity, Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryColumn } from 'typeorm'; @Entity('nominators') export class Nominator extends BaseEntity { private constructor(props) { super(); Object.assign(this, props); } @PrimaryColumn('text') id: string; @Column('text') name: string; @Column('text') email: string; @Column('text', { nullable: true }) rank: string; @Column('text', { nullable: true }) role: string; @Column('text', { nullable: true }) phone: string; @Column('boolean', { default: true }) disabled: boolean; @Column('boolean', { name: 'email_verified', default: false }) emailVerified: boolean; @Column('text') phoneNumber: string; @Column('int', { name: 'nomination_limit', default: 5 }) nominationLimit: number; @Column('int', { name: 'affiliation_id', nullable: true }) affiliationId: number; @OneToOne(() => Affiliation) @JoinColumn({ name: 'affiliation_id' }) affiliation: Affiliation; @OneToMany(() => Household, household => household.nominator) households: Household[]; static fromJSON(props) { const entity = new Nominator(props); return entity; } }
import { Affiliation, Household } from 'cmpd-common-api'; import { BaseEntity, Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryColumn } from 'typeorm'; @Entity('nominators') export class Nominator extends BaseEntity { private constructor(props) { super(); Object.assign(this, props); } @PrimaryColumn('text') id: string; @Column('text') name: string; @Column('text') email: string; @Column('text', { nullable: true }) rank: string; // @Column('text', { nullable: true }) // role: string; @Column('text', { nullable: true }) phone: string; @Column('boolean', { default: true }) disabled: boolean; @Column('boolean', { name: 'email_verified', default: false }) emailVerified: boolean; @Column('text') phoneNumber: string; @Column('int', { name: 'nomination_limit', default: 5 }) nominationLimit: number; @Column('int', { name: 'affiliation_id', nullable: true }) affiliationId: number; @OneToOne(() => Affiliation) @JoinColumn({ name: 'affiliation_id' }) affiliation: Affiliation; @OneToMany(() => Household, household => household.nominator) households: Household[]; static fromJSON(props) { const entity = new Nominator(props); return entity; } }
Remove roles from our entity model
Remove roles from our entity model
TypeScript
mit
CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift
--- +++ @@ -17,8 +17,8 @@ @Column('text', { nullable: true }) rank: string; - @Column('text', { nullable: true }) - role: string; + // @Column('text', { nullable: true }) + // role: string; @Column('text', { nullable: true }) phone: string;
6f20ef281fa9384ac93f94ca23f6cc79dda290a0
app/src/ui/toolbar/revert-progress.tsx
app/src/ui/toolbar/revert-progress.tsx
import * as React from 'react' import { ToolbarButton, ToolbarButtonStyle } from './button' import { OcticonSymbol } from '../octicons' import { IRevertProgress } from '../../lib/app-state' interface IRevertProgressProps { /** Progress information associated with the current operation */ readonly progress: IRevertProgress } /** Display revert progress in the toolbar. */ export class RevertProgress extends React.Component<IRevertProgressProps, {}> { public render() { const progress = this.props.progress const description = progress.description || 'Hang on…' return ( <ToolbarButton title="Reverting…" description={description} progressValue={progress.value} className="revert-progress" icon={OcticonSymbol.sync} iconClassName="spin" style={ToolbarButtonStyle.Subtitle} disabled={true} /> ) } }
import * as React from 'react' import { ToolbarButton, ToolbarButtonStyle } from './button' import { OcticonSymbol } from '../octicons' import { IRevertProgress } from '../../lib/app-state' interface IRevertProgressProps { /** Progress information associated with the current operation */ readonly progress: IRevertProgress } /** Display revert progress in the toolbar. */ export class RevertProgress extends React.Component<IRevertProgressProps, {}> { public render() { const progress = this.props.progress const title = progress.title || 'Hang on…' return ( <ToolbarButton title="Reverting…" description={title} progressValue={progress.value} className="revert-progress" icon={OcticonSymbol.sync} iconClassName="spin" style={ToolbarButtonStyle.Subtitle} disabled={true} /> ) } }
Use the title, not the description
Use the title, not the description
TypeScript
mit
shiftkey/desktop,artivilla/desktop,kactus-io/kactus,desktop/desktop,kactus-io/kactus,say25/desktop,say25/desktop,say25/desktop,desktop/desktop,shiftkey/desktop,j-f1/forked-desktop,shiftkey/desktop,shiftkey/desktop,kactus-io/kactus,j-f1/forked-desktop,j-f1/forked-desktop,artivilla/desktop,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,desktop/desktop,artivilla/desktop,say25/desktop,desktop/desktop
--- +++ @@ -12,11 +12,11 @@ export class RevertProgress extends React.Component<IRevertProgressProps, {}> { public render() { const progress = this.props.progress - const description = progress.description || 'Hang on…' + const title = progress.title || 'Hang on…' return ( <ToolbarButton title="Reverting…" - description={description} + description={title} progressValue={progress.value} className="revert-progress" icon={OcticonSymbol.sync}
0fb3786c132dffed970fa087f2958eca127caf84
packages/lesswrong/server/migrations/2020-09-19-afVoteMigration.ts
packages/lesswrong/server/migrations/2020-09-19-afVoteMigration.ts
import { registerMigration } from './migrationUtils'; import { Votes } from '../../lib/collections/votes'; import { Posts } from '../../lib/collections/posts'; import { Comments } from '../../lib/collections/comments'; registerMigration({ name: "afVoteMigration", dateWritten: "2020-09-19", idempotent: true, action: async () => { const afPosts = await Posts.find({af: true}, {}, { _id: 1}).fetch() const afComments = await Comments.find({af: true}, {}, {_id: 1}).fetch() console.log("Fetched all the votes and comments") const afDocs = [...afPosts, ...afComments] await Votes.rawCollection().bulkWrite(afDocs.map(({_id}) => ({ updateMany: { filter: { documentId: _id }, update: { $set: { documentIsAf: true } } } })), { ordered: false }); } });
import { fillDefaultValues, registerMigration } from './migrationUtils'; import { Votes } from '../../lib/collections/votes'; import { Posts } from '../../lib/collections/posts'; import { Comments } from '../../lib/collections/comments'; registerMigration({ name: "afVoteMigration", dateWritten: "2020-09-19", idempotent: true, action: async () => { await fillDefaultValues({ collection: Votes, fieldName: "documentIsAf", }); const afPosts = await Posts.find({af: true}, {}, { _id: 1}).fetch() const afComments = await Comments.find({af: true}, {}, {_id: 1}).fetch() console.log("Fetched all the votes and comments") const afDocs = [...afPosts, ...afComments] await Votes.rawCollection().bulkWrite(afDocs.map(({_id}) => ({ updateMany: { filter: { documentId: _id }, update: { $set: { documentIsAf: true } } } })), { ordered: false }); } });
Add a default value fill
Add a default value fill
TypeScript
mit
Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Lesswrong2
--- +++ @@ -1,5 +1,5 @@ -import { registerMigration } from './migrationUtils'; +import { fillDefaultValues, registerMigration } from './migrationUtils'; import { Votes } from '../../lib/collections/votes'; import { Posts } from '../../lib/collections/posts'; import { Comments } from '../../lib/collections/comments'; @@ -9,6 +9,11 @@ dateWritten: "2020-09-19", idempotent: true, action: async () => { + await fillDefaultValues({ + collection: Votes, + fieldName: "documentIsAf", + }); + const afPosts = await Posts.find({af: true}, {}, { _id: 1}).fetch() const afComments = await Comments.find({af: true}, {}, {_id: 1}).fetch()
cad9294821828288ee00721c3e371be58e633b9e
src/parser/warrior/protection/modules/features/AlwaysBeCasting.tsx
src/parser/warrior/protection/modules/features/AlwaysBeCasting.tsx
import React from 'react'; import { formatPercentage } from 'common/format'; import CoreAlwaysBeCasting from 'parser/shared/modules/AlwaysBeCasting'; import { When } from 'parser/core/ParseResults'; class AlwaysBeCasting extends CoreAlwaysBeCasting { suggestions(when: When) { const deadTimePercentage = this.totalTimeWasted / this.owner.fightDuration; when(deadTimePercentage).isGreaterThan(0.2) .addSuggestion((suggest, actual: number, recommended: number) => { return suggest(<span> Your downtime can be improved. Try to Always Be Casting (ABC)..</span>) .icon('spell_mage_altertime') .actual(`${formatPercentage(actual)}% downtime`) .recommended(`${Math.round(Number(formatPercentage(recommended)))}% is recommended`) .regular(recommended + 0.05).major(recommended + 0.15); }); } } export default AlwaysBeCasting;
import React from 'react'; import { formatPercentage } from 'common/format'; import CoreAlwaysBeCasting from 'parser/shared/modules/AlwaysBeCasting'; import { When } from 'parser/core/ParseResults'; class AlwaysBeCasting extends CoreAlwaysBeCasting { suggestions(when: When) { const deadTimePercentage = this.totalTimeWasted / this.owner.fightDuration; when(deadTimePercentage).isGreaterThan(0.2) .addSuggestion((suggest, actual, recommended) => { return suggest(<span> Your downtime can be improved. Try to Always Be Casting (ABC)..</span>) .icon('spell_mage_altertime') .actual(`${formatPercentage(actual)}% downtime`) .recommended(`${Math.round(Number(formatPercentage(recommended)))}% is recommended`) .regular(recommended + 0.05).major(recommended + 0.15); }); } } export default AlwaysBeCasting;
Allow type inference for Prot ABC suggestion
Allow type inference for Prot ABC suggestion
TypeScript
agpl-3.0
sMteX/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer,yajinni/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,Juko8/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer
--- +++ @@ -8,7 +8,7 @@ const deadTimePercentage = this.totalTimeWasted / this.owner.fightDuration; when(deadTimePercentage).isGreaterThan(0.2) - .addSuggestion((suggest, actual: number, recommended: number) => { + .addSuggestion((suggest, actual, recommended) => { return suggest(<span> Your downtime can be improved. Try to Always Be Casting (ABC)..</span>) .icon('spell_mage_altertime') .actual(`${formatPercentage(actual)}% downtime`)
4cbec0b06ad7f1f2e02eeab16b3e6b7c972b4316
src/lib/utils.ts
src/lib/utils.ts
export type Pair<K, V> = { Key: K, Value: V }; export function captureStack() { try { throw new Error(); } catch (e) { return e.stack; } }
export type Pair<K, V> = { Key: K, Value: V }; export function captureStack(): string { try { throw new Error(); } catch (e) { return e.stack; } } export function detectTestRunner() { let stack = captureStack(); return stack.split('\n').find(x => !!x.match(/[\\\/](enzyme|mocha)[\\\/]/i)) !== null; }
Check to see if we're in a test runner via dodgy af means
Check to see if we're in a test runner via dodgy af means
TypeScript
bsd-3-clause
paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline,paulcbetts/trickline
--- +++ @@ -1,5 +1,10 @@ export type Pair<K, V> = { Key: K, Value: V }; -export function captureStack() { +export function captureStack(): string { try { throw new Error(); } catch (e) { return e.stack; } } + +export function detectTestRunner() { + let stack = captureStack(); + return stack.split('\n').find(x => !!x.match(/[\\\/](enzyme|mocha)[\\\/]/i)) !== null; +}
f3b59f939524708155930f17ba619185eb9bbb83
src/functions/poll.ts
src/functions/poll.ts
import * as rq from 'request-promise-native' const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) export default function poll (bot) { return bot.api('messages.getLongPollServer') .then(res => { return request(`https://${res.server}?act=a_check&key=${res.key}` + `&wait=25&mode=2&version=1&ts=${res.ts}`) }) .catch(error => { bot.emit('poll-error', error) // перезапуск при ошибке return poll(bot) }) function request (url) { return rq(url, { json: true }) .then(res => { if (!res || !res.ts || res.failed) throw new Error("response of the Long Poll server isn't valid " + `(${JSON.stringify(res)})`) url = url.replace(/ts=.*/, `ts=${res.ts}`) // ставим новое время if (res.updates.length > 0) { for (let i = 0; i < res.updates.length; i++) { let update = res.updates[i] if (update[0] === 4) bot.emit('update', update) } } if (bot._stop) return null return sleep(300).then(() => request(url)) }) } }
import * as rq from 'request-promise-native' const DEFAULT_DELAY = 334 // 1/3 of a second const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) export default function poll (bot) { return bot.api('messages.getLongPollServer') .then(res => { return request(`https://${res.server}?act=a_check&key=${res.key}` + `&wait=25&mode=2&version=1&ts=${res.ts}`) }) .catch(error => { bot.emit('poll-error', error) // перезапуск при ошибке return poll(bot) }) function request (url) { return rq(url, { json: true }) .then(res => { if (!res || !res.ts || res.failed) throw new Error("response of the Long Poll server isn't valid " + `(${JSON.stringify(res)})`) url = url.replace(/ts=.*/, `ts=${res.ts}`) // ставим новое время if (res.updates.length > 0) { for (let i = 0; i < res.updates.length; i++) { let update = res.updates[i] if (update[0] === 4) bot.emit('update', update) } } if (bot._stop) return null return sleep(DEFAULT_DELAY).then(() => request(url)) }) } }
Increase a delay before a restart of the Long Poll client
Increase a delay before a restart of the Long Poll client
TypeScript
mit
vitalyavolyn/node-vk-bot,vitalyavolyn/node-vk-bot
--- +++ @@ -1,4 +1,6 @@ import * as rq from 'request-promise-native' + +const DEFAULT_DELAY = 334 // 1/3 of a second const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) @@ -31,7 +33,7 @@ } if (bot._stop) return null - return sleep(300).then(() => request(url)) + return sleep(DEFAULT_DELAY).then(() => request(url)) }) } }
23dedfcbd1b8aa94437078115604dabdd8efa563
lib/components/src/blocks/IFrame.tsx
lib/components/src/blocks/IFrame.tsx
import React, { Component } from 'react'; import window from 'global'; interface IFrameProps { id: string; key?: string; title: string; src: string; allowFullScreen: boolean; scale: number; style?: any; } interface BodyStyle { width: string; height: string; transform: string; transformOrigin: string; } export class IFrame extends Component<IFrameProps> { iframe: any = null; componentDidMount() { const { id } = this.props; this.iframe = window.document.getElementById(id); } shouldComponentUpdate(nextProps: IFrameProps) { const { scale } = nextProps; // eslint-disable-next-line react/destructuring-assignment if (scale !== this.props.scale) { this.setIframeBodyStyle({ width: `${scale * 100}%`, height: `${scale * 100}%`, transform: `scale(${1 / scale})`, transformOrigin: 'top left', }); } return false; } setIframeBodyStyle(style: BodyStyle) { return Object.assign(this.iframe.contentDocument.body.style, style); } render() { const { id, title, src, allowFullScreen, scale, ...rest } = this.props; return <iframe id={id} title={title} src={src} allowFullScreen={allowFullScreen} {...rest} loading="lazy"/>; } }
import React, { Component } from 'react'; import window from 'global'; interface IFrameProps { id: string; key?: string; title: string; src: string; allowFullScreen: boolean; scale: number; style?: any; } interface BodyStyle { width: string; height: string; transform: string; transformOrigin: string; } export class IFrame extends Component<IFrameProps> { iframe: any = null; componentDidMount() { const { id } = this.props; this.iframe = window.document.getElementById(id); } shouldComponentUpdate(nextProps: IFrameProps) { const { scale } = nextProps; // eslint-disable-next-line react/destructuring-assignment if (scale !== this.props.scale) { this.setIframeBodyStyle({ width: `${scale * 100}%`, height: `${scale * 100}%`, transform: `scale(${1 / scale})`, transformOrigin: 'top left', }); } return false; } setIframeBodyStyle(style: BodyStyle) { return Object.assign(this.iframe.contentDocument.body.style, style); } render() { const { id, title, src, allowFullScreen, scale, ...rest } = this.props; return ( <iframe id={id} title={title} src={src} allowFullScreen={allowFullScreen} // @ts-ignore loading="lazy" {...rest} /> ); } }
Fix typescript for lazy-loaded iframes
Fix typescript for lazy-loaded iframes
TypeScript
mit
storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook
--- +++ @@ -46,6 +46,16 @@ render() { const { id, title, src, allowFullScreen, scale, ...rest } = this.props; - return <iframe id={id} title={title} src={src} allowFullScreen={allowFullScreen} {...rest} loading="lazy"/>; + return ( + <iframe + id={id} + title={title} + src={src} + allowFullScreen={allowFullScreen} + // @ts-ignore + loading="lazy" + {...rest} + /> + ); } }
5cc9cb9da1ece1497309f151b2789d9f5c300afc
lib/crypto_worker_test.ts
lib/crypto_worker_test.ts
import Q = require('q'); import crypto_worker = require('./crypto_worker'); import env = require('./base/env'); import rpc = require('./net/rpc'); import testLib = require('./test'); if (env.isNodeJS()) { Worker = require('./node_worker').Worker; } testLib.addAsyncTest('worker test', (assert) => { let done = Q.defer<void>(); let scriptPath = crypto_worker.SCRIPT_PATH; let worker = new Worker(scriptPath); let rpcHandler = new rpc.RpcHandler(new rpc.WindowMessagePort(worker, '*', 'crypto-worker', 'passcards')); rpcHandler.call('pbkdf2Block', ['inputPass', 'inputSalt', 100 /* iterations */, 0 /* blockIndex */], (err: any, block: string) => { assert.equal(err, null); assert.equal(block.length, 20); worker.terminate(); done.resolve(null); }); return done.promise; });
import Q = require('q'); import crypto_worker = require('./crypto_worker'); import env = require('./base/env'); import rpc = require('./net/rpc'); import testLib = require('./test'); if (env.isNodeJS()) { global.Worker = require('./node_worker').Worker; } testLib.addAsyncTest('worker test', (assert) => { let done = Q.defer<void>(); let scriptPath = crypto_worker.SCRIPT_PATH; let worker = new Worker(scriptPath); let rpcHandler = new rpc.RpcHandler(new rpc.WindowMessagePort(worker, '*', 'crypto-worker', 'passcards')); rpcHandler.call('pbkdf2Block', ['inputPass', 'inputSalt', 100 /* iterations */, 0 /* blockIndex */], (err: any, block: string) => { assert.equal(err, null); assert.equal(block.length, 20); worker.terminate(); done.resolve(null); }); return done.promise; });
Fix crypto test under current versions of Node
Fix crypto test under current versions of Node TypeScript >= 1.8.x adds "use strict" at the top of modules, making the implicit assignment to global.Worker fail.
TypeScript
bsd-3-clause
robertknight/passcards,robertknight/passcards,robertknight/passcards,robertknight/passcards
--- +++ @@ -6,7 +6,7 @@ import testLib = require('./test'); if (env.isNodeJS()) { - Worker = require('./node_worker').Worker; + global.Worker = require('./node_worker').Worker; } testLib.addAsyncTest('worker test', (assert) => {
886e31a451ac5b8659289c3bea5b88a6950b4866
generators/client/templates/angular/src/main/webapp/app/admin/configuration/_configuration.service.ts
generators/client/templates/angular/src/main/webapp/app/admin/configuration/_configuration.service.ts
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; @Injectable() export class <%=jhiPrefixCapitalized%>ConfigurationService { constructor(private http: Http) { } get(): Observable<any> { return this.http.get('management/configprops').map((res: Response) => { let properties: any[] = []; const propertiesObject = res.json(); for (let key in propertiesObject) { properties.push(propertiesObject[key]); } return properties.sort((propertyA, propertyB) => { return (propertyA.prefix === propertyB.prefix) ? 0 : (propertyA.prefix < propertyB.prefix) ? -1 : 1; }); }); } getEnv(): Observable<any> { return this.http.get('management/env').map((res: Response) => { let properties: any = {}; const propertiesObject = res.json(); for (let key in propertiesObject) { let valsObject = propertiesObject[key]; let vals: any[] = []; for (let valKey in valsObject) { vals.push({key: valKey, val: valsObject[valKey]}); } properties[key] = vals; } return properties; }); } }
import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; import { Observable } from 'rxjs/Rx'; @Injectable() export class <%=jhiPrefixCapitalized%>ConfigurationService { constructor(private http: Http) { } get(): Observable<any> { return this.http.get('management/configprops').map((res: Response) => { let properties: any[] = []; const propertiesObject = res.json(); for (let key in propertiesObject) { if (propertiesObject.hasOwnProperty(key)) { properties.push(propertiesObject[key]); } } return properties.sort((propertyA, propertyB) => { return (propertyA.prefix === propertyB.prefix) ? 0 : (propertyA.prefix < propertyB.prefix) ? -1 : 1; }); }); } getEnv(): Observable<any> { return this.http.get('management/env').map((res: Response) => { let properties: any = {}; const propertiesObject = res.json(); for (let key in propertiesObject) { if (propertiesObject.hasOwnProperty(key)) { let valsObject = propertiesObject[key]; let vals: any[] = []; for (let valKey in valsObject) { if (valsObject.hasOwnProperty(valKey)) { vals.push({key: valKey, val: valsObject[valKey]}); } } properties[key] = vals; } } return properties; }); } }
Fix tslint error: for (... in ...) statements must be filtered with an if statement
Fix tslint error: for (... in ...) statements must be filtered with an if statement
TypeScript
apache-2.0
wmarques/generator-jhipster,PierreBesson/generator-jhipster,mraible/generator-jhipster,eosimosu/generator-jhipster,baskeboler/generator-jhipster,ruddell/generator-jhipster,JulienMrgrd/generator-jhipster,Tcharl/generator-jhipster,gmarziou/generator-jhipster,cbornet/generator-jhipster,liseri/generator-jhipster,nkolosnjaji/generator-jhipster,liseri/generator-jhipster,danielpetisme/generator-jhipster,dalbelap/generator-jhipster,vivekmore/generator-jhipster,lrkwz/generator-jhipster,mosoft521/generator-jhipster,gzsombor/generator-jhipster,duderoot/generator-jhipster,gzsombor/generator-jhipster,dalbelap/generator-jhipster,gzsombor/generator-jhipster,siliconharborlabs/generator-jhipster,ctamisier/generator-jhipster,JulienMrgrd/generator-jhipster,pascalgrimaud/generator-jhipster,deepu105/generator-jhipster,atomfrede/generator-jhipster,yongli82/generator-jhipster,ziogiugno/generator-jhipster,nkolosnjaji/generator-jhipster,erikkemperman/generator-jhipster,wmarques/generator-jhipster,mosoft521/generator-jhipster,vivekmore/generator-jhipster,danielpetisme/generator-jhipster,pascalgrimaud/generator-jhipster,ramzimaalej/generator-jhipster,mosoft521/generator-jhipster,PierreBesson/generator-jhipster,dynamicguy/generator-jhipster,ctamisier/generator-jhipster,sohibegit/generator-jhipster,dalbelap/generator-jhipster,liseri/generator-jhipster,atomfrede/generator-jhipster,nkolosnjaji/generator-jhipster,Tcharl/generator-jhipster,jkutner/generator-jhipster,sohibegit/generator-jhipster,eosimosu/generator-jhipster,mraible/generator-jhipster,mosoft521/generator-jhipster,jkutner/generator-jhipster,hdurix/generator-jhipster,rkohel/generator-jhipster,baskeboler/generator-jhipster,sendilkumarn/generator-jhipster,PierreBesson/generator-jhipster,dimeros/generator-jhipster,dalbelap/generator-jhipster,duderoot/generator-jhipster,ruddell/generator-jhipster,cbornet/generator-jhipster,baskeboler/generator-jhipster,deepu105/generator-jhipster,sohibegit/generator-jhipster,liseri/generator-jhipster,atomfrede/generator-jhipster,sohibegit/generator-jhipster,robertmilowski/generator-jhipster,baskeboler/generator-jhipster,mraible/generator-jhipster,pascalgrimaud/generator-jhipster,eosimosu/generator-jhipster,JulienMrgrd/generator-jhipster,wmarques/generator-jhipster,sendilkumarn/generator-jhipster,lrkwz/generator-jhipster,robertmilowski/generator-jhipster,rkohel/generator-jhipster,ctamisier/generator-jhipster,sohibegit/generator-jhipster,stevehouel/generator-jhipster,hdurix/generator-jhipster,eosimosu/generator-jhipster,rifatdover/generator-jhipster,nkolosnjaji/generator-jhipster,dalbelap/generator-jhipster,erikkemperman/generator-jhipster,jhipster/generator-jhipster,siliconharborlabs/generator-jhipster,erikkemperman/generator-jhipster,vivekmore/generator-jhipster,atomfrede/generator-jhipster,stevehouel/generator-jhipster,wmarques/generator-jhipster,PierreBesson/generator-jhipster,vivekmore/generator-jhipster,vivekmore/generator-jhipster,ruddell/generator-jhipster,baskeboler/generator-jhipster,gmarziou/generator-jhipster,dynamicguy/generator-jhipster,rifatdover/generator-jhipster,ruddell/generator-jhipster,wmarques/generator-jhipster,danielpetisme/generator-jhipster,robertmilowski/generator-jhipster,rkohel/generator-jhipster,danielpetisme/generator-jhipster,Tcharl/generator-jhipster,yongli82/generator-jhipster,yongli82/generator-jhipster,pascalgrimaud/generator-jhipster,sendilkumarn/generator-jhipster,rifatdover/generator-jhipster,mosoft521/generator-jhipster,jhipster/generator-jhipster,gmarziou/generator-jhipster,cbornet/generator-jhipster,jhipster/generator-jhipster,danielpetisme/generator-jhipster,hdurix/generator-jhipster,mraible/generator-jhipster,ruddell/generator-jhipster,jkutner/generator-jhipster,nkolosnjaji/generator-jhipster,siliconharborlabs/generator-jhipster,dimeros/generator-jhipster,dimeros/generator-jhipster,hdurix/generator-jhipster,jhipster/generator-jhipster,atomfrede/generator-jhipster,JulienMrgrd/generator-jhipster,siliconharborlabs/generator-jhipster,jkutner/generator-jhipster,Tcharl/generator-jhipster,eosimosu/generator-jhipster,stevehouel/generator-jhipster,mraible/generator-jhipster,sendilkumarn/generator-jhipster,dynamicguy/generator-jhipster,robertmilowski/generator-jhipster,lrkwz/generator-jhipster,jkutner/generator-jhipster,gzsombor/generator-jhipster,ctamisier/generator-jhipster,hdurix/generator-jhipster,ctamisier/generator-jhipster,rkohel/generator-jhipster,lrkwz/generator-jhipster,lrkwz/generator-jhipster,PierreBesson/generator-jhipster,rkohel/generator-jhipster,stevehouel/generator-jhipster,duderoot/generator-jhipster,dimeros/generator-jhipster,ziogiugno/generator-jhipster,cbornet/generator-jhipster,gzsombor/generator-jhipster,sendilkumarn/generator-jhipster,robertmilowski/generator-jhipster,duderoot/generator-jhipster,liseri/generator-jhipster,ramzimaalej/generator-jhipster,ziogiugno/generator-jhipster,dynamicguy/generator-jhipster,yongli82/generator-jhipster,gmarziou/generator-jhipster,erikkemperman/generator-jhipster,deepu105/generator-jhipster,gmarziou/generator-jhipster,pascalgrimaud/generator-jhipster,stevehouel/generator-jhipster,ziogiugno/generator-jhipster,deepu105/generator-jhipster,Tcharl/generator-jhipster,dimeros/generator-jhipster,ramzimaalej/generator-jhipster,duderoot/generator-jhipster,deepu105/generator-jhipster,ziogiugno/generator-jhipster,JulienMrgrd/generator-jhipster,erikkemperman/generator-jhipster,yongli82/generator-jhipster,siliconharborlabs/generator-jhipster,cbornet/generator-jhipster,jhipster/generator-jhipster
--- +++ @@ -15,7 +15,9 @@ const propertiesObject = res.json(); for (let key in propertiesObject) { - properties.push(propertiesObject[key]); + if (propertiesObject.hasOwnProperty(key)) { + properties.push(propertiesObject[key]); + } } return properties.sort((propertyA, propertyB) => { @@ -32,13 +34,17 @@ const propertiesObject = res.json(); for (let key in propertiesObject) { - let valsObject = propertiesObject[key]; - let vals: any[] = []; + if (propertiesObject.hasOwnProperty(key)) { + let valsObject = propertiesObject[key]; + let vals: any[] = []; - for (let valKey in valsObject) { - vals.push({key: valKey, val: valsObject[valKey]}); + for (let valKey in valsObject) { + if (valsObject.hasOwnProperty(valKey)) { + vals.push({key: valKey, val: valsObject[valKey]}); + } + } + properties[key] = vals; } - properties[key] = vals; } return properties;
a1711158f3d3815c78f1b56ac133fe62efc489cb
angular-rest-services/src/app/app.component.ts
angular-rest-services/src/app/app.component.ts
import { Component } from '@angular/core'; import { Http } from '@angular/http'; import { BooksService } from './books.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { books: string[] = []; constructor(private http: Http, private service: BooksService) { } search(title: string) { this.books = []; this.service.getBooks(title).subscribe( books => this.books = books, error => console.error(error) ); } }
import { Component } from '@angular/core'; import { BooksService } from './books.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent { books: string[] = []; constructor(private service: BooksService) { } search(title: string) { this.books = []; this.service.getBooks(title).subscribe( success => this.books = success, error => console.error(error) ); } }
Remove unused code in angular-rest-service books service
Remove unused code in angular-rest-service books service
TypeScript
apache-2.0
bonigarcia/web-programming-examples,bonigarcia/web-programming-examples,bonigarcia/web-programming-examples,bonigarcia/web-programming-examples
--- +++ @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; -import { Http } from '@angular/http'; import { BooksService } from './books.service'; @@ -10,12 +9,12 @@ export class AppComponent { books: string[] = []; - constructor(private http: Http, private service: BooksService) { } + constructor(private service: BooksService) { } search(title: string) { this.books = []; this.service.getBooks(title).subscribe( - books => this.books = books, + success => this.books = success, error => console.error(error) ); }
af02b004c90edba0c4e037f9bcdffcb23b0dd316
app/javascript/lca/ducks/entities/character.ts
app/javascript/lca/ducks/entities/character.ts
// @flow import { createApiActions, createEntityReducer, mergeEntity } from './_entity' import { crudAction, standardTypes } from './_lib' import { callApi } from 'utils/api.js' const CHARACTER = 'character' export default createEntityReducer(CHARACTER, { [crudAction(CHARACTER, 'CHANGE_TYPE').success.toString()]: mergeEntity, }) export const [ createCharacter, duplicateCharacter, fetchCharacter, fetchAllCharacters, updateCharacter, destroyCharacter, ] = createApiActions(CHARACTER) export function changeCharacterType(id: number, type: string) { const action = crudAction(CHARACTER, 'CHANGE_TYPE') return callApi({ body: JSON.stringify({ type }), endpoint: `/api/v1/characters/${id}/change_type`, types: standardTypes(CHARACTER, action), }) }
import createCachedSelector from 're-reselect' import { ICharacter } from 'types' import { callApi } from 'utils/api.js' import { createApiActions, createEntityReducer, mergeEntity } from './_entity' import { crudAction, standardTypes } from './_lib' import { EntityState, WrappedEntityState } from './_types' const unwrapped = (state: WrappedEntityState): EntityState => state.entities.current const CHARACTER = 'character' export default createEntityReducer(CHARACTER, { [crudAction(CHARACTER, 'CHANGE_TYPE').success.toString()]: mergeEntity, }) export const [ createCharacter, duplicateCharacter, fetchCharacter, fetchAllCharacters, updateCharacter, destroyCharacter, ] = createApiActions(CHARACTER) export function changeCharacterType(id: number, type: string) { const action = crudAction(CHARACTER, 'CHANGE_TYPE') return callApi({ body: JSON.stringify({ type }), endpoint: `/api/v1/characters/${id}/change_type`, types: standardTypes(CHARACTER, action), }) } export const getSpecificCharacter = (state: WrappedEntityState, id: number) => unwrapped(state).characters[id] const getMerits = (state: WrappedEntityState) => unwrapped(state).merits export const getMeritsForCharacter = createCachedSelector( [getSpecificCharacter, getMerits], (character, merits) => character.merits.map(m => merits[m]) )((state, id) => id)
Fix broken build (still v76)
Fix broken build (still v76)
TypeScript
agpl-3.0
makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi,makzu/lotcastingatemi
--- +++ @@ -1,8 +1,13 @@ -// @flow +import createCachedSelector from 're-reselect' + +import { ICharacter } from 'types' +import { callApi } from 'utils/api.js' import { createApiActions, createEntityReducer, mergeEntity } from './_entity' import { crudAction, standardTypes } from './_lib' +import { EntityState, WrappedEntityState } from './_types' -import { callApi } from 'utils/api.js' +const unwrapped = (state: WrappedEntityState): EntityState => + state.entities.current const CHARACTER = 'character' @@ -27,3 +32,13 @@ types: standardTypes(CHARACTER, action), }) } + +export const getSpecificCharacter = (state: WrappedEntityState, id: number) => + unwrapped(state).characters[id] + +const getMerits = (state: WrappedEntityState) => unwrapped(state).merits + +export const getMeritsForCharacter = createCachedSelector( + [getSpecificCharacter, getMerits], + (character, merits) => character.merits.map(m => merits[m]) +)((state, id) => id)
5eea4756be6c9b44880b34e446832ffc3f5c4186
src/index.tsx
src/index.tsx
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './store'; import { API_URL } from './constants'; import { clearDom, createRootDiv, importBlueprintStyleSheet, importNormalizrStyleSheet, attachPolarisStyleSheet, attachToastrStylesSheet } from './utils/config'; import App from './components/App'; // If not in development, kick off productions configurations. if (API_URL !== 'http://localhost:7777') { clearDom(); createRootDiv(); } importBlueprintStyleSheet(); importNormalizrStyleSheet(); attachPolarisStyleSheet(); attachToastrStylesSheet(); ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.querySelector('#root') as HTMLElement ); // registerServiceWorker();
import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './store'; import { API_URL } from './constants'; import { clearDom, createRootDiv, importNormalizrStyleSheet, attachPolarisStyleSheet, attachToastrStylesSheet } from './utils/config'; import App from './components/App'; // If not in development, kick off productions configurations. if (API_URL !== 'http://localhost:7777') { clearDom(); createRootDiv(); } importNormalizrStyleSheet(); attachPolarisStyleSheet(); attachToastrStylesSheet(); ReactDOM.render( <Provider store={store}> <App /> </Provider>, document.querySelector('#root') as HTMLElement ); // registerServiceWorker();
Move importing stylesheets to CustomHead
Move importing stylesheets to CustomHead
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -6,7 +6,6 @@ import { clearDom, createRootDiv, - importBlueprintStyleSheet, importNormalizrStyleSheet, attachPolarisStyleSheet, attachToastrStylesSheet @@ -20,7 +19,6 @@ createRootDiv(); } -importBlueprintStyleSheet(); importNormalizrStyleSheet(); attachPolarisStyleSheet();
7d3b9a5e92bfffdcd05a258935bc863d43dd3116
client/src/app/_services/permission.service.ts
client/src/app/_services/permission.service.ts
import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {Permission} from '../_models'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; import {Observable} from 'rxjs'; import {NgxPermissionsService} from 'ngx-permissions'; @Injectable() export class PermissionService { constructor(private http: HttpClient, private ngxPermissions: NgxPermissionsService) { } getAll(): Observable<Array<Permission>> { return this.http.get<Array<Permission>>('/api/permissions').concatMap(perms => { const obs = []; perms.forEach(p => { return obs.push( Observable.fromPromise(this.ngxPermissions.hasPermission(p.name as string) .then(hasP => { p.disabled = !hasP; return p; }) ) ); }); return Observable.forkJoin(obs); }); } }
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Permission } from '../_models'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; import { Observable } from 'rxjs'; import { NgxPermissionsService } from 'ngx-permissions'; @Injectable() export class PermissionService { constructor(private http: HttpClient, private ngxPermissions: NgxPermissionsService) {} getAll(): Observable<Array<Permission>> { return this.http.get<Array<Permission>>('/api/permissions').concatMap(perms => { const obs = []; perms.forEach(p => { return obs.push( Observable.fromPromise(this.ngxPermissions.hasPermission(p.name as string) .then(hasP => { p.disabled = !hasP; return p; }) ) ); }); return Observable.forkJoin(obs); }); } }
Add space in ES6 imports
[tslint]: Add space in ES6 imports
TypeScript
apache-2.0
K-Fet/K-App,K-Fet/K-App,K-Fet/K-App,K-Fet/K-App
--- +++ @@ -1,18 +1,17 @@ -import {Injectable} from '@angular/core'; -import {HttpClient} from '@angular/common/http'; -import {Permission} from '../_models'; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Permission } from '../_models'; import 'rxjs/add/observable/throw'; import 'rxjs/add/operator/catch'; -import {Observable} from 'rxjs'; -import {NgxPermissionsService} from 'ngx-permissions'; +import { Observable } from 'rxjs'; +import { NgxPermissionsService } from 'ngx-permissions'; @Injectable() export class PermissionService { constructor(private http: HttpClient, - private ngxPermissions: NgxPermissionsService) { - } + private ngxPermissions: NgxPermissionsService) {} getAll(): Observable<Array<Permission>> { return this.http.get<Array<Permission>>('/api/permissions').concatMap(perms => {
c7734dc035db4624b3919672546ce0829dd1e329
src/structurePrinters/base/ModifierableNodeStructurePrinter.ts
src/structurePrinters/base/ModifierableNodeStructurePrinter.ts
import { CodeBlockWriter } from "../../codeBlockWriter"; import { AbstractableNodeStructure, AmbientableNodeStructure, AsyncableNodeStructure, ExportableNodeStructure, ReadonlyableNodeStructure, ScopeableNodeStructure, ScopedNodeStructure, StaticableNodeStructure } from "../../structures"; import { Printer } from "../Printer"; export type ModifierableNodeStructures = AbstractableNodeStructure | AmbientableNodeStructure | AsyncableNodeStructure | ExportableNodeStructure | ReadonlyableNodeStructure | ScopeableNodeStructure | ScopedNodeStructure | StaticableNodeStructure; export class ModifierableNodeStructurePrinter extends Printer<ModifierableNodeStructures> { printText(writer: CodeBlockWriter, structure: ModifierableNodeStructures) { const scope = (structure as ScopeableNodeStructure).scope; if ((structure as ExportableNodeStructure).isDefaultExport) writer.write("export default "); else if ((structure as ExportableNodeStructure).isExported) writer.write("export "); if ((structure as AmbientableNodeStructure).hasDeclareKeyword) writer.write("declare "); if ((structure as AbstractableNodeStructure).isAbstract) writer.write("abstract "); if (scope != null) writer.write(`${scope} `); if ((structure as StaticableNodeStructure).isStatic) writer.write("static "); if ((structure as AsyncableNodeStructure).isAsync) writer.write("async "); if ((structure as ReadonlyableNodeStructure).isReadonly) writer.write("readonly "); } }
import { CodeBlockWriter } from "../../codeBlockWriter"; import { AbstractableNodeStructure, AmbientableNodeStructure, AsyncableNodeStructure, ExportableNodeStructure, ReadonlyableNodeStructure, ScopeableNodeStructure, ScopedNodeStructure, StaticableNodeStructure } from "../../structures"; import { Printer } from "../Printer"; export type ModifierableNodeStructures = AbstractableNodeStructure | AmbientableNodeStructure | AsyncableNodeStructure | ExportableNodeStructure | ReadonlyableNodeStructure | ScopeableNodeStructure | ScopedNodeStructure | StaticableNodeStructure; export class ModifierableNodeStructurePrinter extends Printer<ModifierableNodeStructures> { printText(writer: CodeBlockWriter, structure: ModifierableNodeStructures) { const scope = (structure as ScopeableNodeStructure).scope; if ((structure as ExportableNodeStructure).isDefaultExport) writer.write("export default "); else if ((structure as ExportableNodeStructure).isExported) writer.write("export "); if ((structure as AmbientableNodeStructure).hasDeclareKeyword) writer.write("declare "); if (scope != null) writer.write(`${scope} `); if ((structure as AbstractableNodeStructure).isAbstract) writer.write("abstract "); if ((structure as StaticableNodeStructure).isStatic) writer.write("static "); if ((structure as AsyncableNodeStructure).isAsync) writer.write("async "); if ((structure as ReadonlyableNodeStructure).isReadonly) writer.write("readonly "); } }
Fix abstract keyword accidentally being printed before scope.
fix: Fix abstract keyword accidentally being printed before scope. There are tests for this coming...
TypeScript
mit
dsherret/ts-simple-ast
--- +++ @@ -15,10 +15,10 @@ writer.write("export "); if ((structure as AmbientableNodeStructure).hasDeclareKeyword) writer.write("declare "); + if (scope != null) + writer.write(`${scope} `); if ((structure as AbstractableNodeStructure).isAbstract) writer.write("abstract "); - if (scope != null) - writer.write(`${scope} `); if ((structure as StaticableNodeStructure).isStatic) writer.write("static "); if ((structure as AsyncableNodeStructure).isAsync)
d2785ea12fbece9c2e50af1885f8f6021f5a9701
components/page/Button.tsx
components/page/Button.tsx
import { FC } from 'react'; import { Icon } from '@mdi/react'; type ButtonProps = { text: string; title?: string; icon?: string; size?: string | number; className?: string; onClick?: () => void; href?: string; }; export const Button: FC<ButtonProps> = ({ onClick, href, text, title, icon, size, className }) => { const conditional = icon ? 'p-2 rounded-8 hover:bg-neutral' : 'px-8 py-6 border dark:border-slate-400 hover:shadow rounded-4 text-12 font-bold uppercase'; const classes = `text-primary dark:text-primary-dark dark:hover:bg-neutral-dark ${conditional} ${className ?? ''}`; const content = icon ? <Icon path={icon} size={size ?? 1} /> : text; return href ? ( <a href={href} target="_blank" rel="noreferrer" className={classes} title={title} aria-label={text}> {content} </a> ) : ( <button onClick={onClick} className={classes} title={title} aria-label={text}> {content} </button> ); };
import { AnchorHTMLAttributes, ButtonHTMLAttributes, FC } from 'react'; import { Icon } from '@mdi/react'; type ButtonProps = { text: string; icon?: string; size?: string | number; className?: string; }; const iconClassNames = 'p-2 rounded-8 hover:bg-neutral'; const textClassNames = 'px-8 py-6 border dark:border-slate-400 hover:shadow rounded-4 text-12 font-bold uppercase'; const commonClassNames = 'text-primary dark:text-primary-dark dark:hover:bg-neutral-dark'; export const Button: FC<ButtonProps & ButtonHTMLAttributes<HTMLButtonElement>> = ({ text, icon, size = 1, className = '', ...rest }) => ( <button className={`${commonClassNames} ${icon ? iconClassNames : textClassNames} ${className}`} aria-label={text} {...rest}> {icon ? <Icon path={icon} size={size ?? 1} /> : text} </button> ); export const LinkButton: FC<ButtonProps & AnchorHTMLAttributes<HTMLAnchorElement>> = ({ text, icon, size = 1, className = '', ...rest }) => ( <a target="_blank" rel="noreferrer" className={`${commonClassNames} ${icon ? iconClassNames : textClassNames} ${className}`} aria-label={text} {...rest}> {icon ? <Icon path={icon} size={size} /> : text} </a> );
Rewrite and improve common button components
Rewrite and improve common button components
TypeScript
mit
benct/tomlin-web,benct/tomlin-web
--- +++ @@ -1,31 +1,36 @@ -import { FC } from 'react'; +import { AnchorHTMLAttributes, ButtonHTMLAttributes, FC } from 'react'; import { Icon } from '@mdi/react'; type ButtonProps = { text: string; - title?: string; icon?: string; size?: string | number; className?: string; - onClick?: () => void; - href?: string; }; -export const Button: FC<ButtonProps> = ({ onClick, href, text, title, icon, size, className }) => { - const conditional = icon - ? 'p-2 rounded-8 hover:bg-neutral' - : 'px-8 py-6 border dark:border-slate-400 hover:shadow rounded-4 text-12 font-bold uppercase'; - const classes = `text-primary dark:text-primary-dark dark:hover:bg-neutral-dark ${conditional} ${className ?? ''}`; +const iconClassNames = 'p-2 rounded-8 hover:bg-neutral'; +const textClassNames = 'px-8 py-6 border dark:border-slate-400 hover:shadow rounded-4 text-12 font-bold uppercase'; +const commonClassNames = 'text-primary dark:text-primary-dark dark:hover:bg-neutral-dark'; - const content = icon ? <Icon path={icon} size={size ?? 1} /> : text; +export const Button: FC<ButtonProps & ButtonHTMLAttributes<HTMLButtonElement>> = ({ text, icon, size = 1, className = '', ...rest }) => ( + <button className={`${commonClassNames} ${icon ? iconClassNames : textClassNames} ${className}`} aria-label={text} {...rest}> + {icon ? <Icon path={icon} size={size ?? 1} /> : text} + </button> +); - return href ? ( - <a href={href} target="_blank" rel="noreferrer" className={classes} title={title} aria-label={text}> - {content} - </a> - ) : ( - <button onClick={onClick} className={classes} title={title} aria-label={text}> - {content} - </button> - ); -}; +export const LinkButton: FC<ButtonProps & AnchorHTMLAttributes<HTMLAnchorElement>> = ({ + text, + icon, + size = 1, + className = '', + ...rest +}) => ( + <a + target="_blank" + rel="noreferrer" + className={`${commonClassNames} ${icon ? iconClassNames : textClassNames} ${className}`} + aria-label={text} + {...rest}> + {icon ? <Icon path={icon} size={size} /> : text} + </a> +);
e12e40763503407c03c2face630afe70c24acf32
src/client/src/shell/GlobalScrollbarStyle.tsx
src/client/src/shell/GlobalScrollbarStyle.tsx
import React from 'react' import Helmet from 'react-helmet' export const css = ` body, #root { overflow: hidden; } ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-thumb { border-radius: 2px; background-color: rgba(212, 221, 232, .4); } ::-webkit-scrollbar-corner { background-color: rgba(0,0,0,0); } ` export const GlobalScrollbarStyle = () => ( <Helmet> <style>{css}</style> </Helmet> ) export default GlobalScrollbarStyle
import React from 'react' import Helmet from 'react-helmet' export const css = ` body, #root { overflow: hidden; } body ::-webkit-scrollbar { width: 6px; height: 6px; } body ::-webkit-scrollbar-thumb { border-radius: 2px; background-color: rgba(212, 221, 232, .4); } body ::-webkit-scrollbar-corner { background-color: rgba(0,0,0,0); } ` export const GlobalScrollbarStyle = () => ( <Helmet> <style>{css}</style> </Helmet> ) export default GlobalScrollbarStyle
Isolate scroll style to elements within body
Isolate scroll style to elements within body
TypeScript
apache-2.0
AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud
--- +++ @@ -6,15 +6,17 @@ overflow: hidden; } - ::-webkit-scrollbar { + body ::-webkit-scrollbar { width: 6px; height: 6px; } - ::-webkit-scrollbar-thumb { + + body ::-webkit-scrollbar-thumb { border-radius: 2px; background-color: rgba(212, 221, 232, .4); } - ::-webkit-scrollbar-corner { + + body ::-webkit-scrollbar-corner { background-color: rgba(0,0,0,0); } `
84bf2db47ea1537471e3914db00d7f5ab6e3e337
src/dependument.ts
src/dependument.ts
export class Dependument { private package: string; private templates: string; constructor(options: any) { } }
export class Dependument { private package: string; private templates: string; constructor(options: any) { if (!options.path) { throw new Error("No path specified in options"); } } }
Throw error if no path
Throw error if no path
TypeScript
unlicense
dependument/dependument,Jameskmonger/dependument,dependument/dependument,Jameskmonger/dependument
--- +++ @@ -3,6 +3,8 @@ private templates: string; constructor(options: any) { - + if (!options.path) { + throw new Error("No path specified in options"); + } } }
7adfba39f5239453c680ded5efbe2d6fc3f4b851
eslint/extension.ts
eslint/extension.ts
/* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ 'use strict'; import * as path from 'path'; import { workspace, Disposable, ExtensionContext } from 'vscode'; import { LanguageClient, LanguageClientOptions, SettingMonitor, RequestType, TransportKind } from 'vscode-languageclient'; export function activate(context: ExtensionContext) { // We need to go one level up since an extension compile the js code into // the output folder. let serverModule = path.join(__dirname, '..', 'server', 'server.js'); let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] }; let serverOptions = { run: { module: serverModule, transport: TransportKind.ipc }, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions} }; let clientOptions: LanguageClientOptions = { documentSelector: ['javascript', 'javascriptreact'], synchronize: { configurationSection: 'eslint', fileEvents: workspace.createFileSystemWatcher('**/.eslintrc') } } let client = new LanguageClient('ESLint', serverOptions, clientOptions); context.subscriptions.push(new SettingMonitor(client, 'eslint.enable').start()); }
/* -------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. * ------------------------------------------------------------------------------------------ */ 'use strict'; import * as path from 'path'; import { workspace, Disposable, ExtensionContext } from 'vscode'; import { LanguageClient, LanguageClientOptions, SettingMonitor, RequestType, TransportKind } from 'vscode-languageclient'; export function activate(context: ExtensionContext) { // We need to go one level up since an extension compile the js code into // the output folder. let serverModule = path.join(__dirname, '..', 'server', 'server.js'); let debugOptions = { execArgv: ["--nolazy", "--debug=6004"] }; let serverOptions = { run: { module: serverModule, transport: TransportKind.ipc }, debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions} }; let clientOptions: LanguageClientOptions = { documentSelector: ['javascript', 'javascriptreact'], synchronize: { configurationSection: 'eslint', fileEvents: workspace.createFileSystemWatcher('**/.eslintr{c.js,c.yaml,c.yml,c,c.json}') } } let client = new LanguageClient('ESLint', serverOptions, clientOptions); context.subscriptions.push(new SettingMonitor(client, 'eslint.enable').start()); }
Add support for eslintrc.json, yaml, yml and js
Add support for eslintrc.json, yaml, yml and js
TypeScript
mit
chenxsan/vscode-standardjs
--- +++ @@ -23,7 +23,7 @@ documentSelector: ['javascript', 'javascriptreact'], synchronize: { configurationSection: 'eslint', - fileEvents: workspace.createFileSystemWatcher('**/.eslintrc') + fileEvents: workspace.createFileSystemWatcher('**/.eslintr{c.js,c.yaml,c.yml,c,c.json}') } }
7837031fef54443651fe82dd533ecf91dbc422dc
src/lib/default-errors.ts
src/lib/default-errors.ts
import {ErrorMessage} from "./Models/ErrorMessage"; export const DEFAULT_ERRORS: ErrorMessage[] = [ { error: 'required', format: label => `${label} is required` }, { error: 'pattern', format: label => `${label} is invalid` }, { error: 'minlength', format: (label, error) => `${label} must be at least ${error.requiredLength} characters` }, { error: 'maxlength', format: (label, error) => `${label} must be no longer than ${error.requiredLength} characters` } ];
import {ErrorMessage} from "./Models/ErrorMessage"; export const DEFAULT_ERRORS: ErrorMessage[] = [ { error: 'required', format: label => `${label} is required` }, { error: 'pattern', format: label => `${label} is invalid` }, { error: 'minlength', format: (label, error) => `${label} must be at least ${error.requiredLength} characters` }, { error: 'maxlength', format: (label, error) => `${label} must be no longer than ${error.requiredLength} characters` }, { error: 'requiredTrue', format: (label, error) => `${label} is required` }, { error: 'email', format: (label, error) => `Invalid email address` } ];
Add requiredTrue and email to default errors
Add requiredTrue and email to default errors
TypeScript
mit
third774/ng-bootstrap-form-validation,third774/ng-bootstrap-form-validation,third774/ng-bootstrap-form-validation
--- +++ @@ -16,5 +16,13 @@ { error: 'maxlength', format: (label, error) => `${label} must be no longer than ${error.requiredLength} characters` + }, + { + error: 'requiredTrue', + format: (label, error) => `${label} is required` + }, + { + error: 'email', + format: (label, error) => `Invalid email address` } ];
5f0b62aa02972445938b24dc8f9f6855ee1af594
src/v2/pages/rss/components/RssItem/index.tsx
src/v2/pages/rss/components/RssItem/index.tsx
import React from 'react' import { ReactElement } from 'react' const rssElement = (name: string) => p => { const { children, ...props } = p return React.createElement(name, props, children) } const Item = rssElement('item') interface RssItemProps { title?: string link?: string pubDate?: string guid?: string source?: string description?: ReactElement } export const RssItem: React.FC<RssItemProps> = ({ title, link, pubDate, guid, description, }) => { const html = ` <title>${title}</title> <link>${link}</link> <pubDate>${new Date(pubDate).toUTCString()}</pubDate> <guid>${guid}</guid> <description> <![CDATA[${description}]]> </description> ` return <Item dangerouslySetInnerHTML={{ __html: html }} /> }
import React from 'react' import { ReactElement } from 'react' const rssElement = (name: string) => p => { const { children, ...props } = p return React.createElement(name, props, children) } const Item = rssElement('item') interface RssItemProps { title?: string link?: string pubDate?: string guid?: string source?: string description?: ReactElement } export const RssItem: React.FC<RssItemProps> = ({ title, link, pubDate, guid, source, description, }) => { const html = ` <title>${title}</title> <link>${link}</link> <pubDate>${new Date(pubDate).toUTCString()}</pubDate> <guid>${guid}</guid> <source url="${source.split('?')[0]}" /> <description> <![CDATA[${description}]]> </description> ` return <Item dangerouslySetInnerHTML={{ __html: html }} /> }
Add RSS source tag for items
Add RSS source tag for items
TypeScript
mit
aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell
--- +++ @@ -22,6 +22,7 @@ link, pubDate, guid, + source, description, }) => { const html = ` @@ -29,6 +30,7 @@ <link>${link}</link> <pubDate>${new Date(pubDate).toUTCString()}</pubDate> <guid>${guid}</guid> + <source url="${source.split('?')[0]}" /> <description> <![CDATA[${description}]]> </description>
dffded8e9360f0ff16e654fecc305f3825a44346
src/lib/src/parser/parser.ts
src/lib/src/parser/parser.ts
import { Resource as HalfredResource, parse as halfredParse } from 'halfred'; import { Resource } from '../hal'; import { InternalResourceWrapper } from './internal-resource-wrapper'; /** * Parser offers validation and normalization of HAL resources represented as object literals. * * <p>It performs normalization and validation of the reserved HAL properties * <code>_embedded</code> and <code>_links</code>. * * <p>Internally, delegates to <code>halfred</code> library for the time being. */ export class Parser { public parse(input: any): Resource { return new InternalResourceWrapper(halfredParse(input)); } }
import { Resource as HalfredResource, parse as halfredParse } from 'halfred'; import { Resource } from '../hal'; import { InternalResourceWrapper } from './internal-resource-wrapper'; /** * Parser offers validation and normalization of HAL resources represented as object literals. * * <p>It performs normalization and validation of the reserved HAL properties * <code>_embedded</code> and <code>_links</code>. * * <p>Internally, delegates to <code>halfred</code> library for the time being. */ export class Parser { public parse(input: any): Resource { return new InternalResourceWrapper(halfredParse(input) || {}); } }
Return empty object on empty 204s
Return empty object on empty 204s
TypeScript
mit
dherges/ng-hal,dherges/ng-hal
--- +++ @@ -15,7 +15,7 @@ export class Parser { public parse(input: any): Resource { - return new InternalResourceWrapper(halfredParse(input)); + return new InternalResourceWrapper(halfredParse(input) || {}); } }
357b44172be511b760024709080b61a4ea769569
src/containers/HitTable.ts
src/containers/HitTable.ts
import { RootState, Hit } from '../types'; import { connect, Dispatch } from 'react-redux'; import * as actions from '../actions/turkopticon'; import HitTable, { Props, Handlers } from '../components/HitTable/HitTable'; import { batchFetchTOpticon, selectRequesterIds } from '../utils/turkopticon'; const mapState = (state: RootState): Props => ({ hits: state.hits }); const mapDispatch = (dispatch: Dispatch<actions.TOpticonAction>): Handlers => ({ onRefresh: async (hits: Hit[]) => { try { const freshTOpticons = await batchFetchTOpticon(selectRequesterIds(hits)); dispatch(actions.fetchTOpticonSuccess(freshTOpticons)); } catch (e) { dispatch(actions.fetchTOpticonFailure()); } } }); export default connect(mapState, mapDispatch)(HitTable);
import { RootState } from '../types'; import { connect } from 'react-redux'; import HitTable, { Props } from '../components/HitTable/HitTable'; // import { batchFetchTOpticon, selectRequesterId } from '../utils/turkopticon'; const mapState = (state: RootState): Props => ({ hits: state.hits }); export default connect(mapState)(HitTable);
Refactor for use as callbacks to be passed to .map and .filter
Refactor for use as callbacks to be passed to .map and .filter
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -1,24 +1,12 @@ -import { RootState, Hit } from '../types'; +import { RootState } from '../types'; -import { connect, Dispatch } from 'react-redux'; -import * as actions from '../actions/turkopticon'; -import HitTable, { Props, Handlers } from '../components/HitTable/HitTable'; +import { connect } from 'react-redux'; +import HitTable, { Props } from '../components/HitTable/HitTable'; -import { batchFetchTOpticon, selectRequesterIds } from '../utils/turkopticon'; +// import { batchFetchTOpticon, selectRequesterId } from '../utils/turkopticon'; const mapState = (state: RootState): Props => ({ hits: state.hits }); -const mapDispatch = (dispatch: Dispatch<actions.TOpticonAction>): Handlers => ({ - onRefresh: async (hits: Hit[]) => { - try { - const freshTOpticons = await batchFetchTOpticon(selectRequesterIds(hits)); - dispatch(actions.fetchTOpticonSuccess(freshTOpticons)); - } catch (e) { - dispatch(actions.fetchTOpticonFailure()); - } - } -}); - -export default connect(mapState, mapDispatch)(HitTable); +export default connect(mapState)(HitTable);
e86194367f7d8e15acbc14ae254a0257c4340c4d
src/lib/list/list-divider.component.ts
src/lib/list/list-divider.component.ts
import { Component, ElementRef, Input, Renderer2, ViewChild, ViewEncapsulation, } from '@angular/core'; import { toBoolean } from '../common/boolean-property'; @Component({ selector: '[mdc-list-divider], mdc-list-divider', template: `<div #divider class="mdc-list-divider" role="seperator"> <ng-content></ng-content> </div> `, encapsulation: ViewEncapsulation.None, }) export class ListDividerComponent { private _inset: boolean; @Input() get inset() { return this._inset; } set inset(value) { this._inset = toBoolean(value); if (this._inset) { this._renderer.addClass(this.listItem.nativeElement, 'mdc-list-divider--inset'); } else { this._renderer.removeClass(this.listItem.nativeElement, 'mdc-list-divider--inset'); } } @ViewChild('divider') private listItem: ElementRef; constructor( public elementRef: ElementRef, private _renderer: Renderer2) { } }
import { Component, ElementRef, Input, Renderer2, ViewChild, ViewEncapsulation, } from '@angular/core'; import { toBoolean } from '../common/boolean-property'; @Component({ selector: '[mdc-list-divider], mdc-list-divider', template: `<div #divider class="mdc-list-divider" role="seperator"></div>`, encapsulation: ViewEncapsulation.None, }) export class ListDividerComponent { private _inset: boolean; @Input() get inset() { return this._inset; } set inset(value) { this._inset = toBoolean(value); if (this._inset) { this._renderer.addClass(this.listItem.nativeElement, 'mdc-list-divider--inset'); } else { this._renderer.removeClass(this.listItem.nativeElement, 'mdc-list-divider--inset'); } } @ViewChild('divider') private listItem: ElementRef; constructor( public elementRef: ElementRef, private _renderer: Renderer2) { } }
Simplify html template for list divider
refactor(list): Simplify html template for list divider
TypeScript
mit
trimox/angular-mdc-web,trimox/angular-mdc-web
--- +++ @@ -11,10 +11,7 @@ @Component({ selector: '[mdc-list-divider], mdc-list-divider', template: - `<div #divider class="mdc-list-divider" role="seperator"> - <ng-content></ng-content> - </div> - `, + `<div #divider class="mdc-list-divider" role="seperator"></div>`, encapsulation: ViewEncapsulation.None, }) export class ListDividerComponent {
5943a3f32bf6779c36dc611c5ec2bd2140e46f10
src/middleware/index.ts
src/middleware/index.ts
export { default as matchTestFiles } from "./matchTestFiles"; export { default as globals } from "./globals"; export { default as specSyntax } from "./specSyntax"; export { default as suiteSyntax } from "./suiteSyntax"; export { default as runner } from "./runner"; export { default as resultsReporter } from "./resultsReporter"; export { default as tableReporter } from "./tableReporter"; export { default as dotReporter } from "./dotReporter"; export { default as setupReporter } from "./setupReporter"; export { default as junit } from "./junit"; export { default as exitOnErroredTests } from "./exitOnErroredTests"; export { default as exitOnFailedTests } from "./exitOnFailedTests"; export { default as compose } from "./compose"; export { default as starter } from "./starter"; export { default as event } from "./event"; export { default as args } from "./args"; export { default as assert } from "./assert"; export { default as random } from "./random"; export { default as mock } from "./mock"; export { default as log } from "./log";
export { default as matchTestFiles } from "./matchTestFiles"; export { default as globals } from "./globals"; export { default as specSyntax } from "./specSyntax"; export { default as suiteSyntax } from "./suiteSyntax"; export { default as runner } from "./runner"; export { default as resultsReporter } from "./resultsReporter"; export { default as tableReporter } from "./tableReporter"; export { default as dotReporter } from "./dotReporter"; export { default as tapReporter } from "./tapReporter"; export { default as setupReporter } from "./setupReporter"; export { default as junit } from "./junit"; export { default as exitOnErroredTests } from "./exitOnErroredTests"; export { default as exitOnFailedTests } from "./exitOnFailedTests"; export { default as compose } from "./compose"; export { default as starter } from "./starter"; export { default as event } from "./event"; export { default as args } from "./args"; export { default as assert } from "./assert"; export { default as random } from "./random"; export { default as mock } from "./mock"; export { default as log } from "./log";
Add tapReporter to package export
Add tapReporter to package export
TypeScript
mit
testingrequired/tf,testingrequired/tf
--- +++ @@ -6,6 +6,7 @@ export { default as resultsReporter } from "./resultsReporter"; export { default as tableReporter } from "./tableReporter"; export { default as dotReporter } from "./dotReporter"; +export { default as tapReporter } from "./tapReporter"; export { default as setupReporter } from "./setupReporter"; export { default as junit } from "./junit"; export { default as exitOnErroredTests } from "./exitOnErroredTests";
4b74dfb769633072c1bd7a3f7bdf4571535790b9
console/src/app/core/services/monitoring-api/MongooseApi.model.ts
console/src/app/core/services/monitoring-api/MongooseApi.model.ts
export namespace MongooseApi { export class RunApi { public static readonly RUN = "/run"; } export class LogsApi { public static readonly LOGS = "/logs"; } }
// A class that describes endpoints for Mongoose API. // See Mongoose API (as for 27.03.2019): ... // ... https://github.com/emc-mongoose/mongoose-base/tree/master/doc/interfaces/api/remote export namespace MongooseApi { export class RunApi { public static readonly RUN = "/run"; } export class LogsApi { public static readonly LOGS = "/logs"; } }
Add link to Mongoose API.
Add link to Mongoose API.
TypeScript
mit
emc-mongoose/console,emc-mongoose/console,emc-mongoose/console
--- +++ @@ -1,4 +1,9 @@ +// A class that describes endpoints for Mongoose API. +// See Mongoose API (as for 27.03.2019): ... +// ... https://github.com/emc-mongoose/mongoose-base/tree/master/doc/interfaces/api/remote + export namespace MongooseApi { + export class RunApi { public static readonly RUN = "/run"; }
c76fdd2026edbfc0b565b0f73e24aa0c9a61171b
docs/src/global.css.ts
docs/src/global.css.ts
export default { body: { margin: "0", }, };
export default { body: { margin: "0", /* Support for all WebKit browsers. */ WebkitFontSmoothing: "antialiased", /* Support for Firefox. */ MozOsxFontSmoothing: "grayscale", }, };
Add font smoothing to docs
Add font smoothing to docs
TypeScript
mit
wikiwi/react-css-transition,wikiwi/react-css-transition
--- +++ @@ -1,5 +1,10 @@ export default { body: { margin: "0", + + /* Support for all WebKit browsers. */ + WebkitFontSmoothing: "antialiased", + /* Support for Firefox. */ + MozOsxFontSmoothing: "grayscale", }, };
061b3b7cb068a9928e18aedf696956a8231ef1c0
templates/app/src/_name.ts
templates/app/src/_name.ts
import * as angular from 'angular'; import { <%= pAppName %>Config } from './<%= hAppName %>.config'; import { <%= pAppName %>Run } from './<%= hAppName %>.run'; import { ServicesModule } from './services/services.module'; angular.module('<%= appName %>', [ // Uncomment to use your app templates. // '<%= appName %>.tpls', 'ui.router', ServicesModule ]) .config(<%= pAppName %>Config) .run(<%= pAppName %>Run);
import * as angular from 'angular'; import { <%= pAppName %>Config } from './<%= hAppName %>.config'; import { <%= pAppName %>Run } from './<%= hAppName %>.run'; import { ServicesModule } from './services/services.module'; angular .module('<%= appName %>', [ // Uncomment to use your app templates. // '<%= appName %>.tpls', 'ui.router', ServicesModule ]) .config(<%= pAppName %>Config) .run(<%= pAppName %>Run);
Adjust formating for entry module
Adjust formating for entry module
TypeScript
mit
Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli
--- +++ @@ -3,11 +3,12 @@ import { <%= pAppName %>Run } from './<%= hAppName %>.run'; import { ServicesModule } from './services/services.module'; -angular.module('<%= appName %>', [ - // Uncomment to use your app templates. - // '<%= appName %>.tpls', - 'ui.router', - ServicesModule -]) -.config(<%= pAppName %>Config) -.run(<%= pAppName %>Run); +angular + .module('<%= appName %>', [ + // Uncomment to use your app templates. + // '<%= appName %>.tpls', + 'ui.router', + ServicesModule + ]) + .config(<%= pAppName %>Config) + .run(<%= pAppName %>Run);
587e038831a107c6013e3e48237eb94b7388aeb3
generators/init-app/templates/sample_plain/src/index.ts
generators/init-app/templates/sample_plain/src/index.ts
/** * Created by Caleydo Team on 31.08.2016. */ import 'file-loader?name=index.html!extract-loader!html-loader?interpolate!./index.html'; import 'file-loader?name=404.html-loader!./404.html'; import 'file-loader?name=robots.txt!./robots.txt'; import 'phovea_ui/src/_bootstrap'; import './style.scss'; import {create as createApp} from './app'; import {create as createHeader, AppHeaderLink} from 'phovea_ui/src/header'; import {APP_NAME} from './language'; createHeader( <HTMLElement>document.querySelector('#caleydoHeader'), { appLink: new AppHeaderLink(APP_NAME) } ); const parent = document.querySelector('#app'); createApp(parent).init();
/** * Created by Caleydo Team on 31.08.2016. */ import 'file-loader?name=index.html!extract-loader!html-loader?interpolate!./index.html'; import 'file-loader?name=404.html!./404.html'; import 'file-loader?name=robots.txt!./robots.txt'; import 'phovea_ui/src/_bootstrap'; import './style.scss'; import {create as createApp} from './app'; import {create as createHeader, AppHeaderLink} from 'phovea_ui/src/header'; import {APP_NAME} from './language'; createHeader( <HTMLElement>document.querySelector('#caleydoHeader'), { appLink: new AppHeaderLink(APP_NAME) } ); const parent = document.querySelector('#app'); createApp(parent).init();
Fix 404.html import in app template
Fix 404.html import in app template
TypeScript
bsd-3-clause
phovea/generator-phovea,phovea/generator-phovea,phovea/generator-phovea,phovea/generator-phovea,phovea/generator-phovea
--- +++ @@ -3,7 +3,7 @@ */ import 'file-loader?name=index.html!extract-loader!html-loader?interpolate!./index.html'; -import 'file-loader?name=404.html-loader!./404.html'; +import 'file-loader?name=404.html!./404.html'; import 'file-loader?name=robots.txt!./robots.txt'; import 'phovea_ui/src/_bootstrap'; import './style.scss';
6d5e21db305efbf31b9f888cf4168c2c4a90dd74
src/Entities/Spawner.ts
src/Entities/Spawner.ts
import Entity, {EntityState, EntityStateOptions} from "../Engine/Entity" /** * Spawns stuff. */ export default class Spawner extends Entity { static type = "Nanoshooter/Entities/Spawner" private mesh: BABYLON.Mesh private keybindCallback protected initialize() { this.keybindCallback = (event: KeyboardEvent) => { if (event.keyCode === 32) { this.game.addEntity(new EntityState({ type: "Nanoshooter/Entities/Cube", label: "SpawnedCube" })) } } window.addEventListener("keyup", this.keybindCallback) } removal() { window.removeEventListener("keyup", this.keybindCallback) } }
import Entity, {EntityState, EntityStateOptions} from "../Engine/Entity" /** * Spawns stuff. */ export default class Spawner extends Entity { static type = "Nanoshooter/Entities/Spawner" private mesh: BABYLON.Mesh private keyupAction: (event: KeyboardEvent) => void protected initialize() { this.keyupAction = (event: KeyboardEvent) => { if (event.keyCode === 32) { this.game.addEntity(new EntityState({ type: "Nanoshooter/Entities/Cube", label: "SpawnedCube" })) } } window.addEventListener("keyup", this.keyupAction) } removal() { window.removeEventListener("keyup", this.keyupAction) } }
Tweak spawner semantics slightly for almost no reason.
Tweak spawner semantics slightly for almost no reason.
TypeScript
mit
ChaseMoskal/Nanoshooter,ChaseMoskal/Nanoshooter
--- +++ @@ -10,10 +10,10 @@ private mesh: BABYLON.Mesh - private keybindCallback + private keyupAction: (event: KeyboardEvent) => void protected initialize() { - this.keybindCallback = (event: KeyboardEvent) => { + this.keyupAction = (event: KeyboardEvent) => { if (event.keyCode === 32) { this.game.addEntity(new EntityState({ type: "Nanoshooter/Entities/Cube", @@ -21,10 +21,10 @@ })) } } - window.addEventListener("keyup", this.keybindCallback) + window.addEventListener("keyup", this.keyupAction) } removal() { - window.removeEventListener("keyup", this.keybindCallback) + window.removeEventListener("keyup", this.keyupAction) } }
4670f02918f700aa375e69ddb3624602a6e5e4e1
A2/quickstart/src/app/components/app-custom/app.custom.component.ts
A2/quickstart/src/app/components/app-custom/app.custom.component.ts
import { Component } from "@angular/core"; import { RacePart } from "../../models/race-part.model"; import { RACE_PARTS } from "../../models/mocks"; @Component({ selector: "my-app-custom-component", templateUrl: "./app/components/app-custom/app.custom.component.html", styleUrls: [ "./app/components/app-custom/app.custom.component.css" ] }) export class AppCustomComponent { title = "Ultra Racing Schedule"; races: RacePart[]; getDate(currentDate: Date) { return currentDate; }; ngOnInit() { this.races = RACE_PARTS; }; };
import { Component } from "@angular/core"; import { RacePart } from "../../models/race-part.model"; import { RACE_PARTS } from "../../models/mocks"; @Component({ selector: "my-app-custom-component", templateUrl: "./app/components/app-custom/app.custom.component.html", styleUrls: [ "./app/components/app-custom/app.custom.component.css" ] }) export class AppCustomComponent { title = "Ultra Racing Schedule"; races: RacePart[]; cash = 10000; getDate(currentDate: Date) { return currentDate; }; ngOnInit() { this.races = RACE_PARTS; }; totalCost() { let sum = 0; for (let race of this.races) { if (race.isRacing) { sum += race.entryFee; } } return sum; } cashLeft() { return this.cash - this.totalCost(); } };
Add cash key. Add totalCost, cashLeft methods
Add cash key. Add totalCost, cashLeft methods
TypeScript
mit
var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training
--- +++ @@ -11,6 +11,7 @@ export class AppCustomComponent { title = "Ultra Racing Schedule"; races: RacePart[]; + cash = 10000; getDate(currentDate: Date) { return currentDate; @@ -19,4 +20,20 @@ ngOnInit() { this.races = RACE_PARTS; }; + + totalCost() { + let sum = 0; + + for (let race of this.races) { + if (race.isRacing) { + sum += race.entryFee; + } + } + + return sum; + } + + cashLeft() { + return this.cash - this.totalCost(); + } };
ca921ef955ee1c80f8d521bd14af0fdafbb250c9
wegas-app/src/main/webapp/2/src/Editor/EntitiesConfig/QuestionInstance.ts
wegas-app/src/main/webapp/2/src/Editor/EntitiesConfig/QuestionInstance.ts
import { ConfigurationSchema } from '../editionConfig'; import { config as variableInstanceConfig } from './VariableInstance'; export const config: ConfigurationSchema<IQuestionInstance> = { ...variableInstanceConfig, active: { type: 'boolean', view: { label: 'Active' }, }, validated: { type: 'boolean', view: { type: 'hidden' }, }, unread: { type: 'boolean', view: { type: 'hidden' }, }, };
import { ConfigurationSchema } from '../editionConfig'; import { config as variableInstanceConfig } from './VariableInstance'; export const config: ConfigurationSchema<IQuestionInstance> = { ...variableInstanceConfig, '@class': { type: 'string', value: 'QuestionInstance', view: { type: 'hidden' }, }, active: { type: 'boolean', view: { label: 'Active' }, }, validated: { type: 'boolean', view: { type: 'hidden' }, }, unread: { type: 'boolean', view: { type: 'hidden' }, }, };
Fix missing instance from questions
Fix missing instance from questions
TypeScript
mit
Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas
--- +++ @@ -2,6 +2,11 @@ import { config as variableInstanceConfig } from './VariableInstance'; export const config: ConfigurationSchema<IQuestionInstance> = { ...variableInstanceConfig, + '@class': { + type: 'string', + value: 'QuestionInstance', + view: { type: 'hidden' }, + }, active: { type: 'boolean', view: { label: 'Active' },
2de88ea3ad992097563f449ed5dc0a8c6fdcfdc4
src/components/App.tsx
src/components/App.tsx
import * as React from 'react'; import { Page, Tabs, Stack, Banner } from '@shopify/polaris'; import { HitMap, RequesterMap, SearchOptions } from '../types'; import HitTable from './HitTable/HitTable'; import Search from '../containers/Search'; import { tabs } from '../utils/tabs'; export interface Props { readonly selected: number; readonly hits: HitMap; readonly requesters: RequesterMap; readonly options: SearchOptions; } export interface Handlers { readonly onFetch: (options: SearchOptions) => void; readonly onSelectTab: (selectedTabIndex: number) => void; } const App = (props: Props & Handlers) => { const { onSelectTab, selected, hits, requesters, options, onFetch } = props; const fetchAction = () => onFetch(options); return ( <main> <Page title="Mturk Engine" primaryAction={{ content: 'Fetch Data', onAction: fetchAction }} > <Stack vertical> <Banner status="info">Scanned {hits.size} hits.</Banner> <Tabs selected={selected} tabs={tabs} onSelect={onSelectTab}> <Search /> <HitTable hits={hits} requesters={requesters} emptyAction={fetchAction} /> </Tabs> </Stack> </Page> </main> ); }; export default App;
import * as React from 'react'; import { Page, Tabs, Stack, Banner } from '@shopify/polaris'; import { HitMap, RequesterMap, SearchOptions } from '../types'; import HitTable from './HitTable/HitTable'; import Search from '../containers/Search'; import { tabs } from '../utils/tabs'; export interface Props { readonly selected: number; readonly hits: HitMap; readonly requesters: RequesterMap; readonly options: SearchOptions; } export interface Handlers { readonly onFetch: (options: SearchOptions) => void; readonly onSelectTab: (selectedTabIndex: number) => void; } const App = (props: Props & Handlers) => { const { onSelectTab, selected, hits, requesters, options, onFetch } = props; const fetchAction = () => onFetch(options); return ( <main> <Page title="Mturk Engine" primaryAction={{ content: 'Fetch Data', onAction: fetchAction }} > <Stack vertical> <Banner status="info">Scanned {hits.size} hits.</Banner> <Tabs selected={selected} tabs={tabs} onSelect={onSelectTab}> <Stack vertical spacing="loose"> <Search /> <HitTable hits={hits} requesters={requesters} emptyAction={fetchAction} /> </Stack> </Tabs> </Stack> </Page> </main> ); }; export default App;
Add padding between search form and hit table.
Add padding between search form and hit table.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -30,12 +30,14 @@ <Stack vertical> <Banner status="info">Scanned {hits.size} hits.</Banner> <Tabs selected={selected} tabs={tabs} onSelect={onSelectTab}> - <Search /> - <HitTable - hits={hits} - requesters={requesters} - emptyAction={fetchAction} - /> + <Stack vertical spacing="loose"> + <Search /> + <HitTable + hits={hits} + requesters={requesters} + emptyAction={fetchAction} + /> + </Stack> </Tabs> </Stack> </Page>
c9e5c8a42ceb67787d060b8bc1e0235214c70891
src/bin/typings-list.ts
src/bin/typings-list.ts
#!/usr/bin/env node import minimist = require('minimist') import extend = require('xtend') import { loader, archifyDependencyTree } from '../utils/cli' import { PROJECT_NAME } from '../utils/config' import { resolveTypeDependencies } from '../lib/dependencies' interface Args { verbose: boolean help: boolean ambient: boolean } const args = minimist<Args>(process.argv.slice(2), { boolean: ['verbose', 'help', 'ambient'], alias: { verbose: ['v'], ambient: ['a'], help: ['h'] } }) if (args.help) { console.log(` ${PROJECT_NAME} ls [--ambient] Aliases: la, ll, list `) process.exit(0) } const cwd = process.cwd() const options = extend(args, { cwd }) loader(resolveTypeDependencies({ cwd, ambient: true, dev: true }), options) .then(function (tree) { console.log(archifyDependencyTree(tree, options)) })
#!/usr/bin/env node import minimist = require('minimist') import extend = require('xtend') import { loader, archifyDependencyTree } from '../utils/cli' import { PROJECT_NAME } from '../utils/config' import { resolveTypeDependencies } from '../lib/dependencies' interface Args { verbose: boolean help: boolean ambient: boolean production: boolean } const args = minimist<Args>(process.argv.slice(2), { boolean: ['verbose', 'help', 'ambient', 'production'], alias: { verbose: ['v'], ambient: ['a'], help: ['h'] } }) if (args.help) { console.log(` ${PROJECT_NAME} ls [--ambient] [--production] Aliases: la, ll, list `) process.exit(0) } const cwd = process.cwd() const options = extend(args, { cwd }) loader(resolveTypeDependencies({ cwd, ambient: true, dev: !args.production }), options) .then(function (tree) { console.log(archifyDependencyTree(tree, options)) })
Add `production` flag to `ls`
Add `production` flag to `ls`
TypeScript
mit
typings/typings,typings/typings
--- +++ @@ -10,10 +10,11 @@ verbose: boolean help: boolean ambient: boolean + production: boolean } const args = minimist<Args>(process.argv.slice(2), { - boolean: ['verbose', 'help', 'ambient'], + boolean: ['verbose', 'help', 'ambient', 'production'], alias: { verbose: ['v'], ambient: ['a'], @@ -23,7 +24,7 @@ if (args.help) { console.log(` -${PROJECT_NAME} ls [--ambient] +${PROJECT_NAME} ls [--ambient] [--production] Aliases: la, ll, list `) @@ -34,7 +35,7 @@ const cwd = process.cwd() const options = extend(args, { cwd }) -loader(resolveTypeDependencies({ cwd, ambient: true, dev: true }), options) +loader(resolveTypeDependencies({ cwd, ambient: true, dev: !args.production }), options) .then(function (tree) { console.log(archifyDependencyTree(tree, options)) })
80cad23dd09235470e80fdeb48db67b9bdd3b29b
arity.d.ts
arity.d.ts
declare function arity (arity: number, fn: Function): Function; export = arity;
declare function arity (arity: number, fn: (...args: any[]) => any): (...args: any[]) => any; export = arity;
Use function signatures with typings
Use function signatures with typings
TypeScript
mit
blakeembrey/arity
--- +++ @@ -1,3 +1,3 @@ -declare function arity (arity: number, fn: Function): Function; +declare function arity (arity: number, fn: (...args: any[]) => any): (...args: any[]) => any; export = arity;
807b8248fe41002632becb84277fe361d1f44972
packages/components/containers/calendar/shareURL/EditLinkModal.tsx
packages/components/containers/calendar/shareURL/EditLinkModal.tsx
import React, { useState } from 'react'; import { Nullable } from 'proton-shared/lib/interfaces/utils'; import { c } from 'ttag'; import { Alert, FormModal, Input } from '../../../components'; import { useLoading } from '../../../hooks'; interface Props { decryptedPurpose: Nullable<string>; onClose: () => void; onSubmit: (purpose: string) => Promise<void>; } const EditLinkModal = ({ decryptedPurpose, onClose, onSubmit, ...rest }: Props) => { const [purpose, setPurpose] = useState(decryptedPurpose || ''); const [isLoading, withLoading] = useLoading(); const handleSubmit = async () => { await onSubmit(purpose); onClose(); }; return ( <FormModal title={decryptedPurpose ? c('Info').t`Edit Label` : c('Info').t`Add Label`} onSubmit={() => withLoading(handleSubmit())} submit={c('Action').t`Save`} onClose={onClose} loading={isLoading} {...rest} > <Alert>{c('Info').t`Only you can see the labels.`}</Alert> <label htmlFor="your-calendar-url-label" className="sr-only"> {c('Label').t`Your calendar URL label`} </label> <Input id="your-calendar-url-label" maxLength={50} autoFocus value={purpose} onChange={({ target: { value } }) => setPurpose(value)} /> </FormModal> ); }; export default EditLinkModal;
import React, { useState } from 'react'; import { Nullable } from 'proton-shared/lib/interfaces/utils'; import { c } from 'ttag'; import { Alert, FormModal, Input } from '../../../components'; import { useLoading } from '../../../hooks'; interface Props { decryptedPurpose: Nullable<string>; onClose: () => void; onSubmit: (purpose: string) => Promise<void>; } const EditLinkModal = ({ decryptedPurpose, onClose, onSubmit, ...rest }: Props) => { const [purpose, setPurpose] = useState(decryptedPurpose || ''); const [isLoading, withLoading] = useLoading(); const handleSubmit = async () => { await onSubmit(purpose); onClose(); }; return ( <FormModal title={decryptedPurpose ? c('Info').t`Edit label` : c('Info').t`Add label`} onSubmit={() => withLoading(handleSubmit())} submit={c('Action').t`Save`} onClose={onClose} loading={isLoading} {...rest} > <Alert>{c('Info').t`Only you can see the labels.`}</Alert> <label htmlFor="your-calendar-url-label" className="sr-only"> {c('Label').t`Your calendar URL label`} </label> <Input id="your-calendar-url-label" maxLength={50} autoFocus value={purpose} onChange={({ target: { value } }) => setPurpose(value)} /> </FormModal> ); }; export default EditLinkModal;
Fix modal heading copy capitalization
Fix modal heading copy capitalization
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -22,7 +22,7 @@ return ( <FormModal - title={decryptedPurpose ? c('Info').t`Edit Label` : c('Info').t`Add Label`} + title={decryptedPurpose ? c('Info').t`Edit label` : c('Info').t`Add label`} onSubmit={() => withLoading(handleSubmit())} submit={c('Action').t`Save`} onClose={onClose}
b3fbdeff4ad2f343ed3244e6223c7ba676989f53
src/idbStorage.ts
src/idbStorage.ts
import { openDB, type IDBPDatabase } from 'idb'; export async function getDB() { const db = await openDB('pokeapi.js', 1, { async upgrade(db) { const objectStore = db.createObjectStore('cachedResources', { keyPath: 'cacheKey', }); objectStore.createIndex('whenCached', 'whenCached', { unique: false, }); await objectStore.transaction.done } }); return db; } export async function get(db: IDBPDatabase, cacheKey: string) { const tx = db.transaction('cachedResources', 'readonly'); const store = tx.store; return store.get(cacheKey); } export async function put(db: IDBPDatabase, cacheKey: string, data: any) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; const whenCached = Date.now(); return store.put({ cacheKey, whenCached, data, }) } export async function deleteKey(db: IDBPDatabase, cacheKey: string) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; return store.delete(cacheKey); }
import { openDB, type IDBPDatabase, type DBSchema } from 'idb'; interface CacheDBSchema extends DBSchema { cachedResources: { key: string; value: { cacheKey: string; whenCached: number; data: string; }; indexes: { whenCached: number } }; } export async function getDB() { const db = await openDB<CacheDBSchema>('pokeapi.js', 1, { async upgrade(db) { const objectStore = db.createObjectStore('cachedResources', { keyPath: 'cacheKey', }); objectStore.createIndex('whenCached', 'whenCached', { unique: false, }); await objectStore.transaction.done } }); return db; } export async function get(db: IDBPDatabase<CacheDBSchema>, cacheKey: string) { const tx = db.transaction('cachedResources', 'readonly'); const store = tx.store; return store.get(cacheKey); } export async function put(db: IDBPDatabase<CacheDBSchema>, cacheKey: string, data: string) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; const whenCached = Date.now(); return store.put({ cacheKey, whenCached, data, }) } export async function deleteKey(db: IDBPDatabase<CacheDBSchema>, cacheKey: string) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; return store.delete(cacheKey); }
Add more strict types to DB methods
Add more strict types to DB methods
TypeScript
apache-2.0
16patsle/pokeapi.js,16patsle/pokeapi.js
--- +++ @@ -1,7 +1,21 @@ -import { openDB, type IDBPDatabase } from 'idb'; +import { openDB, type IDBPDatabase, type DBSchema } from 'idb'; + +interface CacheDBSchema extends DBSchema { + cachedResources: { + key: string; + value: { + cacheKey: string; + whenCached: number; + data: string; + }; + indexes: { + whenCached: number + } + }; +} export async function getDB() { - const db = await openDB('pokeapi.js', 1, { + const db = await openDB<CacheDBSchema>('pokeapi.js', 1, { async upgrade(db) { const objectStore = db.createObjectStore('cachedResources', { keyPath: 'cacheKey', @@ -17,13 +31,13 @@ return db; } -export async function get(db: IDBPDatabase, cacheKey: string) { +export async function get(db: IDBPDatabase<CacheDBSchema>, cacheKey: string) { const tx = db.transaction('cachedResources', 'readonly'); const store = tx.store; return store.get(cacheKey); } -export async function put(db: IDBPDatabase, cacheKey: string, data: any) { +export async function put(db: IDBPDatabase<CacheDBSchema>, cacheKey: string, data: string) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; const whenCached = Date.now(); @@ -34,7 +48,7 @@ }) } -export async function deleteKey(db: IDBPDatabase, cacheKey: string) { +export async function deleteKey(db: IDBPDatabase<CacheDBSchema>, cacheKey: string) { const tx = db.transaction('cachedResources', 'readwrite'); const store = tx.store; return store.delete(cacheKey);
c7ca44a26878157abec91fc7989239c14117382e
test/ts/basics.ts
test/ts/basics.ts
import Cron from "croner"; // Test basic const test1 : Cron = new Cron("* * * * * *", () => { console.log("This will run every second."); }); // With options const test2 : Cron = new Cron("* * * * * *", { timezone: "Europe/Stockholm"}, () => { console.log("This will run every second."); }); // ISO string with options, without function. Plus const test3 : Cron = new Cron("2023-01-01T00:00:00", { timezone: "Europe/Stockholm"}); test3.schedule(() => { console.log("This will run every second."); }); test3.enumerate(10); test3.pause(); test3.resume(); test3.stop(); // Date without options AND scheduled function const test4 : Cron = new Cron(new Date(2023,0,1,0,0,0)); test4.stop();
import Cron from "../../"; // Test basic const test1 : Cron = new Cron("* * * * * *", () => { console.log("This will run every second."); }); // With options const test2 : Cron = new Cron("* * * * * *", { timezone: "Europe/Stockholm"}, () => { console.log("This will run every second."); }); // ISO string with options, without function. Plus const test3 : Cron = new Cron("2023-01-01T00:00:00", { timezone: "Europe/Stockholm"}); test3.schedule(() => { console.log("This will run every second."); }); test3.enumerate(10); test3.pause(); test3.resume(); test3.stop(); // Date without options AND scheduled function const test4 : Cron = new Cron(new Date(2023,0,1,0,0,0)); test4.stop();
Fix ts test self include
Fix ts test self include
TypeScript
mit
Hexagon/croner,Hexagon/croner
--- +++ @@ -1,4 +1,4 @@ -import Cron from "croner"; +import Cron from "../../"; // Test basic const test1 : Cron = new Cron("* * * * * *", () => {
0cd18df0b6d8a1109592efe1a535c5bafa0ca5bc
tools/env/test.ts
tools/env/test.ts
import {EnvConfig} from './env-config.interface'; const TestConfig: EnvConfig = { ENV: 'TEST', API: 'http://localhost:3000/api/n/songs' }; export = TestConfig;
import {EnvConfig} from './env-config.interface'; const TestConfig: EnvConfig = { ENV: 'TEST', API: 'http://localhost:3000/api/n/songs' // API: 'http://localhost:8080/namesandsongs/api/song' }; export = TestConfig;
Add path to java backend
Add path to java backend
TypeScript
mit
rweekers/voornameninliedjes-frontend,rweekers/voornameninliedjes-frontend
--- +++ @@ -3,6 +3,7 @@ const TestConfig: EnvConfig = { ENV: 'TEST', API: 'http://localhost:3000/api/n/songs' + // API: 'http://localhost:8080/namesandsongs/api/song' }; export = TestConfig;
a314254dca646c1108221b1a611a84e39b84943d
view/dom/dom.ts
view/dom/dom.ts
declare class WeakMap< Key , Value > { get( key : Key ) : Value set( key : Key , value : Value ) : this } namespace $ { export class $mol_view_dom extends $mol_object { static nodes = new ( WeakMap || $mol_dict )< $mol_view , Element >() static node( view : $mol_view ) { let node = $mol_view_dom.nodes.get( view ) if( !node ) { node = $mol_dom_make( { localName : view.dom_name() , namespaceURI : view.dom_name_space() , } ) $mol_view_dom.mount( view , node ) } return node } static mount( view : $mol_view , node : Element ) { $mol_view_dom.nodes.set( view , node ) $mol_dom_render( node , { id : view.toString() , attributes : view.attr_static() , events : view.event_wrapped() , } ) for( let plugin of view.plugins() ) { $mol_view_dom.nodes.set( plugin , node ) $mol_dom_render( node , { attributes : plugin.attr_static() , events : plugin.event_wrapped() , } ) } return node } } }
declare class WeakMap< Key , Value > { get( key : Key ) : Value set( key : Key , value : Value ) : this } namespace $ { export class $mol_view_dom extends $mol_object { static nodes = new ( WeakMap || $mol_dict )< $mol_view , Element >() static node( view : $mol_view ) { let node = $mol_view_dom.nodes.get( view ) if( !node ) { node = $mol_dom_make( { localName : view.dom_name() , namespaceURI : view.dom_name_space() , } ) $mol_view_dom.mount( view , node ) } return node } static mount( view : $mol_view , node : Element ) { $mol_view_dom.nodes.set( view , node ) $mol_dom_render( node , { id : view.toString() , attributes : view.attr_static() , events : view.event() , } ) for( let plugin of view.plugins() ) { $mol_view_dom.nodes.set( plugin , node ) $mol_dom_render( node , { attributes : plugin.attr_static() , events : plugin.event() , } ) } return node } } }
Disable atom task wrapping of all event handlers.
Disable atom task wrapping of all event handlers.
TypeScript
mit
nin-jin/mol,eigenmethod/mol,nin-jin/mol,eigenmethod/mol,nin-jin/mol,eigenmethod/mol
--- +++ @@ -30,7 +30,7 @@ node , { id : view.toString() , attributes : view.attr_static() , - events : view.event_wrapped() , + events : view.event() , } ) @@ -39,7 +39,7 @@ $mol_dom_render( node , { attributes : plugin.attr_static() , - events : plugin.event_wrapped() , + events : plugin.event() , } ) }
7f61513fed2b3dd2e653c76743fce4afa526dc24
src/datastore/constraint.ts
src/datastore/constraint.ts
export interface Constraint { value: string|string[]; type: string; // add | subtract } /** * Companion object */ export class Constraint { public static convertTo(constraint: Constraint|string|string[]): Constraint { return (Array.isArray(constraint) || typeof(constraint) == 'string') ? { value: constraint, type: 'add' } : constraint; } }
export interface Constraint { value: string|string[]; type: string; // add | subtract searchRecursively?: boolean; } export class Constraint { public static convertTo(constraint: Constraint|string|string[]): Constraint { return (Array.isArray(constraint) || typeof(constraint) == 'string') ? { value: constraint, type: 'add', searchRecursively: false } : constraint; } }
Extend Contraint with searchRecursively boolean
Extend Contraint with searchRecursively boolean
TypeScript
apache-2.0
dainst/idai-components-2,dainst/idai-components-2,dainst/idai-components-2
--- +++ @@ -1,18 +1,17 @@ export interface Constraint { + value: string|string[]; type: string; // add | subtract + searchRecursively?: boolean; } -/** - * Companion object - */ export class Constraint { public static convertTo(constraint: Constraint|string|string[]): Constraint { return (Array.isArray(constraint) || typeof(constraint) == 'string') - ? { value: constraint, type: 'add' } + ? { value: constraint, type: 'add', searchRecursively: false } : constraint; } }
d176a11222e1d650c848704c4c30d50ef3799f3c
modules/effects/src/actions.ts
modules/effects/src/actions.ts
import { Injectable, Inject } from '@angular/core'; import { Action, ScannedActionsSubject } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; import { Operator } from 'rxjs/Operator'; import { filter } from 'rxjs/operator/filter'; @Injectable() export class Actions<V = Action> extends Observable<V> { constructor(@Inject(ScannedActionsSubject) source?: Observable<V>) { super(); if (source) { this.source = source; } } lift<R>(operator: Operator<V, R>): Observable<R> { const observable = new Actions<R>(); observable.source = this; observable.operator = operator; return observable; } ofType(...allowedTypes: string[]): Actions { return filter.call(this, (action: Action) => allowedTypes.some(type => type === action.type), ); } }
import { Injectable, Inject } from '@angular/core'; import { Action, ScannedActionsSubject } from '@ngrx/store'; import { Observable } from 'rxjs/Observable'; import { Operator } from 'rxjs/Operator'; import { filter } from 'rxjs/operator/filter'; @Injectable() export class Actions<V = Action> extends Observable<V> { constructor(@Inject(ScannedActionsSubject) source?: Observable<V>) { super(); if (source) { this.source = source; } } lift<R>(operator: Operator<V, R>): Observable<R> { const observable = new Actions<R>(); observable.source = this; observable.operator = operator; return observable; } ofType(...allowedTypes: string[]): Actions<V> { return filter.call(this, (action: Action) => allowedTypes.some(type => type === action.type), ); } }
Use Actions generic type for the return of the ofType operator
fix(Effects): Use Actions generic type for the return of the ofType operator
TypeScript
mit
brandonroberts/platform,brandonroberts/platform,brandonroberts/platform,brandonroberts/platform
--- +++ @@ -21,7 +21,7 @@ return observable; } - ofType(...allowedTypes: string[]): Actions { + ofType(...allowedTypes: string[]): Actions<V> { return filter.call(this, (action: Action) => allowedTypes.some(type => type === action.type), );
244682c2b385fc94d316c31a3fa7a77b3aeb324d
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.10.0', RELEASEVERSION: '0.10.0' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.11.0', RELEASEVERSION: '0.11.0' }; export = BaseConfig;
Update release version to 0.11.0.
Update release version to 0.11.0.
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.10.0', - RELEASEVERSION: '0.10.0' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.11.0', + RELEASEVERSION: '0.11.0' }; export = BaseConfig;
a30f15021b73cee8e4b12dafb114798533f4e2f4
src/user/UsersService.ts
src/user/UsersService.ts
import { getFirst } from '@waldur/core/api'; import { $rootScope, ENV, $q } from '@waldur/core/services'; class UsersServiceClass { public currentUser; setCurrentUser(user) { // TODO: Migrate to Redux and make code DRY this.currentUser = user; return $rootScope.$broadcast('CURRENT_USER_UPDATED', { user }); } resetCurrentUser() { this.currentUser = undefined; } getCurrentUser() { if (this.currentUser) { return $q.when(this.currentUser); } return $q.when(getFirst('/users/', { current: '' })).then(user => { this.setCurrentUser(user); return user; }); } isCurrentUserValid() { return this.getCurrentUser().then(user => { return !this.mandatoryFieldsMissing(user) && user.agreement_date; }); } mandatoryFieldsMissing(user) { return ENV.userMandatoryFields.reduce( (result, item) => result || !user[item], false, ); } } export const UsersService = new UsersServiceClass();
import { getFirst, getById, patch } from '@waldur/core/api'; import { $rootScope, ENV, $q } from '@waldur/core/services'; class UsersServiceClass { public currentUser; get(userId) { return $q.when(getById('/users/', userId)); } update(user) { return $q.when(patch(`/users/${user.uuid}/`, user)); } setCurrentUser(user) { // TODO: Migrate to Redux and make code DRY this.currentUser = user; return $rootScope.$broadcast('CURRENT_USER_UPDATED', { user }); } resetCurrentUser() { this.currentUser = undefined; } getCurrentUser() { if (this.currentUser) { return $q.when(this.currentUser); } return $q.when(getFirst('/users/', { current: '' })).then(user => { this.setCurrentUser(user); return user; }); } isCurrentUserValid() { return this.getCurrentUser().then(user => { return !this.mandatoryFieldsMissing(user) && user.agreement_date; }); } mandatoryFieldsMissing(user) { return ENV.userMandatoryFields.reduce( (result, item) => result || !user[item], false, ); } } export const UsersService = new UsersServiceClass();
Add missing methods to users service.
Add missing methods to users service.
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -1,8 +1,16 @@ -import { getFirst } from '@waldur/core/api'; +import { getFirst, getById, patch } from '@waldur/core/api'; import { $rootScope, ENV, $q } from '@waldur/core/services'; class UsersServiceClass { public currentUser; + + get(userId) { + return $q.when(getById('/users/', userId)); + } + + update(user) { + return $q.when(patch(`/users/${user.uuid}/`, user)); + } setCurrentUser(user) { // TODO: Migrate to Redux and make code DRY
bb396ca1ac6843cec22ad2310b2575fe63eac959
src/main/io/settings-io.ts
src/main/io/settings-io.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. import * as fs from 'fs'; import SettingsSchema = Schemas.Settings; export class Settings { public defaultReader() { return JSON.parse(fs.readFileSync(`${process.cwd()}/build/assets/default.settings.json`, `utf-8`)); } public Reader() { return JSON.parse(fs.readFileSync(`${process.cwd()}/build/assets/settings.json`, `utf-8`)); } public Writer(settings: JSON): void { fs.writeFile(`${process.cwd()}/build/assets/settings.json`, JSON.stringify(settings)); } }
// 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. import * as fs from 'fs'; import {SettingsSchema} from '../../schemas/settings-schema'; export class Settings { public defaultReader() { return JSON.parse(fs.readFileSync(`${process.cwd()}/build/assets/default.settings.json`, `utf-8`)); } public Reader() { return JSON.parse(fs.readFileSync(`${process.cwd()}/build/assets/settings.json`, `utf-8`)); } public Writer(settings: JSON): void { fs.writeFile(`${process.cwd()}/build/assets/settings.json`, JSON.stringify(settings)); } }
Change references to Settings Schema
Change references to Settings Schema
TypeScript
apache-2.0
underdolphin/SoundRebuild,underdolphin/SoundRebuild,underdolphin/SoundRebuild
--- +++ @@ -13,7 +13,7 @@ // limitations under the License. import * as fs from 'fs'; -import SettingsSchema = Schemas.Settings; +import {SettingsSchema} from '../../schemas/settings-schema'; export class Settings { public defaultReader() {
31bab7edb0fdb6fd1598294a6dac637e6191cc43
app/src/ui/dialog/error.tsx
app/src/ui/dialog/error.tsx
import * as React from 'react' import * as classNames from 'classnames' import { Octicon, OcticonSymbol } from '../octicons' interface IDialogErrorProps { readonly className?: string } /** * A component used for displaying short error messages inline * in a dialog. These error messages (there can be more than one) * should be rendered as the first child of the <Dialog> component * and support arbitrary content. * * The content (error message) is paired with a stop icon and receive * special styling. * * Provide `children` to display content inside the error dialog. */ export class DialogError extends React.Component<IDialogErrorProps, {}> { public render() { const cn = classNames('dialog-error', this.props.className) return ( <div className={cn}> <Octicon symbol={OcticonSymbol.stop} /> <div>{this.props.children}</div> </div> ) } }
import * as React from 'react' import * as classNames from 'classnames' import { Octicon, OcticonSymbol } from '../octicons' interface IDialogErrorProps {} /** * A component used for displaying short error messages inline * in a dialog. These error messages (there can be more than one) * should be rendered as the first child of the <Dialog> component * and support arbitrary content. * * The content (error message) is paired with a stop icon and receive * special styling. * * Provide `children` to display content inside the error dialog. */ export class DialogError extends React.Component<IDialogErrorProps, {}> { public render() { return ( <div className="dialog-error"> <Octicon symbol={OcticonSymbol.stop} /> <div>{this.props.children}</div> </div> ) } }
Revert "Let DialogErrors have custom class names"
Revert "Let DialogErrors have custom class names" This reverts commit b9068f8e60f7b9d24097b5d3c0c495f5bba73f99.
TypeScript
mit
kactus-io/kactus,j-f1/forked-desktop,shiftkey/desktop,shiftkey/desktop,shiftkey/desktop,kactus-io/kactus,say25/desktop,artivilla/desktop,j-f1/forked-desktop,desktop/desktop,shiftkey/desktop,desktop/desktop,kactus-io/kactus,artivilla/desktop,desktop/desktop,kactus-io/kactus,say25/desktop,artivilla/desktop,j-f1/forked-desktop,j-f1/forked-desktop,desktop/desktop,artivilla/desktop,say25/desktop,say25/desktop
--- +++ @@ -2,9 +2,7 @@ import * as classNames from 'classnames' import { Octicon, OcticonSymbol } from '../octicons' -interface IDialogErrorProps { - readonly className?: string -} +interface IDialogErrorProps {} /** * A component used for displaying short error messages inline @@ -19,9 +17,8 @@ */ export class DialogError extends React.Component<IDialogErrorProps, {}> { public render() { - const cn = classNames('dialog-error', this.props.className) return ( - <div className={cn}> + <div className="dialog-error"> <Octicon symbol={OcticonSymbol.stop} /> <div>{this.props.children}</div> </div>
9e39b09203e25ee391783329ffa9eb442c248784
src/config/environment.dev.ts
src/config/environment.dev.ts
import { LanguageType } from 'store/reducers/locale/langugeType' export const environment = { firebase: { apiKey: 'AIzaSyDzFdZteXViq65uzFp4sAmesXk43uW_VfU', authDomain: 'react-social-86ea9.firebaseapp.com', databaseURL: 'https://react-social-86ea9.firebaseio.com', projectId: 'react-social-86ea9', storageBucket: 'react-social-86ea9.appspot.com', messagingSenderId: '760013286552', appId: '1:760013286552:web:4c9d52d1a2e0b824' }, settings: { enabledOAuthLogin: false, appName: 'Green', defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57', defaultLanguage: LanguageType.English }, theme: { primaryColor: '#00b1b3', secondaryColor: '#4d545d' } }
import { LanguageType } from 'store/reducers/locale/langugeType' export const environment = { firebase: { apiKey: 'AIzaSyAHOZ7rWGDODCwJMB3WIt63CAIa90qI-jg', authDomain: 'test-4515a.firebaseapp.com', databaseURL: 'https://test-4515a.firebaseio.com', projectId: 'test-4515a', storageBucket: 'test-4515a.appspot.com', messagingSenderId: '964743099489' }, settings: { enabledOAuthLogin: true, appName: 'Green', defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57', defaultLanguage: LanguageType.English }, theme: { primaryColor: '#00b1b3', secondaryColor: '#4d545d' } }
Revert back to original settings
Revert back to original settings
TypeScript
mit
Qolzam/react-social-network,Qolzam/react-social-network,Qolzam/react-social-network
--- +++ @@ -2,16 +2,15 @@ export const environment = { firebase: { - apiKey: 'AIzaSyDzFdZteXViq65uzFp4sAmesXk43uW_VfU', - authDomain: 'react-social-86ea9.firebaseapp.com', - databaseURL: 'https://react-social-86ea9.firebaseio.com', - projectId: 'react-social-86ea9', - storageBucket: 'react-social-86ea9.appspot.com', - messagingSenderId: '760013286552', - appId: '1:760013286552:web:4c9d52d1a2e0b824' + apiKey: 'AIzaSyAHOZ7rWGDODCwJMB3WIt63CAIa90qI-jg', + authDomain: 'test-4515a.firebaseapp.com', + databaseURL: 'https://test-4515a.firebaseio.com', + projectId: 'test-4515a', + storageBucket: 'test-4515a.appspot.com', + messagingSenderId: '964743099489' }, settings: { - enabledOAuthLogin: false, + enabledOAuthLogin: true, appName: 'Green', defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57', defaultLanguage: LanguageType.English
f452e806b7bb1e8d776f95b8531cb598841e3bd0
src/rest-api/trainer/trainerMockData.ts
src/rest-api/trainer/trainerMockData.ts
import {EditTrainingSummary} from '../../model/editTrainingSummary'; export const trainingContentMockData: EditTrainingSummary[] = [ { id: 1, content: 'This is a test markdown sample using # H1', }, { id: 2, content: 'This is a test markdown sample using a **bold text**', }, ];
import {EditTrainingSummary} from '../../model/editTrainingSummary'; export const trainingContentMockData: EditTrainingSummary[] = [ { id: 1, content: ` ## Login ![login](https://raw.githubusercontent.com/wiki/MasterLemon2016/LeanMood/blob/leLogin.png) ## Lecturers trainings ![trainings](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leLecturerTrainings.png) ## Training Dashboard ![dashboard](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leTrainingDashboard.png) ## Main Toc Raw ![Main toc raw](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leMainTocRaw.png) ## Main Toc Preview ![Main toc preview](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leMainToc%20Preview.png) ## Upload File This ui mock needs an update: - It should follow the panel approach (no modal dialog). - It should display a list of files already uploaded where the user can pick or let the user upload a new file. ![upload](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leUpload%20file.png) ## Add delivery This ui mock needs an update: - It should display a list of delveries already defined, and let the user create a new one if needed. ![Add Delivery](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leAddDelivery.png) ## Evaluate delivery ![Evaluate Delivery](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leEvaluate.png) `, }, { id: 2, content: 'This is a test markdown sample using a **bold text**', }, ];
Replace mock training content by big one readme
Replace mock training content by big one readme
TypeScript
mit
MasterLemon2016/LeanMood,Lemoncode/LeanMood,Lemoncode/LeanMood,Lemoncode/LeanMood,MasterLemon2016/LeanMood,MasterLemon2016/LeanMood
--- +++ @@ -3,7 +3,48 @@ export const trainingContentMockData: EditTrainingSummary[] = [ { id: 1, - content: 'This is a test markdown sample using # H1', + content: ` +## Login + +![login](https://raw.githubusercontent.com/wiki/MasterLemon2016/LeanMood/blob/leLogin.png) + +## Lecturers trainings + +![trainings](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leLecturerTrainings.png) + +## Training Dashboard + +![dashboard](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leTrainingDashboard.png) + +## Main Toc Raw + +![Main toc raw](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leMainTocRaw.png) + +## Main Toc Preview + +![Main toc preview](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leMainToc%20Preview.png) + +## Upload File + +This ui mock needs an update: + +- It should follow the panel approach (no modal dialog). +- It should display a list of files already uploaded where the user can pick or let the user upload a new file. + +![upload](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leUpload%20file.png) + +## Add delivery + +This ui mock needs an update: + +- It should display a list of delveries already defined, and let the user create a new one if needed. + +![Add Delivery](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leAddDelivery.png) + +## Evaluate delivery + +![Evaluate Delivery](https://github.com/MasterLemon2016/LeanMood/wiki/blob/leEvaluate.png) + `, }, { id: 2,
e99f2bcd8b3c091af57aeaf615c7cfff39c02f43
src/ui/components/Link.tsx
src/ui/components/Link.tsx
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import styled from 'react-emotion'; import {colors} from './colors'; import {Component} from 'react'; import {shell} from 'electron'; import React from 'react'; const StyledLink = styled('span')({ color: colors.highlight, '&:hover': { cursor: 'pointer', textDecoration: 'underline', }, }); StyledLink.displayName = 'Link:StyledLink'; export default class Link extends Component<{ href: string; children?: React.ReactNode; }> { onClick = () => { shell.openExternal(this.props.href); }; render() { return ( <StyledLink onClick={this.onClick}>{this.props.children}</StyledLink> ); } }
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import styled from 'react-emotion'; import {colors} from './colors'; import {Component} from 'react'; import {shell} from 'electron'; import React from 'react'; const StyledLink = styled('span')({ color: colors.highlight, '&:hover': { cursor: 'pointer', textDecoration: 'underline', }, }); StyledLink.displayName = 'Link:StyledLink'; export default class Link extends Component<{ href: string; children?: React.ReactNode; }> { onClick = () => { shell.openExternal(this.props.href); }; render() { return ( <StyledLink onClick={this.onClick}> {this.props.children || this.props.href} </StyledLink> ); } }
Apply styling to support details form
Apply styling to support details form Summary: Applies some additional styling to the support details form, and implemented the screenshot / video styling. Probably needs some more fixes in the future, once we have a real report to import :) Reviewed By: jknoxville Differential Revision: D18658388 fbshipit-source-id: dc9207ec08b3f4360c96d8d14980710c57d6b5ec
TypeScript
mit
facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper
--- +++ @@ -32,7 +32,9 @@ render() { return ( - <StyledLink onClick={this.onClick}>{this.props.children}</StyledLink> + <StyledLink onClick={this.onClick}> + {this.props.children || this.props.href} + </StyledLink> ); } }