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
|
---|---|---|---|---|---|---|---|---|---|---|
008ae8a0a70f09f43d328d0ab39e58e86946e32f | lib/core-events/src/index.ts | lib/core-events/src/index.ts | export interface CoreEvents {
CHANNEL_CREATED: string;
GET_CURRENT_STORY: string;
SET_CURRENT_STORY: string;
GET_STORIES: string;
SET_STORIES: string;
SELECT_STORY: string;
APPLY_SHORTCUT: string;
STORY_ADDED: string;
FORCE_RE_RENDER: string;
REGISTER_SUBSCRIPTION: string;
STORY_RENDERED: string;
STORY_ERRORED: string;
STORY_THREW_EXCEPTION: string;
}
const events: CoreEvents = {
CHANNEL_CREATED: 'channelCreated',
GET_CURRENT_STORY: 'getCurrentStory',
SET_CURRENT_STORY: 'setCurrentStory',
GET_STORIES: 'getStories',
SET_STORIES: 'setStories',
SELECT_STORY: 'selectStory',
APPLY_SHORTCUT: 'applyShortcut',
STORY_ADDED: 'storyAdded',
FORCE_RE_RENDER: 'forceReRender',
REGISTER_SUBSCRIPTION: 'registerSubscription',
STORY_RENDERED: 'storyRendered',
STORY_ERRORED: 'storyErrored',
STORY_THREW_EXCEPTION: 'storyThrewException',
};
export default events;
| enum events {
CHANNEL_CREATED = 'channelCreated',
GET_CURRENT_STORY = 'getCurrentStory',
SET_CURRENT_STORY = 'setCurrentStory',
GET_STORIES = 'getStories',
SET_STORIES = 'setStories',
SELECT_STORY = 'selectStory',
APPLY_SHORTCUT = 'applyShortcut',
STORY_ADDED = 'storyAdded',
FORCE_RE_RENDER = 'forceReRender',
REGISTER_SUBSCRIPTION = 'registerSubscription',
STORY_RENDERED = 'storyRendered',
STORY_ERRORED = 'storyErrored',
STORY_THREW_EXCEPTION = 'storyThrewException',
}
export default events;
| Use an enum instead of an interface for core events | Use an enum instead of an interface for core events
| TypeScript | mit | storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook | ---
+++
@@ -1,33 +1,17 @@
-export interface CoreEvents {
- CHANNEL_CREATED: string;
- GET_CURRENT_STORY: string;
- SET_CURRENT_STORY: string;
- GET_STORIES: string;
- SET_STORIES: string;
- SELECT_STORY: string;
- APPLY_SHORTCUT: string;
- STORY_ADDED: string;
- FORCE_RE_RENDER: string;
- REGISTER_SUBSCRIPTION: string;
- STORY_RENDERED: string;
- STORY_ERRORED: string;
- STORY_THREW_EXCEPTION: string;
+enum events {
+ CHANNEL_CREATED = 'channelCreated',
+ GET_CURRENT_STORY = 'getCurrentStory',
+ SET_CURRENT_STORY = 'setCurrentStory',
+ GET_STORIES = 'getStories',
+ SET_STORIES = 'setStories',
+ SELECT_STORY = 'selectStory',
+ APPLY_SHORTCUT = 'applyShortcut',
+ STORY_ADDED = 'storyAdded',
+ FORCE_RE_RENDER = 'forceReRender',
+ REGISTER_SUBSCRIPTION = 'registerSubscription',
+ STORY_RENDERED = 'storyRendered',
+ STORY_ERRORED = 'storyErrored',
+ STORY_THREW_EXCEPTION = 'storyThrewException',
}
-const events: CoreEvents = {
- CHANNEL_CREATED: 'channelCreated',
- GET_CURRENT_STORY: 'getCurrentStory',
- SET_CURRENT_STORY: 'setCurrentStory',
- GET_STORIES: 'getStories',
- SET_STORIES: 'setStories',
- SELECT_STORY: 'selectStory',
- APPLY_SHORTCUT: 'applyShortcut',
- STORY_ADDED: 'storyAdded',
- FORCE_RE_RENDER: 'forceReRender',
- REGISTER_SUBSCRIPTION: 'registerSubscription',
- STORY_RENDERED: 'storyRendered',
- STORY_ERRORED: 'storyErrored',
- STORY_THREW_EXCEPTION: 'storyThrewException',
-};
-
export default events; |
7ae13f712bb81fc94f422e5833af4aa55b3a0cd8 | src/Parsing/Inline/Tokenization/Brackets.ts | src/Parsing/Inline/Tokenization/Brackets.ts | import { Bracket } from './Bracket'
// Many of our conventions incorporate brackets. These are the ones we recognize.
export const BRACKETS = [
new Bracket('(', ')'),
new Bracket('[', ']'),
new Bracket('{', '}')
]
| import { Bracket } from './Bracket'
// Many of our conventions incorporate brackets. These are the ones we recognize.
export const BRACKETS = [
new Bracket('(', ')'),
new Bracket('[', ']'),
]
| Stop supporting curly brackets; fail many tests | Stop supporting curly brackets; fail many tests
| TypeScript | mit | start/up,start/up | ---
+++
@@ -5,5 +5,4 @@
export const BRACKETS = [
new Bracket('(', ')'),
new Bracket('[', ']'),
- new Bracket('{', '}')
] |
6c2b10c82ae7712e11c3e8ea5e0b8938369214e4 | src/components/ticker/reducer.ts | src/components/ticker/reducer.ts | import { generateReducer } from "../generate_reducer";
import { TickerState } from "./interfaces";
let YELLOW = "#fd6",
RED = "#e66",
GREEN = "#6a4";
function change(color: string, message: string, show = true) {
return (s, a) => ({ color, message, show });
}
export let tickerReducer = generateReducer<TickerState>({
message: "Please log in",
color: "gray",
show: true
})
.add<{}>("LOGIN_OK", change(YELLOW, "Logged in"))
.add<{}>("LOGIN_ERR", change(RED, "Bad login"))
.add<{}>("FETCH_PLANTS_START", change(YELLOW, "Fetching plants"))
.add<{}>("FETCH_PLANTS_OK", change(YELLOW, "Done fetching plants"))
.add<{}>("FETCH_PLANTS_ERR", change(RED, "Plant fetch error"))
.add<{}>("FETCH_SEQUENCES_OK", change(GREEN, "Done fetching sequences"))
.add<{}>("READ_STATUS_OK", change(GREEN, "Bot status OK"))
.add<{}>("FETCH_DEVICE_ERR", change(RED, "Message server offline?"))
.add<{}>("READ_STATUS_ERR", change(RED, "Bot offline?"))
.add<{}>("BOT_NOTIFICATION", change(GREEN, "Bot OK"))
.add<{}>("COMMAND_OK", change(GREEN, "Sent message OK"));
| import { generateReducer } from "../generate_reducer";
import { TickerState } from "./interfaces";
let YELLOW = "#fd6",
RED = "#e66",
GREEN = "#6a4";
function change(color: string, message: string, show = true) {
return (s, a) => ({ color, message, show });
}
export let tickerReducer = generateReducer<TickerState>({
message: "Please log in",
color: "gray",
show: true
})
.add<{}>("LOGIN_OK", change(YELLOW, "Logged in"))
.add<{}>("LOGIN_ERR", change(RED, "Bad login"))
.add<{}>("FETCH_PLANTS_START", change(YELLOW, "Fetching plants"))
.add<{}>("FETCH_PLANTS_OK", change(GREEN, "Done fetching plants"))
.add<{}>("FETCH_PLANTS_ERR", change(RED, "Plant fetch error"))
.add<{}>("FETCH_SEQUENCES_OK", change(GREEN, "Done fetching sequences"))
.add<{}>("READ_STATUS_OK", change(GREEN, "Bot status OK"))
.add<{}>("FETCH_DEVICE_ERR", change(RED, "Message server offline?"))
.add<{}>("READ_STATUS_ERR", change(RED, "Bot offline?"))
.add<{}>("BOT_NOTIFICATION", change(GREEN, "Bot OK"))
.add<{}>("COMMAND_OK", change(GREEN, "Sent message OK"));
| Fix icon color on plant fetch | Fix icon color on plant fetch
| TypeScript | mit | MrChristofferson/farmbot-web-frontend,roryaronson/farmbot-web-frontend,roryaronson/farmbot-web-frontend,FarmBot/farmbot-web-frontend,MrChristofferson/farmbot-web-frontend,FarmBot/farmbot-web-frontend,roryaronson/farmbot-web-frontend,RickCarlino/farmbot-web-frontend,RickCarlino/farmbot-web-frontend | ---
+++
@@ -17,7 +17,7 @@
.add<{}>("LOGIN_OK", change(YELLOW, "Logged in"))
.add<{}>("LOGIN_ERR", change(RED, "Bad login"))
.add<{}>("FETCH_PLANTS_START", change(YELLOW, "Fetching plants"))
-.add<{}>("FETCH_PLANTS_OK", change(YELLOW, "Done fetching plants"))
+.add<{}>("FETCH_PLANTS_OK", change(GREEN, "Done fetching plants"))
.add<{}>("FETCH_PLANTS_ERR", change(RED, "Plant fetch error"))
.add<{}>("FETCH_SEQUENCES_OK", change(GREEN, "Done fetching sequences"))
.add<{}>("READ_STATUS_OK", change(GREEN, "Bot status OK")) |
5e788f0da48a13dae08b09ca8156a92f0884795d | src/daemons/notes-stats.ts | src/daemons/notes-stats.ts | import * as childProcess from 'child_process';
import Xev from 'xev';
const ev = new Xev();
export default function() {
const log: any[] = [];
const p = childProcess.fork(__dirname + '/notes-stats-child.js');
p.on('message', stats => {
ev.emit('notesStats', stats);
log.push(stats);
if (log.length > 100) log.shift();
});
ev.on('requestNotesStatsLog', id => {
ev.emit('notesStatsLog:' + id, log);
});
}
| import * as childProcess from 'child_process';
import Xev from 'xev';
const ev = new Xev();
export default function () {
const log: any[] = [];
const p = childProcess.fork(__dirname + '/notes-stats-child.js');
p.on('message', stats => {
ev.emit('notesStats', stats);
log.push(stats);
if (log.length > 100) log.shift();
});
ev.on('requestNotesStatsLog', id => {
ev.emit('notesStatsLog:' + id, log);
});
process.on('exit', code => {
process.kill(p.pid);
});
}
| Kill child process on exit | Kill child process on exit
| TypeScript | mit | ha-dai/Misskey,Tosuke/misskey,Tosuke/misskey,Tosuke/misskey,syuilo/Misskey,Tosuke/misskey,Tosuke/misskey,syuilo/Misskey,ha-dai/Misskey | ---
+++
@@ -3,7 +3,7 @@
const ev = new Xev();
-export default function() {
+export default function () {
const log: any[] = [];
const p = childProcess.fork(__dirname + '/notes-stats-child.js');
@@ -17,4 +17,9 @@
ev.on('requestNotesStatsLog', id => {
ev.emit('notesStatsLog:' + id, log);
});
+
+ process.on('exit', code => {
+ process.kill(p.pid);
+ });
+
} |
76fda1f3b1fd4028f03bb726cd15823804493dd3 | skin-deep.d.ts | skin-deep.d.ts | import { ReactElement, ComponentClass } from 'react';
export type Selector = string | ComponentClass<{}>;
export type Matcher = any;
export interface Tree<P, C> {
type: ComponentClass<P> | string;
props: P;
reRender(props: P, context?: C): void;
getMountedInstance(): Object;
subTree(query: Selector, predicate?: Matcher): Tree<any, any>;
everySubTree(query: Selector, predicate?: Matcher): Tree<any, any>[];
dive(paths: Selector[]): Tree<any, {}>;
dive<C>(paths: Selector[], context: C): Tree<any, C>;
text(): string;
getRenderOutput(): ReactElement<P>;
toString(): string;
}
export function shallowRender<P>(element: ReactElement<P>|JSX.Element): Tree<P, {}>;
export function shallowRender<P, C>(element: ReactElement<P>|JSX.Element, context: C): Tree<P, C>;
export function hasClass(node: JSX.Element, cls: string): boolean;
| import { ReactElement, ComponentClass } from 'react';
export type Selector = string | ComponentClass<{}>;
export type Matcher = any;
export interface Tree<P, C> {
type: ComponentClass<P> | string;
props: P;
reRender(props: P, context?: C): void;
getMountedInstance(): any;
subTree(query: Selector, predicate?: Matcher): Tree<any, C>;
everySubTree(query: Selector, predicate?: Matcher): Tree<any, C>[];
dive(paths: Selector[]): Tree<any, {}>;
dive<C>(paths: Selector[], context: C): Tree<any, C>;
text(): string;
getRenderOutput(): ReactElement<P>;
toString(): string;
}
export function shallowRender<P>(element: ReactElement<P>|JSX.Element): Tree<P, {}>;
export function shallowRender<P, C>(element: ReactElement<P>|JSX.Element, context: C): Tree<P, C>;
export function hasClass(node: JSX.Element, cls: string): boolean;
| Improve sub tree context type | Improve sub tree context type
| TypeScript | mit | glenjamin/skin-deep,glenjamin/skin-deep | ---
+++
@@ -7,9 +7,9 @@
type: ComponentClass<P> | string;
props: P;
reRender(props: P, context?: C): void;
- getMountedInstance(): Object;
- subTree(query: Selector, predicate?: Matcher): Tree<any, any>;
- everySubTree(query: Selector, predicate?: Matcher): Tree<any, any>[];
+ getMountedInstance(): any;
+ subTree(query: Selector, predicate?: Matcher): Tree<any, C>;
+ everySubTree(query: Selector, predicate?: Matcher): Tree<any, C>[];
dive(paths: Selector[]): Tree<any, {}>;
dive<C>(paths: Selector[], context: C): Tree<any, C>;
text(): string; |
c16f51e232204e064aa8d1888d5294575ddcf628 | src/monaco/ShellHistoryLanguage.ts | src/monaco/ShellHistoryLanguage.ts | import {services} from "../services/index";
import * as _ from "lodash";
monaco.languages.setMonarchTokensProvider("shell", {
tokenizer: {
root: [
{
regex: /.+/,
action: {token: "history-item"},
},
],
},
tokenPostfix: ".shell-history",
});
monaco.languages.register({
id: "shell-history",
});
monaco.languages.registerCompletionItemProvider("shell-history", {
triggerCharacters: [" ", "/"],
provideCompletionItems: () => {
return {
isIncomplete: false,
items: _.uniq(services.history.all.map(record => record.command)).reverse().map(command => ({
label: command,
kind: monaco.languages.CompletionItemKind.Value,
})),
};
},
});
| import {services} from "../services/index";
import * as _ from "lodash";
monaco.languages.setMonarchTokensProvider("shell-history", {
tokenizer: {
root: [
{
regex: /.+/,
action: {token: "history-item"},
},
],
},
tokenPostfix: ".shell-history",
});
monaco.languages.register({
id: "shell-history",
});
monaco.languages.registerCompletionItemProvider("shell-history", {
triggerCharacters: [" ", "/"],
provideCompletionItems: () => {
return {
isIncomplete: false,
items: _.uniq(services.history.all.map(record => record.command)).reverse().map(command => ({
label: command,
kind: monaco.languages.CompletionItemKind.Value,
})),
};
},
});
| Fix the issue with shell-history provider. | Fix the issue with shell-history provider.
| TypeScript | mit | black-screen/black-screen,vshatskyi/black-screen,shockone/black-screen,vshatskyi/black-screen,railsware/upterm,shockone/black-screen,vshatskyi/black-screen,black-screen/black-screen,vshatskyi/black-screen,black-screen/black-screen,railsware/upterm | ---
+++
@@ -1,7 +1,7 @@
import {services} from "../services/index";
import * as _ from "lodash";
-monaco.languages.setMonarchTokensProvider("shell", {
+monaco.languages.setMonarchTokensProvider("shell-history", {
tokenizer: {
root: [
{ |
4f8425580accc61defad55e2abb3f8ffd0773f91 | highlightjs/highlightjs-tests.ts | highlightjs/highlightjs-tests.ts | /*
highlight.js definition by Niklas Mollenhauer
Last Update: 10.09.2013
Source Code: https://github.com/isagalaev/highlight.js
Project Page: http://softwaremaniacs.org/soft/highlight/en/
*/
/// <reference path="highlightjs.d.ts" />
import hljs = require("highlight.js");
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
hljs.tabReplace = " "; // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value; | /*
highlight.js definition by Niklas Mollenhauer
Last Update: 10.09.2013
Source Code: https://github.com/isagalaev/highlight.js
Project Page: http://softwaremaniacs.org/soft/highlight/en/
*/
/// <reference path="highlightjs.d.ts" />
import hljs = require("highlight.js");
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
hljs.configure({ tabReplace: " " }) // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value;
| Change highlight.js test for v8.x.x interface | Change highlight.js test for v8.x.x interface
| TypeScript | mit | raijinsetsu/DefinitelyTyped,MarlonFan/DefinitelyTyped,shlomiassaf/DefinitelyTyped,wilfrem/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,AgentME/DefinitelyTyped,stacktracejs/DefinitelyTyped,uestcNaldo/DefinitelyTyped,jraymakers/DefinitelyTyped,newclear/DefinitelyTyped,evansolomon/DefinitelyTyped,jsaelhof/DefinitelyTyped,innerverse/DefinitelyTyped,teddyward/DefinitelyTyped,Zorgatone/DefinitelyTyped,stanislavHamara/DefinitelyTyped,philippstucki/DefinitelyTyped,haskellcamargo/DefinitelyTyped,bpowers/DefinitelyTyped,musakarakas/DefinitelyTyped,greglo/DefinitelyTyped,dariajung/DefinitelyTyped,yuit/DefinitelyTyped,takfjt/DefinitelyTyped,magny/DefinitelyTyped,acepoblete/DefinitelyTyped,tan9/DefinitelyTyped,angelobelchior8/DefinitelyTyped,newclear/DefinitelyTyped,kalloc/DefinitelyTyped,PascalSenn/DefinitelyTyped,amir-arad/DefinitelyTyped,YousefED/DefinitelyTyped,mrk21/DefinitelyTyped,applesaucers/lodash-invokeMap,opichals/DefinitelyTyped,amanmahajan7/DefinitelyTyped,muenchdo/DefinitelyTyped,spearhead-ea/DefinitelyTyped,olemp/DefinitelyTyped,lightswitch05/DefinitelyTyped,ducin/DefinitelyTyped,TildaLabs/DefinitelyTyped,syuilo/DefinitelyTyped,arusakov/DefinitelyTyped,UzEE/DefinitelyTyped,teves-castro/DefinitelyTyped,vagarenko/DefinitelyTyped,rcchen/DefinitelyTyped,giggio/DefinitelyTyped,nobuoka/DefinitelyTyped,mweststrate/DefinitelyTyped,aqua89/DefinitelyTyped,florentpoujol/DefinitelyTyped,duongphuhiep/DefinitelyTyped,applesaucers/lodash-invokeMap,superduper/DefinitelyTyped,fearthecowboy/DefinitelyTyped,gandjustas/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,sixinli/DefinitelyTyped,Bobjoy/DefinitelyTyped,abbasmhd/DefinitelyTyped,grahammendick/DefinitelyTyped,vsavkin/DefinitelyTyped,DeadAlready/DefinitelyTyped,xica/DefinitelyTyped,teves-castro/DefinitelyTyped,Mek7/DefinitelyTyped,rcchen/DefinitelyTyped,glenndierckx/DefinitelyTyped,Karabur/DefinitelyTyped,maxlang/DefinitelyTyped,shlomiassaf/DefinitelyTyped,alvarorahul/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,cvrajeesh/DefinitelyTyped,smrq/DefinitelyTyped,laco0416/DefinitelyTyped,samwgoldman/DefinitelyTyped,aldo-roman/DefinitelyTyped,benliddicott/DefinitelyTyped,abner/DefinitelyTyped,chocolatechipui/DefinitelyTyped,zuzusik/DefinitelyTyped,onecentlin/DefinitelyTyped,HPFOD/DefinitelyTyped,manekovskiy/DefinitelyTyped,jraymakers/DefinitelyTyped,behzad88/DefinitelyTyped,scriby/DefinitelyTyped,shovon/DefinitelyTyped,mwain/DefinitelyTyped,bjfletcher/DefinitelyTyped,pwelter34/DefinitelyTyped,bobslaede/DefinitelyTyped,bluong/DefinitelyTyped,Shiak1/DefinitelyTyped,behzad888/DefinitelyTyped,tgfjt/DefinitelyTyped,syuilo/DefinitelyTyped,modifyink/DefinitelyTyped,jesseschalken/DefinitelyTyped,goaty92/DefinitelyTyped,EnableSoftware/DefinitelyTyped,tan9/DefinitelyTyped,lseguin42/DefinitelyTyped,tarruda/DefinitelyTyped,dmoonfire/DefinitelyTyped,hellopao/DefinitelyTyped,laball/DefinitelyTyped,minodisk/DefinitelyTyped,gandjustas/DefinitelyTyped,pocesar/DefinitelyTyped,sledorze/DefinitelyTyped,martinduparc/DefinitelyTyped,Jwsonic/DefinitelyTyped,EnableSoftware/DefinitelyTyped,evandrewry/DefinitelyTyped,lukehoban/DefinitelyTyped,chrootsu/DefinitelyTyped,brainded/DefinitelyTyped,olemp/DefinitelyTyped,ashwinr/DefinitelyTyped,QuatroCode/DefinitelyTyped,bdoss/DefinitelyTyped,davidpricedev/DefinitelyTyped,the41/DefinitelyTyped,YousefED/DefinitelyTyped,PopSugar/DefinitelyTyped,adamcarr/DefinitelyTyped,duncanmak/DefinitelyTyped,magny/DefinitelyTyped,michalczukm/DefinitelyTyped,bkristensen/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,philippsimon/DefinitelyTyped,Ptival/DefinitelyTyped,elisee/DefinitelyTyped,optical/DefinitelyTyped,eugenpodaru/DefinitelyTyped,alvarorahul/DefinitelyTyped,Saneyan/DefinitelyTyped,dsebastien/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,pocesar/DefinitelyTyped,leoromanovsky/DefinitelyTyped,hatz48/DefinitelyTyped,scatcher/DefinitelyTyped,ryan10132/DefinitelyTyped,hesselink/DefinitelyTyped,stephenjelfs/DefinitelyTyped,gcastre/DefinitelyTyped,timramone/DefinitelyTyped,hor-crux/DefinitelyTyped,RX14/DefinitelyTyped,chrismbarr/DefinitelyTyped,nakakura/DefinitelyTyped,hiraash/DefinitelyTyped,bruennijs/DefinitelyTyped,subash-a/DefinitelyTyped,arcticwaters/DefinitelyTyped,gildorwang/DefinitelyTyped,glenndierckx/DefinitelyTyped,icereed/DefinitelyTyped,stacktracejs/DefinitelyTyped,wkrueger/DefinitelyTyped,billccn/DefinitelyTyped,reppners/DefinitelyTyped,Chris380/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,vpineda1996/DefinitelyTyped,wcomartin/DefinitelyTyped,abner/DefinitelyTyped,Garciat/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,syntax42/DefinitelyTyped,jimthedev/DefinitelyTyped,TheBay0r/DefinitelyTyped,drinchev/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,georgemarshall/DefinitelyTyped,sledorze/DefinitelyTyped,davidpricedev/DefinitelyTyped,mvarblow/DefinitelyTyped,darkl/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,alexdresko/DefinitelyTyped,samdark/DefinitelyTyped,tscho/DefinitelyTyped,schmuli/DefinitelyTyped,one-pieces/DefinitelyTyped,JaminFarr/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,johan-gorter/DefinitelyTyped,sandersky/DefinitelyTyped,zuohaocheng/DefinitelyTyped,Trapulo/DefinitelyTyped,chrilith/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,bilou84/DefinitelyTyped,miguelmq/DefinitelyTyped,kanreisa/DefinitelyTyped,aindlq/DefinitelyTyped,jeffbcross/DefinitelyTyped,kabogo/DefinitelyTyped,chrismbarr/DefinitelyTyped,nitintutlani/DefinitelyTyped,psnider/DefinitelyTyped,jimthedev/DefinitelyTyped,benishouga/DefinitelyTyped,Dominator008/DefinitelyTyped,HereSinceres/DefinitelyTyped,xswordsx/DefinitelyTyped,shahata/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,nodeframe/DefinitelyTyped,mjjames/DefinitelyTyped,smrq/DefinitelyTyped,HPFOD/DefinitelyTyped,progre/DefinitelyTyped,vincentw56/DefinitelyTyped,jaysoo/DefinitelyTyped,psnider/DefinitelyTyped,Dominator008/DefinitelyTyped,bdoss/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,igorraush/DefinitelyTyped,amanmahajan7/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,daptiv/DefinitelyTyped,hatz48/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,Almouro/DefinitelyTyped,arma-gast/DefinitelyTyped,mhegazy/DefinitelyTyped,erosb/DefinitelyTyped,danfma/DefinitelyTyped,trystanclarke/DefinitelyTyped,gdi2290/DefinitelyTyped,WritingPanda/DefinitelyTyped,musicist288/DefinitelyTyped,stephenjelfs/DefinitelyTyped,UzEE/DefinitelyTyped,Litee/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,jacqt/DefinitelyTyped,benishouga/DefinitelyTyped,shiwano/DefinitelyTyped,alexdresko/DefinitelyTyped,minodisk/DefinitelyTyped,axelcostaspena/DefinitelyTyped,ciriarte/DefinitelyTyped,drillbits/DefinitelyTyped,subash-a/DefinitelyTyped,Zorgatone/DefinitelyTyped,ErykB2000/DefinitelyTyped,jsaelhof/DefinitelyTyped,subjectix/DefinitelyTyped,damianog/DefinitelyTyped,blink1073/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,rerezz/DefinitelyTyped,Riron/DefinitelyTyped,hellopao/DefinitelyTyped,masonkmeyer/DefinitelyTyped,martinduparc/DefinitelyTyped,mszczepaniak/DefinitelyTyped,bennett000/DefinitelyTyped,theyelllowdart/DefinitelyTyped,georgemarshall/DefinitelyTyped,nakakura/DefinitelyTyped,OpenMaths/DefinitelyTyped,omidkrad/DefinitelyTyped,trystanclarke/DefinitelyTyped,georgemarshall/DefinitelyTyped,brentonhouse/DefinitelyTyped,tgfjt/DefinitelyTyped,jimthedev/DefinitelyTyped,gyohk/DefinitelyTyped,alextkachman/DefinitelyTyped,Pipe-shen/DefinitelyTyped,RX14/DefinitelyTyped,corps/DefinitelyTyped,behzad888/DefinitelyTyped,lbguilherme/DefinitelyTyped,musically-ut/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,RedSeal-co/DefinitelyTyped,algorithme/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,pkhayundi/DefinitelyTyped,aciccarello/DefinitelyTyped,munxar/DefinitelyTyped,adammartin1981/DefinitelyTyped,schmuli/DefinitelyTyped,mcrawshaw/DefinitelyTyped,mendix/DefinitelyTyped,markogresak/DefinitelyTyped,takenet/DefinitelyTyped,moonpyk/DefinitelyTyped,zuzusik/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,mattanja/DefinitelyTyped,vote539/DefinitelyTyped,Ridermansb/DefinitelyTyped,elisee/DefinitelyTyped,eekboom/DefinitelyTyped,jpevarnek/DefinitelyTyped,MugeSo/DefinitelyTyped,mjjames/DefinitelyTyped,Dashlane/DefinitelyTyped,wilfrem/DefinitelyTyped,benishouga/DefinitelyTyped,robl499/DefinitelyTyped,dumbmatter/DefinitelyTyped,chrootsu/DefinitelyTyped,borisyankov/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,mhegazy/DefinitelyTyped,rockclimber90/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,richardTowers/DefinitelyTyped,sclausen/DefinitelyTyped,Zzzen/DefinitelyTyped,psnider/DefinitelyTyped,mcliment/DefinitelyTyped,mattblang/DefinitelyTyped,jtlan/DefinitelyTyped,mrozhin/DefinitelyTyped,forumone/DefinitelyTyped,tboyce/DefinitelyTyped,flyfishMT/DefinitelyTyped,tigerxy/DefinitelyTyped,pocke/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,tomtheisen/DefinitelyTyped,wbuchwalter/DefinitelyTyped,ashwinr/DefinitelyTyped,maglar0/DefinitelyTyped,rschmukler/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,lucyhe/DefinitelyTyped,borisyankov/DefinitelyTyped,GregOnNet/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,hx0day/DefinitelyTyped,alextkachman/DefinitelyTyped,Litee/DefinitelyTyped,quantumman/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,jiaz/DefinitelyTyped,miguelmq/DefinitelyTyped,almstrand/DefinitelyTyped,rushi216/DefinitelyTyped,dmoonfire/DefinitelyTyped,kuon/DefinitelyTyped,jeremyhayes/DefinitelyTyped,abbasmhd/DefinitelyTyped,florentpoujol/DefinitelyTyped,scriby/DefinitelyTyped,CSharpFan/DefinitelyTyped,Syati/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,paxibay/DefinitelyTyped,vasek17/DefinitelyTyped,schmuli/DefinitelyTyped,isman-usoh/DefinitelyTyped,Kuniwak/DefinitelyTyped,pocesar/DefinitelyTyped,nycdotnet/DefinitelyTyped,olivierlemasle/DefinitelyTyped,greglockwood/DefinitelyTyped,mareek/DefinitelyTyped,furny/DefinitelyTyped,zuzusik/DefinitelyTyped,martinduparc/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,unknownloner/DefinitelyTyped,scsouthw/DefinitelyTyped,aciccarello/DefinitelyTyped,dsebastien/DefinitelyTyped,davidsidlinger/DefinitelyTyped,M-Zuber/DefinitelyTyped,Nemo157/DefinitelyTyped,dflor003/DefinitelyTyped,emanuelhp/DefinitelyTyped,paulmorphy/DefinitelyTyped,OpenMaths/DefinitelyTyped,nabeix/DefinitelyTyped,fredgalvao/DefinitelyTyped,tomtarrot/DefinitelyTyped,arcticwaters/DefinitelyTyped,dreampulse/DefinitelyTyped,IAPark/DefinitelyTyped,hypno2000/typings,jasonswearingen/DefinitelyTyped,tinganho/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,jasonswearingen/DefinitelyTyped,mattanja/DefinitelyTyped,gcastre/DefinitelyTyped,nitintutlani/DefinitelyTyped,mareek/DefinitelyTyped,robert-voica/DefinitelyTyped,sclausen/DefinitelyTyped,reppners/DefinitelyTyped,basp/DefinitelyTyped,KonaTeam/DefinitelyTyped,nfriend/DefinitelyTyped,lekaha/DefinitelyTyped,biomassives/DefinitelyTyped,gyohk/DefinitelyTyped,hellopao/DefinitelyTyped,zhiyiting/DefinitelyTyped,hafenr/DefinitelyTyped,gedaiu/DefinitelyTyped,chadoliver/DefinitelyTyped,abmohan/DefinitelyTyped,donnut/DefinitelyTyped,stylelab-io/DefinitelyTyped,arusakov/DefinitelyTyped,xStrom/DefinitelyTyped,use-strict/DefinitelyTyped,QuatroCode/DefinitelyTyped,aciccarello/DefinitelyTyped,frogcjn/DefinitelyTyped,chbrown/DefinitelyTyped,Syati/DefinitelyTyped,shiwano/DefinitelyTyped,use-strict/DefinitelyTyped,nainslie/DefinitelyTyped,mshmelev/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,aroder/DefinitelyTyped,robertbaker/DefinitelyTyped,jbrantly/DefinitelyTyped,Penryn/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,philippsimon/DefinitelyTyped,paulmorphy/DefinitelyTyped,greglo/DefinitelyTyped,nelsonmorais/DefinitelyTyped,yuit/DefinitelyTyped,fnipo/DefinitelyTyped,Karabur/DefinitelyTyped,tdmckinn/DefinitelyTyped,isman-usoh/DefinitelyTyped,Seikho/DefinitelyTyped,esperco/DefinitelyTyped,deeleman/DefinitelyTyped,nobuoka/DefinitelyTyped,awerlang/DefinitelyTyped,alainsahli/DefinitelyTyped,cherrydev/DefinitelyTyped,egeland/DefinitelyTyped,egeland/DefinitelyTyped,nainslie/DefinitelyTyped,AgentME/DefinitelyTyped,ajtowf/DefinitelyTyped,Seltzer/DefinitelyTyped,damianog/DefinitelyTyped,bobslaede/DefinitelyTyped,DenEwout/DefinitelyTyped,dwango-js/DefinitelyTyped,DustinWehr/DefinitelyTyped,georgemarshall/DefinitelyTyped,tjoskar/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,Penryn/DefinitelyTyped,rschmukler/DefinitelyTyped,bennett000/DefinitelyTyped,AgentME/DefinitelyTyped,donnut/DefinitelyTyped,Carreau/DefinitelyTyped,zensh/DefinitelyTyped,ayanoin/DefinitelyTyped,rolandzwaga/DefinitelyTyped,gorcz/DefinitelyTyped,zalamtech/DefinitelyTyped,xStrom/DefinitelyTyped,Pro/DefinitelyTyped,whoeverest/DefinitelyTyped,vote539/DefinitelyTyped,pafflique/DefinitelyTyped,Zenorbi/DefinitelyTyped,ajtowf/DefinitelyTyped,nseckinoral/DefinitelyTyped,Fraegle/DefinitelyTyped,Pro/DefinitelyTyped,progre/DefinitelyTyped,nojaf/DefinitelyTyped,mcrawshaw/DefinitelyTyped,dydek/DefinitelyTyped,LordJZ/DefinitelyTyped,fredgalvao/DefinitelyTyped,Lorisu/DefinitelyTyped,ecramer89/DefinitelyTyped,OfficeDev/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,Deathspike/DefinitelyTyped,timjk/DefinitelyTyped,arma-gast/DefinitelyTyped,bardt/DefinitelyTyped,rolandzwaga/DefinitelyTyped,dpsthree/DefinitelyTyped,danfma/DefinitelyTyped,ml-workshare/DefinitelyTyped,Minishlink/DefinitelyTyped,johan-gorter/DefinitelyTyped,onecentlin/DefinitelyTyped,frogcjn/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,AgentME/DefinitelyTyped,dragouf/DefinitelyTyped,mattblang/DefinitelyTyped,optical/DefinitelyTyped,DeluxZ/DefinitelyTyped,Gmulti/DefinitelyTyped,micurs/DefinitelyTyped,brettle/DefinitelyTyped,dydek/DefinitelyTyped,nmalaguti/DefinitelyTyped,MugeSo/DefinitelyTyped,mshmelev/DefinitelyTyped,GodsBreath/DefinitelyTyped,philippstucki/DefinitelyTyped,Zzzen/DefinitelyTyped,NCARalph/DefinitelyTyped,herrmanno/DefinitelyTyped,emanuelhp/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,drinchev/DefinitelyTyped,kmeurer/DefinitelyTyped,takenet/DefinitelyTyped,arusakov/DefinitelyTyped,nycdotnet/DefinitelyTyped,gregoryagu/DefinitelyTyped,modifyink/DefinitelyTyped,MidnightDesign/DefinitelyTyped,esperco/DefinitelyTyped,vagarenko/DefinitelyTyped,pwelter34/DefinitelyTyped,bencoveney/DefinitelyTyped,Dashlane/DefinitelyTyped,digitalpixies/DefinitelyTyped,felipe3dfx/DefinitelyTyped,rfranco/DefinitelyTyped,flyfishMT/DefinitelyTyped,raijinsetsu/DefinitelyTyped,igorsechyn/DefinitelyTyped,nmalaguti/DefinitelyTyped,lbesson/DefinitelyTyped,Ptival/DefinitelyTyped,arueckle/DefinitelyTyped | ---
+++
@@ -12,7 +12,7 @@
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
-hljs.tabReplace = " "; // 4 spaces
+hljs.configure({ tabReplace: " " }) // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value; |
c0ef3b8f681820135ec27e46e424b800870a79ca | src/app/services/config/JSONConfiguration.ts | src/app/services/config/JSONConfiguration.ts | import {Configuration} from './Configuration';
import {TrueConfiguration} from './TrueConfiguration';
import {FalseConfiguration} from './FalseConfiguration';
export class JSONConfiguration implements Configuration {
constructor(private config: Object) {
}
public isFieldMandatory(name: string): boolean {
var value = this.getValue(name);
return !!value;
}
private getValue(name: string): any {
if (typeof name !== 'string' || name.length === 0) {
return null;
}
return this.config[name];
}
public getConfigFor(name: string): Configuration {
var value = this.getValue(name);
if (value === true) {
return new TrueConfiguration();
} else if (!value) {
return new FalseConfiguration();
} else {
return new JSONConfiguration(value);
}
}
}
| import {Configuration} from './Configuration';
import {TrueConfiguration} from './TrueConfiguration';
import {FalseConfiguration} from './FalseConfiguration';
export class JSONConfiguration implements Configuration {
constructor(private config: Object) {
}
public isFieldMandatory(name: string): boolean {
var value = this.getValue(name);
return typeof value === 'undefined' || !!value;
}
private getValue(name: string): any {
if (typeof name !== 'string' || name.length === 0) {
return null;
}
return this.config[name];
}
public getConfigFor(name: string): Configuration {
var value = this.getValue(name);
if (value === true || typeof value === 'undefined') {
return new TrueConfiguration();
} else if (!value) {
return new FalseConfiguration();
} else {
return new JSONConfiguration(value);
}
}
}
| Make configuration true by default | Make configuration true by default
| TypeScript | apache-2.0 | janschulte/smle,janschulte/smle,janschulte/smle,janschulte/smle | ---
+++
@@ -8,7 +8,7 @@
public isFieldMandatory(name: string): boolean {
var value = this.getValue(name);
- return !!value;
+ return typeof value === 'undefined' || !!value;
}
private getValue(name: string): any {
@@ -21,7 +21,7 @@
public getConfigFor(name: string): Configuration {
var value = this.getValue(name);
- if (value === true) {
+ if (value === true || typeof value === 'undefined') {
return new TrueConfiguration();
} else if (!value) {
return new FalseConfiguration(); |
4547b74f53c807d0098e6a513e5ddc87e6673224 | templates/module/_name.module.ts | templates/module/_name.module.ts | import * as angular from 'angular';
<% if (!moduleOnly) { %>import { <%= pName %>Config } from './<%= hName %>.config';
import { <%= pName %>Controller } from './<%= hName %>.controller';
<% } %>export const <%= pName %>Module = angular
.module('<%= appName %>.<%= name %>', ['ui.router'])<% if (!moduleOnly) { %>
.controller('<%= pName %>Controller', <%= pName %>Controller)
.config(<%= pName %>Config)<% } %>
.name; | <%if (!noImport) { %>import * as angular from 'angular';
<% } %><% if (!moduleOnly) { %>import { <%= pName %>Config } from './<%= hName %>.config';
import { <%= pName %>Controller } from './<%= hName %>.controller';
<% } %>export const <%= pName %>Module = angular
.module('<%= appName %>.<%= name %>', [<% if (!moduleOnly) { %>'ui.router'])
.controller('<%= pName %>Controller', <%= pName %>Controller)
.config(<%= pName %>Config)<% } else { %>])<% } %>
.name; | Remove angular import when flag set | Remove angular import when flag set
| TypeScript | mit | Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli | ---
+++
@@ -1,9 +1,9 @@
-import * as angular from 'angular';
-<% if (!moduleOnly) { %>import { <%= pName %>Config } from './<%= hName %>.config';
+<%if (!noImport) { %>import * as angular from 'angular';
+<% } %><% if (!moduleOnly) { %>import { <%= pName %>Config } from './<%= hName %>.config';
import { <%= pName %>Controller } from './<%= hName %>.controller';
<% } %>export const <%= pName %>Module = angular
- .module('<%= appName %>.<%= name %>', ['ui.router'])<% if (!moduleOnly) { %>
+ .module('<%= appName %>.<%= name %>', [<% if (!moduleOnly) { %>'ui.router'])
.controller('<%= pName %>Controller', <%= pName %>Controller)
- .config(<%= pName %>Config)<% } %>
+ .config(<%= pName %>Config)<% } else { %>])<% } %>
.name; |
5aa502a9476beba2365b317d4ca14c3ac79a391f | apps/tests/app/mainPage.ts | apps/tests/app/mainPage.ts | import tests = require("../testRunner");
import trace = require("trace");
import {Page} from "ui/page";
import {GridLayout} from "ui/layouts/grid-layout";
trace.enable();
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
export function createPage() {
var page = new Page();
var navigatedToHandler = function() {
tests.runAll();
page.off("navigatedTo", navigatedToHandler);
};
page.on("navigatedTo", navigatedToHandler);
return page;
}
| import {Page} from "ui/page";
import tests = require("../testRunner");
trace.enable();
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
let started = false;
let page = new Page();
page.on(Page.navigatedToEvent, function () {
if (!started) {
started = true;
setTimeout(function () {
tests.runAll();
}, 10);
}
});
export function createPage() {
return page;
}
| Fix the run in android | Fix the run in android
| TypeScript | mit | NativeScript/NativeScript,NativeScript/NativeScript,NativeScript/NativeScript,NativeScript/NativeScript,NativeScript/NativeScript | ---
+++
@@ -1,18 +1,22 @@
-import tests = require("../testRunner");
-import trace = require("trace");
-import {Page} from "ui/page";
-import {GridLayout} from "ui/layouts/grid-layout";
+import {Page} from "ui/page";
+import tests = require("../testRunner");
trace.enable();
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
+let started = false;
+let page = new Page();
+
+page.on(Page.navigatedToEvent, function () {
+ if (!started) {
+ started = true;
+ setTimeout(function () {
+ tests.runAll();
+ }, 10);
+ }
+});
+
export function createPage() {
- var page = new Page();
- var navigatedToHandler = function() {
- tests.runAll();
- page.off("navigatedTo", navigatedToHandler);
- };
- page.on("navigatedTo", navigatedToHandler);
return page;
}
|
a7a0e2b62191250bc326eeb985122b76deab26cd | e2e/index.ts | e2e/index.ts | import * as inversifyConfig from './inversify.config';
export { inversifyConfig };
export * from './inversify.types';
export * from './TestConstants';
export * from './pageobjects/login/ICheLoginPage';
export * from './driver/IDriver';
export * from './utils/DriverHelper';
export * from './pageobjects/dashboard/Dashboard';
export * from './utils/NameGenerator';
export * from './pageobjects/dashboard/NewWorkspace';
export * from './pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
export * from './pageobjects/ide/Ide';
export * from './pageobjects/ide/ProjectTree';
export * from './pageobjects/ide/Editor';
export * from './utils/workspace/TestWorkspaceUtil';
| import * as inversifyConfig from './inversify.config';
export { inversifyConfig };
export * from './inversify.types';
export * from './TestConstants';
// driver
export * from './driver/IDriver';
export * from './driver/ChromeDriver';
// pageobjects - dashboard
export * from './pageobjects/dashboard/Dashboard';
export * from './pageobjects/dashboard/NewWorkspace';
export * from './pageobjects/dashboard/Workspaces';
// pageobjects - dashboard - worksapce details
export * from './pageobjects/dashboard/workspace-details/WorkspaceDetails';
export * from './pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
// pageobjects - login
export * from './pageobjects/login/ICheLoginPage';
export * from './pageobjects/login/IOcpLoginPage';
export * from './pageobjects/login/MultiUserLoginPage';
export * from './pageobjects/login/OcpLoginByTempAdmin';
export * from './pageobjects/login/SingleUserLoginPage';
// pageobjects - ide
export * from './pageobjects/ide/DebugView';
export * from './pageobjects/ide/Editor';
export * from './pageobjects/ide/GitHubPlugin';
export * from './pageobjects/ide/Ide';
export * from './pageobjects/ide/PreviewWidget';
export * from './pageobjects/ide/ProjectTree';
export * from './pageobjects/ide/QuickOpenContainer';
export * from './pageobjects/ide/RightToolbar';
export * from './pageobjects/ide/Terminal';
export * from './pageobjects/ide/TopMenu';
export * from './pageobjects/ide/WarningDialog';
// pageobjects - openshift
export * from './pageobjects/openshift/OcpLoginPage';
export * from './pageobjects/openshift/OcpWebConsolePage';
// utils
export * from './utils/DriverHelper';
export * from './utils/NameGenerator';
export * from './utils/workspace/TestWorkspaceUtil';
| Add export for all classes so we can reuse them on RH-Che side. | Add export for all classes so we can reuse them on RH-Che side.
Signed-off-by: kkanova <[email protected]>
| TypeScript | epl-1.0 | codenvy/che,davidfestal/che,codenvy/che,codenvy/che,davidfestal/che,davidfestal/che,davidfestal/che,davidfestal/che,codenvy/che,davidfestal/che,davidfestal/che,davidfestal/che,davidfestal/che,davidfestal/che | ---
+++
@@ -2,14 +2,45 @@
export { inversifyConfig };
export * from './inversify.types';
export * from './TestConstants';
+
+// driver
+export * from './driver/IDriver';
+export * from './driver/ChromeDriver';
+
+// pageobjects - dashboard
+export * from './pageobjects/dashboard/Dashboard';
+export * from './pageobjects/dashboard/NewWorkspace';
+export * from './pageobjects/dashboard/Workspaces';
+
+// pageobjects - dashboard - worksapce details
+export * from './pageobjects/dashboard/workspace-details/WorkspaceDetails';
+export * from './pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
+
+// pageobjects - login
export * from './pageobjects/login/ICheLoginPage';
-export * from './driver/IDriver';
+export * from './pageobjects/login/IOcpLoginPage';
+export * from './pageobjects/login/MultiUserLoginPage';
+export * from './pageobjects/login/OcpLoginByTempAdmin';
+export * from './pageobjects/login/SingleUserLoginPage';
+
+// pageobjects - ide
+export * from './pageobjects/ide/DebugView';
+export * from './pageobjects/ide/Editor';
+export * from './pageobjects/ide/GitHubPlugin';
+export * from './pageobjects/ide/Ide';
+export * from './pageobjects/ide/PreviewWidget';
+export * from './pageobjects/ide/ProjectTree';
+export * from './pageobjects/ide/QuickOpenContainer';
+export * from './pageobjects/ide/RightToolbar';
+export * from './pageobjects/ide/Terminal';
+export * from './pageobjects/ide/TopMenu';
+export * from './pageobjects/ide/WarningDialog';
+
+// pageobjects - openshift
+export * from './pageobjects/openshift/OcpLoginPage';
+export * from './pageobjects/openshift/OcpWebConsolePage';
+
+// utils
export * from './utils/DriverHelper';
-export * from './pageobjects/dashboard/Dashboard';
export * from './utils/NameGenerator';
-export * from './pageobjects/dashboard/NewWorkspace';
-export * from './pageobjects/dashboard/workspace-details/WorkspaceDetailsPlugins';
-export * from './pageobjects/ide/Ide';
-export * from './pageobjects/ide/ProjectTree';
-export * from './pageobjects/ide/Editor';
export * from './utils/workspace/TestWorkspaceUtil'; |
46756513fd949986284fbedc0c096e4e8ef1d367 | app/src/container/Books.tsx | app/src/container/Books.tsx | import * as React from "react";
import { connect } from "react-redux";
import Book from "../component/Book";
import BooksMenu from "../component/BooksMenu";
import config from "../config";
import { IBook } from "../lib/books";
import { actionCreators } from "../redux/books";
import Items from "./Items";
interface IProps {
currentItem: IBook | null;
doneItems: IBook[];
setCurrentItem: (book: IBook) => void;
setItems: (items: IBook[], done: boolean) => void;
todoItems: IBook[];
}
class Books extends React.Component<IProps> {
public render() {
return <Items itemComponent={Book} menuComponent={BooksMenu} {...this.props} />;
}
public componentDidUpdate() {
const script = document.createElement("script");
script.id = "commissionJunction";
script.src = config.commissionJunction.scriptSrc;
script.async = true;
const oldElement = document.getElementById(script.id);
if (oldElement) {
oldElement.remove();
}
document.body.appendChild(script);
}
}
export default connect(({ books }) => books, actionCreators)(Books);
| import * as React from "react";
import { connect } from "react-redux";
import Book from "../component/Book";
import BooksMenu from "../component/BooksMenu";
import config from "../config";
import { IBook } from "../lib/books";
import { actionCreators } from "../redux/books";
import Items from "./Items";
interface IProps {
currentItem: IBook | null;
doneItems: IBook[];
setCurrentItem: (book: IBook) => void;
setItems: (items: IBook[], done: boolean) => void;
todoItems: IBook[];
}
class Books extends React.Component<IProps> {
public render() {
return <Items itemComponent={Book} menuComponent={BooksMenu} {...this.props} />;
}
public componentDidMount() {
this.componentDidUpdate();
}
public componentDidUpdate() {
const script = document.createElement("script");
script.id = "commissionJunction";
script.src = config.commissionJunction.scriptSrc;
script.async = true;
const oldElement = document.getElementById(script.id);
if (oldElement) {
oldElement.remove();
}
document.body.appendChild(script);
}
}
export default connect(({ books }) => books, actionCreators)(Books);
| Fix affiliate script loading in books page | Fix affiliate script loading in books page
| TypeScript | mit | raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d | ---
+++
@@ -21,6 +21,10 @@
return <Items itemComponent={Book} menuComponent={BooksMenu} {...this.props} />;
}
+ public componentDidMount() {
+ this.componentDidUpdate();
+ }
+
public componentDidUpdate() {
const script = document.createElement("script");
|
1caee21c93f8adb9016b754e79ba23e62d3d23b8 | src/app/shared/components/thumbnail/thumbnail.component.ts | src/app/shared/components/thumbnail/thumbnail.component.ts | import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'mh-thumbnail',
templateUrl: './thumbnail.component.html',
styleUrls: ['./thumbnail.component.css']
})
export class ThumbnailComponent implements OnInit {
@Input() image;
@Input() alt: string;
constructor() { }
ngOnInit() {
}
getThumbnailUrl() {
return `${this.image.path}.${this.image.extension}`;
}
}
| import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'mh-thumbnail',
templateUrl: './thumbnail.component.html',
styleUrls: ['./thumbnail.component.css']
})
export class ThumbnailComponent implements OnInit {
@Input() image;
@Input() alt: string;
constructor() { }
ngOnInit() {
}
getThumbnailUrl() {
return `${this.getThumbnailPathWithoutProtocol()}.${this.image.extension}`;
}
getThumbnailPathWithoutProtocol() {
return this.image.path.replace(/^https?:/, '');
}
}
| Remove protocol from thumnail's url to avaoid HTTPS mixed content | Remove protocol from thumnail's url to avaoid HTTPS mixed content
| TypeScript | mit | dmytroyarmak/angular2-marvel-heroes,dmytroyarmak/angular2-marvel-heroes,dmytroyarmak/angular2-marvel-heroes | ---
+++
@@ -15,6 +15,10 @@
}
getThumbnailUrl() {
- return `${this.image.path}.${this.image.extension}`;
+ return `${this.getThumbnailPathWithoutProtocol()}.${this.image.extension}`;
+ }
+
+ getThumbnailPathWithoutProtocol() {
+ return this.image.path.replace(/^https?:/, '');
}
} |
e9bb38e81a42bdc1cec1e9f71c15e60b7edc3c28 | extensions/merge-conflict/src/contentProvider.ts | extensions/merge-conflict/src/contentProvider.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 vscode from 'vscode';
import * as interfaces from './interfaces';
export default class MergeConflictContentProvider implements vscode.TextDocumentContentProvider, vscode.Disposable {
static scheme = 'git.merge.conflict-diff';
constructor(private context: vscode.ExtensionContext) {
}
begin(config: interfaces.IExtensionConfiguration) {
this.context.subscriptions.push(
vscode.workspace.registerTextDocumentContentProvider(MergeConflictContentProvider.scheme, this)
);
}
dispose() {
}
async provideTextDocumentContent(uri: vscode.Uri): Promise<string | null> {
try {
const [start, end] = JSON.parse(uri.query) as { line: number, character: number }[];
const document = await vscode.workspace.openTextDocument(uri.with({ scheme: 'file', query: '' }));
const text = document.getText(new vscode.Range(start.line, start.character, end.line, end.character));
return text;
}
catch (ex) {
await vscode.window.showErrorMessage('Unable to show comparison');
return null;
}
}
} | /*---------------------------------------------------------------------------------------------
* 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 vscode from 'vscode';
import * as interfaces from './interfaces';
export default class MergeConflictContentProvider implements vscode.TextDocumentContentProvider, vscode.Disposable {
static scheme = 'merge-conflict.conflict-diff';
constructor(private context: vscode.ExtensionContext) {
}
begin(config: interfaces.IExtensionConfiguration) {
this.context.subscriptions.push(
vscode.workspace.registerTextDocumentContentProvider(MergeConflictContentProvider.scheme, this)
);
}
dispose() {
}
async provideTextDocumentContent(uri: vscode.Uri): Promise<string | null> {
try {
const [start, end] = JSON.parse(uri.query) as { line: number, character: number }[];
const document = await vscode.workspace.openTextDocument(uri.with({ scheme: 'file', query: '' }));
const text = document.getText(new vscode.Range(start.line, start.character, end.line, end.character));
return text;
}
catch (ex) {
await vscode.window.showErrorMessage('Unable to show comparison');
return null;
}
}
} | Rename content provider to match extension name | Rename content provider to match extension name
| TypeScript | mit | stringham/vscode,landonepps/vscode,cleidigh/vscode,0xmohit/vscode,rishii7/vscode,KattMingMing/vscode,hoovercj/vscode,0xmohit/vscode,the-ress/vscode,Zalastax/vscode,gagangupt16/vscode,hoovercj/vscode,Microsoft/vscode,Microsoft/vscode,Microsoft/vscode,DustinCampbell/vscode,KattMingMing/vscode,stringham/vscode,joaomoreno/vscode,microsoft/vscode,veeramarni/vscode,eamodio/vscode,eamodio/vscode,DustinCampbell/vscode,cleidigh/vscode,eamodio/vscode,rishii7/vscode,Microsoft/vscode,0xmohit/vscode,veeramarni/vscode,hoovercj/vscode,hoovercj/vscode,Microsoft/vscode,0xmohit/vscode,the-ress/vscode,landonepps/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,rishii7/vscode,stringham/vscode,microlv/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,gagangupt16/vscode,landonepps/vscode,rishii7/vscode,hoovercj/vscode,stringham/vscode,Zalastax/vscode,hoovercj/vscode,stringham/vscode,Krzysztof-Cieslak/vscode,microlv/vscode,veeramarni/vscode,rishii7/vscode,microsoft/vscode,DustinCampbell/vscode,the-ress/vscode,joaomoreno/vscode,veeramarni/vscode,Krzysztof-Cieslak/vscode,veeramarni/vscode,mjbvz/vscode,cleidigh/vscode,Microsoft/vscode,veeramarni/vscode,veeramarni/vscode,hoovercj/vscode,DustinCampbell/vscode,Microsoft/vscode,microlv/vscode,hoovercj/vscode,microsoft/vscode,Zalastax/vscode,Zalastax/vscode,eamodio/vscode,joaomoreno/vscode,cleidigh/vscode,rishii7/vscode,landonepps/vscode,cleidigh/vscode,0xmohit/vscode,Zalastax/vscode,stringham/vscode,microlv/vscode,gagangupt16/vscode,cleidigh/vscode,landonepps/vscode,veeramarni/vscode,microsoft/vscode,hoovercj/vscode,KattMingMing/vscode,rishii7/vscode,KattMingMing/vscode,Krzysztof-Cieslak/vscode,landonepps/vscode,DustinCampbell/vscode,gagangupt16/vscode,gagangupt16/vscode,cleidigh/vscode,mjbvz/vscode,landonepps/vscode,hoovercj/vscode,veeramarni/vscode,microsoft/vscode,microsoft/vscode,DustinCampbell/vscode,the-ress/vscode,the-ress/vscode,gagangupt16/vscode,the-ress/vscode,landonepps/vscode,DustinCampbell/vscode,cleidigh/vscode,microlv/vscode,rishii7/vscode,joaomoreno/vscode,veeramarni/vscode,0xmohit/vscode,microlv/vscode,hoovercj/vscode,mjbvz/vscode,joaomoreno/vscode,the-ress/vscode,rishii7/vscode,Microsoft/vscode,cleidigh/vscode,landonepps/vscode,Zalastax/vscode,mjbvz/vscode,landonepps/vscode,veeramarni/vscode,Microsoft/vscode,microsoft/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,Zalastax/vscode,rishii7/vscode,0xmohit/vscode,cleidigh/vscode,gagangupt16/vscode,0xmohit/vscode,Microsoft/vscode,rishii7/vscode,joaomoreno/vscode,cleidigh/vscode,veeramarni/vscode,mjbvz/vscode,mjbvz/vscode,stringham/vscode,gagangupt16/vscode,0xmohit/vscode,mjbvz/vscode,KattMingMing/vscode,0xmohit/vscode,KattMingMing/vscode,mjbvz/vscode,Microsoft/vscode,eamodio/vscode,DustinCampbell/vscode,gagangupt16/vscode,cleidigh/vscode,Zalastax/vscode,Microsoft/vscode,microlv/vscode,microlv/vscode,mjbvz/vscode,gagangupt16/vscode,rishii7/vscode,landonepps/vscode,KattMingMing/vscode,0xmohit/vscode,landonepps/vscode,DustinCampbell/vscode,microlv/vscode,landonepps/vscode,Zalastax/vscode,cra0zy/VSCode,microsoft/vscode,stringham/vscode,Zalastax/vscode,0xmohit/vscode,microlv/vscode,DustinCampbell/vscode,KattMingMing/vscode,the-ress/vscode,microlv/vscode,mjbvz/vscode,hoovercj/vscode,0xmohit/vscode,DustinCampbell/vscode,Zalastax/vscode,landonepps/vscode,cleidigh/vscode,hoovercj/vscode,Microsoft/vscode,Zalastax/vscode,Zalastax/vscode,Zalastax/vscode,joaomoreno/vscode,veeramarni/vscode,Zalastax/vscode,microlv/vscode,the-ress/vscode,KattMingMing/vscode,0xmohit/vscode,microsoft/vscode,joaomoreno/vscode,mjbvz/vscode,Krzysztof-Cieslak/vscode,Zalastax/vscode,stringham/vscode,Krzysztof-Cieslak/vscode,Zalastax/vscode,mjbvz/vscode,mjbvz/vscode,0xmohit/vscode,the-ress/vscode,mjbvz/vscode,hoovercj/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,0xmohit/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,gagangupt16/vscode,hoovercj/vscode,0xmohit/vscode,joaomoreno/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,KattMingMing/vscode,microsoft/vscode,landonepps/vscode,Microsoft/vscode,the-ress/vscode,rishii7/vscode,eamodio/vscode,Krzysztof-Cieslak/vscode,cleidigh/vscode,gagangupt16/vscode,microlv/vscode,microsoft/vscode,joaomoreno/vscode,gagangupt16/vscode,veeramarni/vscode,stringham/vscode,cleidigh/vscode,microlv/vscode,KattMingMing/vscode,gagangupt16/vscode,stringham/vscode,eamodio/vscode,joaomoreno/vscode,eamodio/vscode,landonepps/vscode,the-ress/vscode,stringham/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,KattMingMing/vscode,veeramarni/vscode,gagangupt16/vscode,veeramarni/vscode,eamodio/vscode,joaomoreno/vscode,Microsoft/vscode,Microsoft/vscode,joaomoreno/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,joaomoreno/vscode,stringham/vscode,microlv/vscode,stringham/vscode,microsoft/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,DustinCampbell/vscode,gagangupt16/vscode,stringham/vscode,hoovercj/vscode,rishii7/vscode,the-ress/vscode,the-ress/vscode,landonepps/vscode,DustinCampbell/vscode,veeramarni/vscode,eamodio/vscode,DustinCampbell/vscode,microlv/vscode,KattMingMing/vscode,microlv/vscode,eamodio/vscode,stringham/vscode,rishii7/vscode,gagangupt16/vscode,eamodio/vscode,joaomoreno/vscode,the-ress/vscode,KattMingMing/vscode,microsoft/vscode,microsoft/vscode,cleidigh/vscode,mjbvz/vscode,eamodio/vscode,stringham/vscode,eamodio/vscode,microsoft/vscode,mjbvz/vscode,cleidigh/vscode,mjbvz/vscode,microsoft/vscode,joaomoreno/vscode,microsoft/vscode | ---
+++
@@ -8,7 +8,7 @@
export default class MergeConflictContentProvider implements vscode.TextDocumentContentProvider, vscode.Disposable {
- static scheme = 'git.merge.conflict-diff';
+ static scheme = 'merge-conflict.conflict-diff';
constructor(private context: vscode.ExtensionContext) {
} |
d0e5e67b167b87255ac4ad146cf577aa6850892f | src/helpers/ArrowHelper.d.ts | src/helpers/ArrowHelper.d.ts | import { Vector3 } from './../math/Vector3';
import { Line } from './../objects/Line';
import { Mesh } from './../objects/Mesh';
import { Color } from './../math/Color';
import { Object3D } from './../core/Object3D';
// Extras / Helpers /////////////////////////////////////////////////////////////////////
export class ArrowHelper extends Object3D {
/**
* @param [dir=new THREE.Vector3( 0, 0, 1 )]
* @param [origin=new THREE.Vector3( 0, 0, 0 )]
* @param [length=1]
* @param [color=0xffff00]
* @param headLength
* @param headWidth
*/
constructor(
dir: Vector3,
origin?: Vector3,
length?: number,
color?: number,
headLength?: number,
headWidth?: number
);
/**
* @default 'ArrowHelper'
*/
type: string;
line: Line;
cone: Mesh;
setDirection( dir: Vector3 ): void;
setLength( length: number, headLength?: number, headWidth?: number ): void;
setColor( color: Color | string | number ): void;
}
| import { Vector3 } from './../math/Vector3';
import { Line } from './../objects/Line';
import { Mesh } from './../objects/Mesh';
import { Color } from './../math/Color';
import { Object3D } from './../core/Object3D';
// Extras / Helpers /////////////////////////////////////////////////////////////////////
export class ArrowHelper extends Object3D {
/**
* @param [dir=new THREE.Vector3( 0, 0, 1 )]
* @param [origin=new THREE.Vector3( 0, 0, 0 )]
* @param [length=1]
* @param [color=0xffff00]
* @param headLength
* @param headWidth
*/
constructor(
dir: Vector3,
origin?: Vector3,
length?: number,
color?: Color | string | number,
headLength?: number,
headWidth?: number
);
/**
* @default 'ArrowHelper'
*/
type: string;
line: Line;
cone: Mesh;
setDirection( dir: Vector3 ): void;
setLength( length: number, headLength?: number, headWidth?: number ): void;
setColor( color: Color | string | number ): void;
}
| Make color constructor type more permissive | Make color constructor type more permissive
| TypeScript | mit | looeee/three.js,donmccurdy/three.js,Liuer/three.js,greggman/three.js,gero3/three.js,gero3/three.js,WestLangley/three.js,aardgoose/three.js,06wj/three.js,kaisalmen/three.js,donmccurdy/three.js,fyoudine/three.js,kaisalmen/three.js,06wj/three.js,Liuer/three.js,aardgoose/three.js,looeee/three.js,mrdoob/three.js,makc/three.js.fork,greggman/three.js,makc/three.js.fork,jpweeks/three.js,jpweeks/three.js,mrdoob/three.js,fyoudine/three.js,WestLangley/three.js | ---
+++
@@ -20,7 +20,7 @@
dir: Vector3,
origin?: Vector3,
length?: number,
- color?: number,
+ color?: Color | string | number,
headLength?: number,
headWidth?: number
); |
63772291b23c207d603431c265d9692746e06500 | front/src/app/shared/base.service.ts | front/src/app/shared/base.service.ts | import { Injectable } from '@angular/core';
import { Error } from './error/error';
import { Observable } from 'rxjs/Observable';
import { environment } from '../../environments/environment';
import { HttpErrorResponse } from '@angular/common/http';
@Injectable()
export class BaseService {
private static DEFAULT_ERROR = 'Something went horribly wrong...';
private static DEFAULT_DETAILS = 'A team of highly trained monkeys has been dispatched to deal with this situation.';
protected extractError(res: HttpErrorResponse) {
console.log(res);
const error: Error = new Error();
if (res instanceof HttpErrorResponse) {
// Extract error message
error.status = res.status;
error.message = res.statusText || BaseService.DEFAULT_ERROR;
error.details = res.error.message || BaseService.DEFAULT_DETAILS;
} else {
error.message = BaseService.DEFAULT_ERROR;
error.details = res as string || BaseService.DEFAULT_DETAILS;
}
return Observable.throw(error);
}
protected buildUrl(endpoint: string): string {
return environment.serverUrl + endpoint;
}
}
| import { Injectable } from '@angular/core';
import { Error } from './error/error';
import { Observable } from 'rxjs/Observable';
import { environment } from '../../environments/environment';
import { HttpErrorResponse } from '@angular/common/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/finally';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
@Injectable()
export class BaseService {
private static DEFAULT_ERROR = 'Something went horribly wrong...';
private static DEFAULT_DETAILS = 'A team of highly trained monkeys has been dispatched to deal with this situation.';
protected extractError(res: HttpErrorResponse) {
const error: Error = new Error();
if (res instanceof HttpErrorResponse) {
// Extract error message
error.status = res.status;
error.message = res.statusText || BaseService.DEFAULT_ERROR;
error.details = res.error.message || BaseService.DEFAULT_DETAILS;
} else {
error.message = BaseService.DEFAULT_ERROR;
error.details = res as string || BaseService.DEFAULT_DETAILS;
}
return Observable.throw(error);
}
protected buildUrl(endpoint: string): string {
return environment.serverUrl + endpoint;
}
}
| Fix wrong import / remove console log | Fix wrong import / remove console log
| TypeScript | mit | Crunchy-Torch/coddy,Crunchy-Torch/coddy,Crunchy-Torch/coddy,Crunchy-Torch/coddy,Crunchy-Torch/coddy | ---
+++
@@ -3,6 +3,11 @@
import { Observable } from 'rxjs/Observable';
import { environment } from '../../environments/environment';
import { HttpErrorResponse } from '@angular/common/http';
+
+import 'rxjs/add/operator/map';
+import 'rxjs/add/operator/finally';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/observable/throw';
@Injectable()
export class BaseService {
@@ -11,7 +16,6 @@
private static DEFAULT_DETAILS = 'A team of highly trained monkeys has been dispatched to deal with this situation.';
protected extractError(res: HttpErrorResponse) {
- console.log(res);
const error: Error = new Error();
if (res instanceof HttpErrorResponse) {
// Extract error message |
6d7f44e091a47c28bbcf7c169ec3775b6fa7aac5 | src/git/remotes/gitlab.ts | src/git/remotes/gitlab.ts | 'use strict';
import { GitHubService } from './github';
export class GitLabService extends GitHubService {
constructor(public domain: string, public path: string, public custom: boolean = false) {
super(domain, path);
}
get name() {
return this.formatName('GitLab');
}
} | 'use strict';
import { Range } from 'vscode';
import { GitHubService } from './github';
export class GitLabService extends GitHubService {
constructor(public domain: string, public path: string, public custom: boolean = false) {
super(domain, path);
}
get name() {
return this.formatName('GitLab');
}
protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
let line = '';
if (range) {
if (range.start.line === range.end.line) {
line = `#L${range.start.line}`;
}
else {
line = `#L${range.start.line}-${range.end.line}`;
}
}
if (sha) return `${this.baseUrl}/blob/${sha}/${fileName}${line}`;
if (branch) return `${this.baseUrl}/blob/${branch}/${fileName}${line}`;
return `${this.baseUrl}?path=${fileName}${line}`;
}
} | Fix GitLab integration's multi-line selection. | Fix GitLab integration's multi-line selection.
| TypeScript | mit | eamodio/vscode-gitlens,eamodio/vscode-gitlens,eamodio/vscode-gitlens | ---
+++
@@ -1,4 +1,5 @@
'use strict';
+import { Range } from 'vscode';
import { GitHubService } from './github';
export class GitLabService extends GitHubService {
@@ -10,4 +11,20 @@
get name() {
return this.formatName('GitLab');
}
+
+ protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string {
+ let line = '';
+ if (range) {
+ if (range.start.line === range.end.line) {
+ line = `#L${range.start.line}`;
+ }
+ else {
+ line = `#L${range.start.line}-${range.end.line}`;
+ }
+ }
+
+ if (sha) return `${this.baseUrl}/blob/${sha}/${fileName}${line}`;
+ if (branch) return `${this.baseUrl}/blob/${branch}/${fileName}${line}`;
+ return `${this.baseUrl}?path=${fileName}${line}`;
+ }
} |
4c50172f81f16289ab4c61ba3ff3c84377fa2780 | src/Calque/core/app.ts | src/Calque/core/app.ts | import HelpPage = require('help');
import Workspace = require('workspace');
import Settings = require('settings');
class Application {
help = new HelpPage();
workspace: Workspace;
settings: Settings;
constructor(inputEl: HTMLInputElement, outputEl: HTMLElement) {
this.workspace = new Workspace(inputEl, outputEl);
this.settings = new Settings();
}
}
export = Application; | import HelpPage = require('help');
import Workspace = require('workspace');
import Settings = require('settings');
class Application {
help = new HelpPage();
workspace: Workspace;
settings: Settings.Settings;
init(inputEl: HTMLInputElement, outputEl: HTMLElement) {
this.workspace = new Workspace(inputEl, outputEl);
this.settings = new Settings.Settings();
this.help.isVisible.subscribe(v => this.save());
this.settings.theme.subscribe(v => this.save());
}
restore(data: IOHelper, value: string) {
if (value)
this.workspace.inputEl.value = value;
data.readText('help').done(v => v ? this.help.isVisible(v === 'true') : true);
data.readText('theme').done(v => this.settings.theme(Settings.Theme[v]));
}
save() {
WinJS.Application.local.writeText('help', String(this.help.isVisible()));
WinJS.Application.local.writeText('theme', Settings.Theme[this.settings.theme()]);
}
}
export = new Application(); | Make App singelton & added restore/save functions | Make App singelton & added restore/save functions
| TypeScript | mit | arthot/calque,arthot/calque,arthot/calque | ---
+++
@@ -5,12 +5,27 @@
class Application {
help = new HelpPage();
workspace: Workspace;
- settings: Settings;
+ settings: Settings.Settings;
- constructor(inputEl: HTMLInputElement, outputEl: HTMLElement) {
+ init(inputEl: HTMLInputElement, outputEl: HTMLElement) {
this.workspace = new Workspace(inputEl, outputEl);
- this.settings = new Settings();
+ this.settings = new Settings.Settings();
+
+ this.help.isVisible.subscribe(v => this.save());
+ this.settings.theme.subscribe(v => this.save());
+ }
+
+ restore(data: IOHelper, value: string) {
+ if (value)
+ this.workspace.inputEl.value = value;
+ data.readText('help').done(v => v ? this.help.isVisible(v === 'true') : true);
+ data.readText('theme').done(v => this.settings.theme(Settings.Theme[v]));
+ }
+
+ save() {
+ WinJS.Application.local.writeText('help', String(this.help.isVisible()));
+ WinJS.Application.local.writeText('theme', Settings.Theme[this.settings.theme()]);
}
}
-export = Application;
+export = new Application(); |
4e9b96fc5a2b02e07b863d59e5386eff76ef3ad1 | src/telemetry.ts | src/telemetry.ts | 'use strict';
import { RestClientSettings } from './models/configurationSettings';
import * as Constants from './constants';
import * as appInsights from "applicationinsights";
appInsights.setup(Constants.AiKey)
.setAutoCollectDependencies(false)
.setAutoCollectExceptions(false)
.setAutoCollectPerformance(false)
.setAutoCollectRequests(false)
.setAutoCollectDependencies(false)
.setAutoDependencyCorrelation(false)
.start();
export class Telemetry {
private static readonly restClientSettings: RestClientSettings = new RestClientSettings();
public static sendEvent(eventName: string, properties?: { [key: string]: string }) {
try {
if (Telemetry.restClientSettings.enableTelemetry) {
appInsights.defaultClient.trackEvent({name: eventName, properties});
}
} catch {
}
}
} | 'use strict';
import { RestClientSettings } from './models/configurationSettings';
import * as Constants from './constants';
import * as appInsights from "applicationinsights";
appInsights.setup(Constants.AiKey)
.setAutoCollectConsole(false)
.setAutoCollectDependencies(false)
.setAutoCollectExceptions(false)
.setAutoCollectPerformance(false)
.setAutoCollectRequests(false)
.setAutoDependencyCorrelation(false)
.setUseDiskRetryCaching(true)
.start();
export class Telemetry {
private static readonly restClientSettings: RestClientSettings = new RestClientSettings();
public static sendEvent(eventName: string, properties?: { [key: string]: string }) {
try {
if (Telemetry.restClientSettings.enableTelemetry) {
appInsights.defaultClient.trackEvent({name: eventName, properties});
}
} catch {
}
}
} | Allow use applicationinsights disk retry caching | Allow use applicationinsights disk retry caching
| TypeScript | mit | Huachao/vscode-restclient,Huachao/vscode-restclient | ---
+++
@@ -5,12 +5,13 @@
import * as appInsights from "applicationinsights";
appInsights.setup(Constants.AiKey)
+ .setAutoCollectConsole(false)
.setAutoCollectDependencies(false)
.setAutoCollectExceptions(false)
.setAutoCollectPerformance(false)
.setAutoCollectRequests(false)
- .setAutoCollectDependencies(false)
.setAutoDependencyCorrelation(false)
+ .setUseDiskRetryCaching(true)
.start();
export class Telemetry { |
e18ff095665e386c77ab79137592c36c5e6183a7 | src/locale/km/index.ts | src/locale/km/index.ts | import type { Locale } from '../types'
import formatDistance from './_lib/formatDistance/index'
import formatLong from './_lib/formatLong/index'
import formatRelative from './_lib/formatRelative/index'
import localize from './_lib/localize/index'
import match from './_lib/match/index'
/**
* @type {Locale}
* @category Locales
* @summary Khmer locale (Cambodian).
* @language Khmer
* @iso-639-1 km
* @author Seanghay Yath [@seanghay]{@link https://github.com/seanghay}
*/
const locale: Locale = {
code: 'km',
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 0 /* Sunday */,
firstWeekContainsDate: 1,
},
}
export default locale
| import type { Locale } from '../types'
import formatDistance from './_lib/formatDistance/index'
import formatLong from './_lib/formatLong/index'
import formatRelative from './_lib/formatRelative/index'
import localize from './_lib/localize/index'
import match from './_lib/match/index'
/**
* @type {Locale}
* @category Locales
* @summary Khmer locale (Cambodian).
* @language Khmer
* @iso-639-2 khm
* @author Seanghay Yath [@seanghay]{@link https://github.com/seanghay}
*/
const locale: Locale = {
code: 'km',
formatDistance: formatDistance,
formatLong: formatLong,
formatRelative: formatRelative,
localize: localize,
match: match,
options: {
weekStartsOn: 0 /* Sunday */,
firstWeekContainsDate: 1,
},
}
export default locale
| Fix @iso-639-2 in Khmer locale | Fix @iso-639-2 in Khmer locale
| TypeScript | mit | date-fns/date-fns,date-fns/date-fns,date-fns/date-fns | ---
+++
@@ -10,7 +10,7 @@
* @category Locales
* @summary Khmer locale (Cambodian).
* @language Khmer
- * @iso-639-1 km
+ * @iso-639-2 khm
* @author Seanghay Yath [@seanghay]{@link https://github.com/seanghay}
*/
const locale: Locale = { |
5ec8a96dde9826044f6750f804d0b8c1f90f0882 | src/selectors/databaseFilterSettings.ts | src/selectors/databaseFilterSettings.ts | import { hitDatabaseSelector, databaseFIlterSettingsSelector } from './index';
import { createSelector } from 'reselect';
import { HitDatabaseEntry } from 'types';
export const hitDatabaseFilteredBySearchTerm = createSelector(
[hitDatabaseSelector, databaseFIlterSettingsSelector],
(hitDatabase, { searchTerm }) =>
hitDatabase
.filter((hit: HitDatabaseEntry) => hit.title.search(searchTerm) !== -1)
.map((el: HitDatabaseEntry) => el.id)
);
| import { hitDatabaseSelector, databaseFilterSettingsSelector } from './index';
import { createSelector } from 'reselect';
import { HitDatabaseEntry, HitDatabaseMap, StatusFilterType } from 'types';
import { filterBy } from 'utils/databaseFilter';
import { Map } from 'immutable';
export const hitDatabaseFilteredBySearchTerm = createSelector(
[hitDatabaseSelector, databaseFilterSettingsSelector],
(hitDatabase, { searchTerm }) =>
hitDatabase
.filter((hit: HitDatabaseEntry) => hit.title.search(searchTerm) !== -1)
.map((el: HitDatabaseEntry) => el.id)
);
export const hitDatabaseFilteredByStatus = createSelector(
[hitDatabaseSelector, databaseFilterSettingsSelector],
(hitDatabase, { statusFilters }) => {
if (statusFilters.isEmpty()) {
return hitDatabase;
}
const filterFunction = filterBy(hitDatabase);
const resultsMaps = statusFilters.reduce(
(acc: HitDatabaseMap[], cur: StatusFilterType) =>
acc.concat(filterFunction(cur)),
[]
);
return resultsMaps
.reduce(
(acc: HitDatabaseMap, cur: HitDatabaseMap) => acc.merge(cur),
Map()
)
.map((el: HitDatabaseEntry) => el.id)
.toArray();
}
);
| Add selector for filtering HITs by status. | Add selector for filtering HITs by status.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -1,11 +1,38 @@
-import { hitDatabaseSelector, databaseFIlterSettingsSelector } from './index';
+import { hitDatabaseSelector, databaseFilterSettingsSelector } from './index';
import { createSelector } from 'reselect';
-import { HitDatabaseEntry } from 'types';
+import { HitDatabaseEntry, HitDatabaseMap, StatusFilterType } from 'types';
+import { filterBy } from 'utils/databaseFilter';
+import { Map } from 'immutable';
export const hitDatabaseFilteredBySearchTerm = createSelector(
- [hitDatabaseSelector, databaseFIlterSettingsSelector],
+ [hitDatabaseSelector, databaseFilterSettingsSelector],
(hitDatabase, { searchTerm }) =>
hitDatabase
.filter((hit: HitDatabaseEntry) => hit.title.search(searchTerm) !== -1)
.map((el: HitDatabaseEntry) => el.id)
);
+
+export const hitDatabaseFilteredByStatus = createSelector(
+ [hitDatabaseSelector, databaseFilterSettingsSelector],
+ (hitDatabase, { statusFilters }) => {
+ if (statusFilters.isEmpty()) {
+ return hitDatabase;
+ }
+
+ const filterFunction = filterBy(hitDatabase);
+
+ const resultsMaps = statusFilters.reduce(
+ (acc: HitDatabaseMap[], cur: StatusFilterType) =>
+ acc.concat(filterFunction(cur)),
+ []
+ );
+
+ return resultsMaps
+ .reduce(
+ (acc: HitDatabaseMap, cur: HitDatabaseMap) => acc.merge(cur),
+ Map()
+ )
+ .map((el: HitDatabaseEntry) => el.id)
+ .toArray();
+ }
+); |
f2b82dd3c3cb8c7c2623a0d34f1efe6cf67f9f66 | src/background-script/alarms.ts | src/background-script/alarms.ts | import { Alarms } from 'webextension-polyfill-ts'
import BackgroundScript from '.'
import { QUOTA_USAGE_WARN_PERC } from './constants'
import { EVENT_NOTIFS } from 'src/notifications/notifications'
export interface AlarmConfig extends Alarms.CreateAlarmInfoType {
listener: (bg: BackgroundScript) => void
}
export interface AlarmsConfig {
[key: string]: AlarmConfig
}
export const storageQuotaCheck: AlarmConfig = {
periodInMinutes: 180,
async listener(bg) {
const { usage, quota } = await navigator.storage.estimate()
const percUsed = Math.trunc((usage / quota) * 100)
if (percUsed >= QUOTA_USAGE_WARN_PERC) {
await bg.sendNotification(EVENT_NOTIFS.quota_warning.id)
}
},
}
// Schedule alarm configs to run in here:
export default {} as AlarmsConfig
| import { Alarms } from 'webextension-polyfill-ts'
import BackgroundScript from '.'
import { QUOTA_USAGE_WARN_PERC } from './constants'
import { EVENT_NOTIFS } from 'src/notifications/notifications'
export interface AlarmConfig extends Alarms.CreateAlarmInfoType {
listener: (bg: BackgroundScript) => void
}
export interface AlarmsConfig {
[key: string]: AlarmConfig
}
export const storageQuotaCheck: AlarmConfig = {
periodInMinutes: 180,
async listener(bg) {
const { usage, quota } = await navigator.storage.estimate()
const percUsed = Math.trunc((usage / quota) * 100)
if (percUsed >= QUOTA_USAGE_WARN_PERC) {
await bg.sendNotification(EVENT_NOTIFS.quota_warning.id)
}
},
}
// Schedule alarm configs to run in here:
export default { storageQuotaCheck } as AlarmsConfig
| Add quota notif alarm back in | Add quota notif alarm back in
| TypeScript | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | ---
+++
@@ -25,4 +25,4 @@
}
// Schedule alarm configs to run in here:
-export default {} as AlarmsConfig
+export default { storageQuotaCheck } as AlarmsConfig |
1afb7d88e286e47893a0f8de2aa37c33f9317a6a | src/utils/queueItem.ts | src/utils/queueItem.ts | import { QueueItem, SearchResult } from '../types';
import * as v4 from 'uuid/v4';
export const blankQueueItem = (groupId: string): QueueItem => ({
groupId,
hitId: '[REFRESH_REQUIRED]' + v4(),
assignmentId: '[REFRESH_REQUIRED]' + v4(),
requester: {
name: '[REFRESH_REQUIRED]',
id: '[REFRESH_REQUIRED]' + v4()
},
reward: 0,
taskId: 'REFRESH_REQUIRED',
timeLeftInSeconds: 0,
timeAllottedInSeconds: 0,
title: '[REFRESH_REQUIRED]',
description: '[REFRESH_REQUIRED]',
batchSize: 0,
qualsRequired: []
});
export const queueItemFromSearchResult = (hit: SearchResult): QueueItem => {
const { groupId, reward, timeAllottedInSeconds, requester, title } = hit;
return {
groupId,
hitId: '[REFRESH_REQUIRED]' + v4(),
assignmentId: '[REFRESH_REQUIRED]' + v4(),
taskId: '[REFRESH_REQUIRED]' + v4(),
reward,
timeLeftInSeconds: timeAllottedInSeconds,
requester: requester,
title: '[REFRESH_REQUIRED]' + title,
description: '[REFRESH_REQUIRED]',
timeAllottedInSeconds: hit.timeAllottedInSeconds,
batchSize: hit.batchSize,
qualsRequired: hit.qualsRequired
};
};
| import { QueueItem, SearchResult } from '../types';
import * as v4 from 'uuid/v4';
const NEEDS_REFRESH_PREFIX = '[REFRESH_REQUIRED]';
export const blankQueueItem = (groupId: string): QueueItem => ({
groupId,
hitId: NEEDS_REFRESH_PREFIX + v4(),
assignmentId: NEEDS_REFRESH_PREFIX + v4(),
requester: {
name: NEEDS_REFRESH_PREFIX,
id: NEEDS_REFRESH_PREFIX + v4()
},
reward: 0,
taskId: NEEDS_REFRESH_PREFIX + v4(),
timeLeftInSeconds: 0,
timeAllottedInSeconds: 0,
title: NEEDS_REFRESH_PREFIX,
description: NEEDS_REFRESH_PREFIX,
batchSize: 0,
qualsRequired: []
});
export const queueItemFromSearchResult = (hit: SearchResult): QueueItem => {
const { groupId, reward, timeAllottedInSeconds, requester, title } = hit;
return {
groupId,
hitId: NEEDS_REFRESH_PREFIX + v4(),
assignmentId: NEEDS_REFRESH_PREFIX + v4(),
taskId: NEEDS_REFRESH_PREFIX + v4(),
reward,
timeLeftInSeconds: timeAllottedInSeconds,
requester: requester,
title: NEEDS_REFRESH_PREFIX + title,
description: NEEDS_REFRESH_PREFIX,
timeAllottedInSeconds: hit.timeAllottedInSeconds,
batchSize: hit.batchSize,
qualsRequired: hit.qualsRequired
};
};
| Change [REFRESH_REQUIRED] string into constant. | Change [REFRESH_REQUIRED] string into constant.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -1,20 +1,22 @@
import { QueueItem, SearchResult } from '../types';
import * as v4 from 'uuid/v4';
+const NEEDS_REFRESH_PREFIX = '[REFRESH_REQUIRED]';
+
export const blankQueueItem = (groupId: string): QueueItem => ({
groupId,
- hitId: '[REFRESH_REQUIRED]' + v4(),
- assignmentId: '[REFRESH_REQUIRED]' + v4(),
+ hitId: NEEDS_REFRESH_PREFIX + v4(),
+ assignmentId: NEEDS_REFRESH_PREFIX + v4(),
requester: {
- name: '[REFRESH_REQUIRED]',
- id: '[REFRESH_REQUIRED]' + v4()
+ name: NEEDS_REFRESH_PREFIX,
+ id: NEEDS_REFRESH_PREFIX + v4()
},
reward: 0,
- taskId: 'REFRESH_REQUIRED',
+ taskId: NEEDS_REFRESH_PREFIX + v4(),
timeLeftInSeconds: 0,
timeAllottedInSeconds: 0,
- title: '[REFRESH_REQUIRED]',
- description: '[REFRESH_REQUIRED]',
+ title: NEEDS_REFRESH_PREFIX,
+ description: NEEDS_REFRESH_PREFIX,
batchSize: 0,
qualsRequired: []
});
@@ -23,14 +25,14 @@
const { groupId, reward, timeAllottedInSeconds, requester, title } = hit;
return {
groupId,
- hitId: '[REFRESH_REQUIRED]' + v4(),
- assignmentId: '[REFRESH_REQUIRED]' + v4(),
- taskId: '[REFRESH_REQUIRED]' + v4(),
+ hitId: NEEDS_REFRESH_PREFIX + v4(),
+ assignmentId: NEEDS_REFRESH_PREFIX + v4(),
+ taskId: NEEDS_REFRESH_PREFIX + v4(),
reward,
timeLeftInSeconds: timeAllottedInSeconds,
requester: requester,
- title: '[REFRESH_REQUIRED]' + title,
- description: '[REFRESH_REQUIRED]',
+ title: NEEDS_REFRESH_PREFIX + title,
+ description: NEEDS_REFRESH_PREFIX,
timeAllottedInSeconds: hit.timeAllottedInSeconds,
batchSize: hit.batchSize,
qualsRequired: hit.qualsRequired |
e75da1d3603b6b54ccf320ec510f72c99ba71b83 | src/App.tsx | src/App.tsx | import * as React from 'react'
import { Component } from 'react'
import { StyleSheet } from 'react-native'
import { Text } from 'react-native'
import { View } from 'react-native'
import { Card } from './Card'
import { Circle } from './Circle'
import { Draggable } from './Draggable'
import { Suit } from './Suit'
export default class App extends Component<{}, void> {
private styles = StyleSheet.create({
container: {
alignItems: 'center',
backgroundColor: '#3b3',
flex: 1,
justifyContent: 'center'
}
})
public render() {
return (
<View style={this.styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>2 + 2 = {this.sum(2, 2)}</Text>
<Circle
color={'#ffb'}
size={40}
/>
<Draggable
startPosition={
{
left: 50,
top: 80
}
}
>
<Card
suit={Suit.Spades}
value={10}
/>
</Draggable>
</View>
)
}
private sum(a: number, b: number) {
return a + b
}
} | import * as React from 'react'
import { Component } from 'react'
import { StyleSheet } from 'react-native'
import { Text } from 'react-native'
import { View } from 'react-native'
import { Card } from './Card'
import { Draggable } from './Draggable'
import { Suit } from './Suit'
export default class App extends Component<{}, void> {
private styles = StyleSheet.create({
container: {
alignItems: 'center',
backgroundColor: '#3b3',
flex: 1,
justifyContent: 'center'
}
})
public render() {
return (
<View style={this.styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Draggable
startPosition={
{
left: 50,
top: 80
}
}
>
<Card
suit={Suit.Spades}
value={10}
/>
</Draggable>
</View>
)
}
} | Remove unused text and circle | Remove unused text and circle
| TypeScript | mit | janaagaard75/desert-walk,janaagaard75/desert-walk | ---
+++
@@ -5,7 +5,6 @@
import { View } from 'react-native'
import { Card } from './Card'
-import { Circle } from './Circle'
import { Draggable } from './Draggable'
import { Suit } from './Suit'
@@ -23,11 +22,6 @@
return (
<View style={this.styles.container}>
<Text>Open up App.js to start working on your app!</Text>
- <Text>2 + 2 = {this.sum(2, 2)}</Text>
- <Circle
- color={'#ffb'}
- size={40}
- />
<Draggable
startPosition={
{
@@ -44,8 +38,4 @@
</View>
)
}
-
- private sum(a: number, b: number) {
- return a + b
- }
} |
62805b4e7a4a426cb32c18a5ec5e8583f8f9d2fc | packages/kernel-relay/__tests__/index.spec.ts | packages/kernel-relay/__tests__/index.spec.ts | import { gql } from "apollo-server";
import { createTestClient } from "apollo-server-testing";
import { server } from "../src";
describe("Queries", () => {
it("returns a list of kernelspecs", async () => {
const { query } = createTestClient(server);
const LIST_KERNELSPECS = gql`
query GetKernels {
listKernelSpecs {
name
}
}
`;
const response = await query({ query: LIST_KERNELSPECS });
expect(response).not.toBeNull();
expect(response.data.listKernelSpecs.length).toBeGreaterThan(0);
});
});
describe("Mutations", () => {
let kernelId;
it("launches a kernel", async () => {
const { mutate } = createTestClient(server);
const START_KERNEL = gql`
mutation StartJupyterKernel {
startKernel(name: "python3") {
id
status
}
}
`;
const response = await mutate({ mutation: START_KERNEL });
kernelId = response.data.startKernel.id;
expect(response).not.toBeNull();
expect(response.data.startKernel.status).toBe("launched");
});
it("shuts down a kernel", async () => {
const { mutate } = createTestClient(server);
const SHUTDOWN_KERNEL = gql`
mutation KillJupyterKernel($id: ID) {
shutdownKernel(id: $id) {
id
status
}
}
`;
const response = await mutate({
mutation: SHUTDOWN_KERNEL,
variables: { id: kernelId }
});
expect(response).not.toBeNull();
expect(response.data.shutdownKernel.status).toBe("shutdown");
});
});
| import { gql } from "apollo-server";
import { createTestClient } from "apollo-server-testing";
import { server } from "../src";
describe("Queries", () => {
it("returns a list of kernelspecs", async () => {
const { query } = createTestClient(server);
const LIST_KERNELSPECS = gql`
query GetKernels {
listKernelSpecs {
name
}
}
`;
const response = await query({ query: LIST_KERNELSPECS });
expect(response).toMatchSnapshot();
});
});
describe("Mutations", () => {
let kernelId;
it("launches a kernel", async () => {
const { mutate } = createTestClient(server);
const START_KERNEL = gql`
mutation StartJupyterKernel {
startKernel(name: "python3") {
id
status
}
}
`;
const response = await mutate({ mutation: START_KERNEL });
kernelId = response.data.startKernel.id;
expect(response).toMatchSnapshot();
});
it("shuts down a kernel", async () => {
const { mutate } = createTestClient(server);
const SHUTDOWN_KERNEL = gql`
mutation KillJupyterKernel($id: ID) {
shutdownKernel(id: $id) {
id
status
}
}
`;
const response = await mutate({
mutation: SHUTDOWN_KERNEL,
variables: { id: kernelId }
});
expect(response).toMatchSnapshot();
});
});
| Use Jest snapshots in tests | Use Jest snapshots in tests
| TypeScript | bsd-3-clause | nteract/composition,nteract/composition,nteract/nteract,nteract/nteract,nteract/composition,nteract/nteract,nteract/nteract,nteract/nteract | ---
+++
@@ -13,8 +13,7 @@
}
`;
const response = await query({ query: LIST_KERNELSPECS });
- expect(response).not.toBeNull();
- expect(response.data.listKernelSpecs.length).toBeGreaterThan(0);
+ expect(response).toMatchSnapshot();
});
});
@@ -33,8 +32,7 @@
const response = await mutate({ mutation: START_KERNEL });
kernelId = response.data.startKernel.id;
- expect(response).not.toBeNull();
- expect(response.data.startKernel.status).toBe("launched");
+ expect(response).toMatchSnapshot();
});
it("shuts down a kernel", async () => {
const { mutate } = createTestClient(server);
@@ -50,7 +48,7 @@
mutation: SHUTDOWN_KERNEL,
variables: { id: kernelId }
});
- expect(response).not.toBeNull();
- expect(response.data.shutdownKernel.status).toBe("shutdown");
+
+ expect(response).toMatchSnapshot();
});
}); |
9f181b6c00b2581d2eb0d07c4bdf7c51f5e8d4f7 | functions/src/schedule-view/schedule-view-data.ts | functions/src/schedule-view/schedule-view-data.ts | type Optional<T> = T | null
export interface Schedule {
pages: SchedulePage[]
}
export interface SchedulePage {
day: Day
events: Event[]
}
export interface Day {
id: string
date: Date
}
export interface Event {
id: string
title: string
startTime: Date
endTime: Date
place: Optional<Place>
track: Optional<Track>
speakers: Speaker[]
experienceLevel: Optional<string>
type: string
description: Optional<string>
}
export interface Place {
id: string
name: string
floor: Optional<string>
}
export interface Track {
id: string
name: string
accentColor: Optional<string>
textColor: Optional<string>
iconUrl: Optional<string>
}
export interface Speaker {
id: string
name: string
bio: string
companyName: Optional<string>
companyUrl: Optional<string>
personalUrl: Optional<string>
photoUrl: Optional<string>
twitterUsername: Optional<string>
}
| export interface Schedule {
pages: SchedulePage[]
}
export interface SchedulePage {
day: Day
events: Event[]
}
export interface Day {
id: string
date: Date
}
export interface Event {
id: string
title: string
startTime: Date
endTime: Date
place: Place | null
track: Track | null
speakers: Speaker[]
experienceLevel: string | null
type: string
description: string | null
}
export interface Place {
id: string
name: string
floor: string | null
}
export interface Track {
id: string
name: string
accentColor: string | null
textColor: string | null
iconUrl: string | null
}
export interface Speaker {
id: string
name: string
bio: string
companyName: string | null
companyUrl: string | null
personalUrl: string | null
photoUrl: string | null
twitterUsername: string | null
}
| Use T | null and remove duplicated optional declaration | Use T | null and remove duplicated optional declaration
| TypeScript | apache-2.0 | squanchy-dev/squanchy-firebase,squanchy-dev/squanchy-firebase | ---
+++
@@ -1,5 +1,3 @@
-type Optional<T> = T | null
-
export interface Schedule {
pages: SchedulePage[]
}
@@ -19,35 +17,35 @@
title: string
startTime: Date
endTime: Date
- place: Optional<Place>
- track: Optional<Track>
+ place: Place | null
+ track: Track | null
speakers: Speaker[]
- experienceLevel: Optional<string>
+ experienceLevel: string | null
type: string
- description: Optional<string>
+ description: string | null
}
export interface Place {
id: string
name: string
- floor: Optional<string>
+ floor: string | null
}
export interface Track {
id: string
name: string
- accentColor: Optional<string>
- textColor: Optional<string>
- iconUrl: Optional<string>
+ accentColor: string | null
+ textColor: string | null
+ iconUrl: string | null
}
export interface Speaker {
id: string
name: string
bio: string
- companyName: Optional<string>
- companyUrl: Optional<string>
- personalUrl: Optional<string>
- photoUrl: Optional<string>
- twitterUsername: Optional<string>
+ companyName: string | null
+ companyUrl: string | null
+ personalUrl: string | null
+ photoUrl: string | null
+ twitterUsername: string | null
} |
7f20c7c574ece194dc849e9f973d8b04ced4d4c0 | src/types/Config.ts | src/types/Config.ts | export default interface Config {
tags: string[];
exports: { [files: string]: string | string[] };
};
| export default interface Config {
tags?: string[];
exports?: { [files: string]: string | string[] };
};
| Make properties in depcop.json optional | Make properties in depcop.json optional
| TypeScript | mit | smikula/good-fences,smikula/good-fences | ---
+++
@@ -1,4 +1,4 @@
export default interface Config {
- tags: string[];
- exports: { [files: string]: string | string[] };
+ tags?: string[];
+ exports?: { [files: string]: string | string[] };
}; |
c4dc21875a53d2ee669cfb5e950c75241943508a | app/src/ui/branches/ci-status.tsx | app/src/ui/branches/ci-status.tsx | import * as React from 'react'
import { Octicon, OcticonSymbol } from '../octicons'
import { APIRefState } from '../../lib/api'
import { assertNever } from '../../lib/fatal-error'
import * as classNames from 'classnames'
import { PullRequestStatus } from '../../models/pull-request'
interface ICIStatusProps {
/** The classname for the underlying element. */
readonly className?: string
/** The status to display. */
readonly status: PullRequestStatus
}
/** The little CI status indicator. */
export class CIStatus extends React.Component<ICIStatusProps, {}> {
public render() {
const status = this.props.status
const state = status.state
const ciTitle = `Commit status: ${state}`
return (
<Octicon
className={classNames(
'ci-status',
`ci-status-${state}`,
this.props.className
)}
symbol={getSymbolForState(state)}
title={ciTitle}
/>
)
}
}
function getSymbolForState(state: APIRefState): OcticonSymbol {
switch (state) {
case 'pending':
return OcticonSymbol.primitiveDot
case 'failure':
return OcticonSymbol.x
case 'success':
return OcticonSymbol.check
}
return assertNever(state, `Unknown state: ${state}`)
}
| import * as React from 'react'
import { Octicon, OcticonSymbol } from '../octicons'
import { APIRefState } from '../../lib/api'
import { assertNever } from '../../lib/fatal-error'
import * as classNames from 'classnames'
import { PullRequestStatus } from '../../models/pull-request'
interface ICIStatusProps {
/** The classname for the underlying element. */
readonly className?: string
/** The status to display. */
readonly status: PullRequestStatus
}
/** The little CI status indicator. */
export class CIStatus extends React.Component<ICIStatusProps, {}> {
public render() {
const status = this.props.status
const ciTitle = generateStatusHistory(status)
const state = status.state
return (
<Octicon
className={classNames(
'ci-status',
`ci-status-${state}`,
this.props.className
)}
symbol={getSymbolForState(state)}
title={ciTitle}
/>
)
}
}
function generateStatusHistory(prStatus: PullRequestStatus): string {
return prStatus.statuses.reduce(
(prev, curr) => `${prev}\n${curr.description}`,
`Commit status: ${prStatus.state}`
)
}
function getSymbolForState(state: APIRefState): OcticonSymbol {
switch (state) {
case 'pending':
return OcticonSymbol.primitiveDot
case 'failure':
return OcticonSymbol.x
case 'success':
return OcticonSymbol.check
}
return assertNever(state, `Unknown state: ${state}`)
}
| Add function to generate more descriptive pr status | Add function to generate more descriptive pr status
| TypeScript | mit | say25/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,shiftkey/desktop,kactus-io/kactus,say25/desktop,kactus-io/kactus,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,say25/desktop,shiftkey/desktop,shiftkey/desktop,say25/desktop,j-f1/forked-desktop,kactus-io/kactus,desktop/desktop,artivilla/desktop,j-f1/forked-desktop,desktop/desktop,desktop/desktop,artivilla/desktop,artivilla/desktop | ---
+++
@@ -17,8 +17,9 @@
export class CIStatus extends React.Component<ICIStatusProps, {}> {
public render() {
const status = this.props.status
+ const ciTitle = generateStatusHistory(status)
const state = status.state
- const ciTitle = `Commit status: ${state}`
+
return (
<Octicon
className={classNames(
@@ -33,6 +34,13 @@
}
}
+function generateStatusHistory(prStatus: PullRequestStatus): string {
+ return prStatus.statuses.reduce(
+ (prev, curr) => `${prev}\n${curr.description}`,
+ `Commit status: ${prStatus.state}`
+ )
+}
+
function getSymbolForState(state: APIRefState): OcticonSymbol {
switch (state) {
case 'pending': |
33cbef3840faea210b52f8d49d54416059b1ae67 | src/main-process/app-window.ts | src/main-process/app-window.ts | import {BrowserWindow} from 'electron'
import Stats from './stats'
export default class AppWindow {
private window: Electron.BrowserWindow
private stats: Stats
public constructor(stats: Stats) {
this.window = new BrowserWindow(
{
width: 800,
height: 600,
show: false,
titleBarStyle: 'hidden'
})
this.stats = stats
}
public load() {
let startLoad: number = null
this.window.webContents.on('did-finish-load', () => {
if (process.env.NODE_ENV === 'development') {
this.window.webContents.openDevTools()
}
this.window.show()
const now = Date.now()
this.rendererLog(`Loading: ${now - startLoad}ms`)
this.rendererLog(`Launch: ${now - this.stats.launchTime}ms`)
})
this.window.webContents.on('did-fail-load', () => {
this.window.webContents.openDevTools()
this.window.show()
})
startLoad = Date.now()
this.window.loadURL(`file://${__dirname}/../../static/index.html`)
}
public onClose(fn: () => void) {
this.window.on('closed', fn)
}
private rendererLog(msg: string) {
this.window.webContents.send('log', msg)
}
}
| import {BrowserWindow} from 'electron'
import Stats from './stats'
export default class AppWindow {
private window: Electron.BrowserWindow
private stats: Stats
public constructor(stats: Stats) {
this.window = new BrowserWindow(
{
width: 800,
height: 600,
show: false,
titleBarStyle: 'hidden',
// This fixes subpixel aliasing on Windows
// See https://github.com/atom/atom/commit/683bef5b9d133cb194b476938c77cc07fd05b972
backgroundColor: "#fff"
})
this.stats = stats
}
public load() {
let startLoad: number = null
this.window.webContents.on('did-finish-load', () => {
if (process.env.NODE_ENV === 'development') {
this.window.webContents.openDevTools()
}
this.window.show()
const now = Date.now()
this.rendererLog(`Loading: ${now - startLoad}ms`)
this.rendererLog(`Launch: ${now - this.stats.launchTime}ms`)
})
this.window.webContents.on('did-fail-load', () => {
this.window.webContents.openDevTools()
this.window.show()
})
startLoad = Date.now()
this.window.loadURL(`file://${__dirname}/../../static/index.html`)
}
public onClose(fn: () => void) {
this.window.on('closed', fn)
}
private rendererLog(msg: string) {
this.window.webContents.send('log', msg)
}
}
| Add explicit window background color to fix subpixel aliasing on Windows | Add explicit window background color to fix subpixel aliasing on Windows
| TypeScript | mit | BugTesterTest/desktops,j-f1/forked-desktop,kactus-io/kactus,shiftkey/desktop,hjobrien/desktop,kactus-io/kactus,say25/desktop,say25/desktop,desktop/desktop,kactus-io/kactus,hjobrien/desktop,artivilla/desktop,gengjiawen/desktop,gengjiawen/desktop,desktop/desktop,BugTesterTest/desktops,gengjiawen/desktop,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop,shiftkey/desktop,shiftkey/desktop,hjobrien/desktop,gengjiawen/desktop,desktop/desktop,kactus-io/kactus,BugTesterTest/desktops,artivilla/desktop,artivilla/desktop,hjobrien/desktop,say25/desktop,j-f1/forked-desktop,desktop/desktop,BugTesterTest/desktops,say25/desktop,j-f1/forked-desktop | ---
+++
@@ -13,7 +13,10 @@
width: 800,
height: 600,
show: false,
- titleBarStyle: 'hidden'
+ titleBarStyle: 'hidden',
+ // This fixes subpixel aliasing on Windows
+ // See https://github.com/atom/atom/commit/683bef5b9d133cb194b476938c77cc07fd05b972
+ backgroundColor: "#fff"
})
this.stats = stats |
0d77a616d7877d0a8f5af383652d6619e0d6a5cd | app/javascript/charts/utils/backwardsCompat.ts | app/javascript/charts/utils/backwardsCompat.ts | interface BackwardsCompatChartView {
prototype: {
containerSelector(): string;
container_selector(): string;
createValueFormatter(): (value: number) => string;
isEmpty(): boolean;
is_empty(): boolean;
main_formatter(): (value: number) => string;
toggleFormat(): void;
toggle_format(): void;
updateLockIcon(): void;
update_lock_icon(): void;
};
}
/**
* Takes a Chart class and adds methods to make it backwards compatible with snake_case used in
* some parts of the old Sprockets-based code.
*
* Note this adds backwards-compatibility methods directly to the given class prototype; it does not
* create a new class.
*/
export default (klass: BackwardsCompatChartView): BackwardsCompatChartView => {
klass.prototype.container_selector = klass.prototype.containerSelector;
klass.prototype.main_formatter = klass.prototype.createValueFormatter;
klass.prototype.toggle_format = klass.prototype.toggleFormat;
klass.prototype.update_lock_icon = klass.prototype.updateLockIcon;
klass.prototype.is_empty = klass.prototype.isEmpty;
return klass;
};
| interface BackwardsCompatChartView {
prototype: {
containerSelector(): string;
container_selector(): string;
createValueFormatter(): (value: number) => string;
isEmpty(): boolean;
is_empty(): boolean;
main_formatter(): (value: number) => string;
toggleFormat(): void;
toggle_format(): void;
updateHeaderButtons(): void;
update_header(): void;
updateLockIcon(): void;
update_lock_icon(): void;
};
}
/**
* Takes a Chart class and adds methods to make it backwards compatible with snake_case used in
* some parts of the old Sprockets-based code.
*
* Note this adds backwards-compatibility methods directly to the given class prototype; it does not
* create a new class.
*/
export default (klass: BackwardsCompatChartView): BackwardsCompatChartView => {
klass.prototype.container_selector = klass.prototype.containerSelector;
klass.prototype.is_empty = klass.prototype.isEmpty;
klass.prototype.main_formatter = klass.prototype.createValueFormatter;
klass.prototype.toggle_format = klass.prototype.toggleFormat;
klass.prototype.update_header = klass.prototype.updateHeaderButtons;
klass.prototype.update_lock_icon = klass.prototype.updateLockIcon;
return klass;
};
| Fix missing update_header on new charts | Fix missing update_header on new charts
`update_header` on old charts is now `updateHeaderButtons`. The
conversion from new to old has been added to `backwardsCompat`.
| TypeScript | mit | quintel/etmodel,quintel/etmodel,quintel/etmodel,quintel/etmodel | ---
+++
@@ -8,6 +8,8 @@
main_formatter(): (value: number) => string;
toggleFormat(): void;
toggle_format(): void;
+ updateHeaderButtons(): void;
+ update_header(): void;
updateLockIcon(): void;
update_lock_icon(): void;
};
@@ -22,10 +24,11 @@
*/
export default (klass: BackwardsCompatChartView): BackwardsCompatChartView => {
klass.prototype.container_selector = klass.prototype.containerSelector;
+ klass.prototype.is_empty = klass.prototype.isEmpty;
klass.prototype.main_formatter = klass.prototype.createValueFormatter;
klass.prototype.toggle_format = klass.prototype.toggleFormat;
+ klass.prototype.update_header = klass.prototype.updateHeaderButtons;
klass.prototype.update_lock_icon = klass.prototype.updateLockIcon;
- klass.prototype.is_empty = klass.prototype.isEmpty;
return klass;
}; |
5929280081f43dceffdb5ba24f724abd87f0ad9c | source/services/dataContracts/dataContractsHelper/dataContractsHelper.service.ts | source/services/dataContracts/dataContractsHelper/dataContractsHelper.service.ts | 'use strict';
export interface IDataContractsHelper {
versionEndpoint(endpoint: string, versionNumber: number): string;
}
class DataContractsHelper implements IDataContractsHelper {
versionEndpoint(endpoint: string, versionNumber: number): string {
let endpointFragments: string[] = endpoint.split('api');
return endpointFragments.join('api/v' + versionNumber);
}
}
export let helper: IDataContractsHelper = new DataContractsHelper(); | 'use strict';
export interface IDataContractsHelper {
versionEndpoint(endpoint: string, versionNumber: number): string;
}
class DataContractsHelper implements IDataContractsHelper {
versionEndpoint(endpoint: string, versionNumber: number): string {
let versionExpression: RegEx = /v[0-9]+/;
let endpointFragments: string[];
let searchResult = endpoint.search(versionExpression);
if (searchResult !== -1) {
endpointFragments = endpoint.split(versionExpression);
} else {
endpointFragments = endpoint.split('api');
endpointFragments[0] += 'api/';
}
return endpointFragments.join('v' + versionNumber);
}
}
export let helper: IDataContractsHelper = new DataContractsHelper(); | Use a regular expression to check for a previous version number. If one exists, replace it. Otherwise, add a new version immediately after 'api' in the url. | Use a regular expression to check for a previous version number. If one exists, replace it. Otherwise, add a new version immediately after 'api' in the url.
| TypeScript | mit | SamGraber/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities | ---
+++
@@ -6,8 +6,18 @@
class DataContractsHelper implements IDataContractsHelper {
versionEndpoint(endpoint: string, versionNumber: number): string {
- let endpointFragments: string[] = endpoint.split('api');
- return endpointFragments.join('api/v' + versionNumber);
+ let versionExpression: RegEx = /v[0-9]+/;
+ let endpointFragments: string[];
+
+ let searchResult = endpoint.search(versionExpression);
+ if (searchResult !== -1) {
+ endpointFragments = endpoint.split(versionExpression);
+ } else {
+ endpointFragments = endpoint.split('api');
+ endpointFragments[0] += 'api/';
+ }
+
+ return endpointFragments.join('v' + versionNumber);
}
}
|
1f5920428392356903155634cb8fd90af06da62e | src/index.ts | src/index.ts | import Knex from 'knex';
import {
Identifiable,
ConnectorConstructor,
ModelStatic,
ModelConstructor,
Bindings
} from '@next-model/core';
export class NextModelKnexConnector<S extends Identifiable> implements ConnectorConstructor<S> {
knex: Knex;
constructor(options: Knex.Config) {
this.knex = Knex(options);
}
private tableName(model: ModelStatic<S>): string {
if (model.collectionName !== undefined) {
return model.collectionName;
} else {
return model.lowerModelName;
}
}
private table(model: ModelStatic<S>): Knex.QueryBuilder {
return this.knex(this.tableName(model));
}
};
export default NextModelKnexConnector;
| import Knex from 'knex';
import {
Identifiable,
ConnectorConstructor,
ModelStatic,
ModelConstructor,
Bindings
} from '@next-model/core';
export class NextModelKnexConnector<S extends Identifiable> implements ConnectorConstructor<S> {
knex: Knex;
constructor(options: Knex.Config) {
this.knex = Knex(options);
}
private tableName(model: ModelStatic<S>): string {
if (model.collectionName !== undefined) {
return model.collectionName;
} else {
return model.lowerModelName;
}
}
private table(model: ModelStatic<S>): Knex.QueryBuilder {
return this.knex(this.tableName(model));
}
query(model: ModelStatic<S>): Promise<ModelConstructor<S>[]> {
}
count(model: ModelStatic<S>): Promise<number> {
}
updateAll(model: ModelStatic<S>, attrs: Partial<S>): Promise<ModelConstructor<S>[]> {
}
deleteAll(model: ModelStatic<S>): Promise<ModelConstructor<S>[]> {
}
delete(instance: ModelConstructor<S>): Promise<ModelConstructor<S>> {
}
execute(query: string, bindings: Bindings): Promise<any[]> {
}
};
export default NextModelKnexConnector;
| Add placeholders for missing methods | Add placeholders for missing methods
| TypeScript | mit | tamino-martinius/node-next-model-knex-connector | ---
+++
@@ -27,6 +27,30 @@
}
+ query(model: ModelStatic<S>): Promise<ModelConstructor<S>[]> {
+
+ }
+
+ count(model: ModelStatic<S>): Promise<number> {
+
+ }
+
+ updateAll(model: ModelStatic<S>, attrs: Partial<S>): Promise<ModelConstructor<S>[]> {
+
+ }
+
+ deleteAll(model: ModelStatic<S>): Promise<ModelConstructor<S>[]> {
+
+ }
+
+ delete(instance: ModelConstructor<S>): Promise<ModelConstructor<S>> {
+
+ }
+
+ execute(query: string, bindings: Bindings): Promise<any[]> {
+
+ }
+
};
export default NextModelKnexConnector; |
c81edb9e1a4984dd6811b5a4b2777b0319d7b73a | src/providers/camera-service.ts | src/providers/camera-service.ts | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/fromPromise';
@Injectable()
export class CameraService {
constructor(public http: Http, public camera: Camera) {
console.log('Hello CameraService Provider');
}
public takePicture(): Observable<any> {
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true
};
return Observable.fromPromise(this.camera.getPicture(options));
}
}
| import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/fromPromise';
@Injectable()
export class CameraService {
constructor(public http: Http, public camera: Camera) {}
public takePicture(): Observable<any> {
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true
};
return Observable.fromPromise(this.camera.getPicture(options));
}
}
| Remove console log after initalisation | Remove console log after initalisation
| TypeScript | mit | IMSmobile/app,IMSmobile/app,IMSmobile/app,IMSmobile/app | ---
+++
@@ -8,9 +8,7 @@
@Injectable()
export class CameraService {
- constructor(public http: Http, public camera: Camera) {
- console.log('Hello CameraService Provider');
- }
+ constructor(public http: Http, public camera: Camera) {}
public takePicture(): Observable<any> {
|
df91a63fa9b2504e95d4bec159c216cda45ff852 | lib/directives/tree-drag.directive.ts | lib/directives/tree-drag.directive.ts | import { Directive, Input, HostListener, Renderer, ElementRef, DoCheck } from '@angular/core';
import { TreeDraggedElement } from '../models/tree-dragged-element.model';
const DRAG_OVER_CLASS = 'is-dragging-over';
@Directive({
selector: '[treeDrag]'
})
export class TreeDragDirective implements DoCheck {
@Input('treeDrag') draggedElement;
@Input() treeDragEnabled;
private _allowDrag = (node) => true;
constructor(private el: ElementRef, private renderer: Renderer, private treeDraggedElement: TreeDraggedElement) {
}
ngDoCheck() {
this.renderer.setElementAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled ? 'true' : 'false');
}
@HostListener('dragstart', ['$event']) onDragStart(ev) {
// setting the data is required by firefox
ev.dataTransfer.setData('text', ev.target.id);
this.draggedElement.mouseAction('dragStart', ev);
setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
}
@HostListener('dragend') onDragEnd() {
this.draggedElement.mouseAction('dragEnd');
this.treeDraggedElement.set(null);
}
}
| import { Directive, Input, HostListener, Renderer, ElementRef, DoCheck } from '@angular/core';
import { TreeDraggedElement } from '../models/tree-dragged-element.model';
const DRAG_OVER_CLASS = 'is-dragging-over';
@Directive({
selector: '[treeDrag]'
})
export class TreeDragDirective implements DoCheck {
@Input('treeDrag') draggedElement;
@Input() treeDragEnabled;
private _allowDrag = (node) => true;
constructor(private el: ElementRef, private renderer: Renderer, private treeDraggedElement: TreeDraggedElement) {
}
ngDoCheck() {
this.renderer.setElementAttribute(this.el.nativeElement, 'draggable', this.treeDragEnabled ? 'true' : 'false');
}
@HostListener('dragstart', ['$event']) onDragStart(ev) {
// setting the data is required by firefox
ev.dataTransfer.setData('text', ev.target.id);
if (this.draggedElement.mouseAction) {
this.draggedElement.mouseAction('dragStart', ev);
}
setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
}
@HostListener('dragend') onDragEnd() {
if (this.draggedElement.mouseAction) {
this.draggedElement.mouseAction('dragEnd');
}
this.treeDraggedElement.set(null);
}
}
| Check against mouseAction to not get an error | Check against mouseAction to not get an error
if the selection isn't a TreeNode.
| TypeScript | mit | 500tech/angular2-tree-component,Alexey3/angular-tree-component,sm-allen/angular-tree-component,500tech/angular2-tree-component,sm-allen/angular-tree-component,Alexey3/angular-tree-component,sm-allen/angular-tree-component,500tech/angular2-tree-component,Alexey3/angular-tree-component | ---
+++
@@ -23,14 +23,16 @@
// setting the data is required by firefox
ev.dataTransfer.setData('text', ev.target.id);
- this.draggedElement.mouseAction('dragStart', ev);
-
+ if (this.draggedElement.mouseAction) {
+ this.draggedElement.mouseAction('dragStart', ev);
+ }
setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
}
@HostListener('dragend') onDragEnd() {
- this.draggedElement.mouseAction('dragEnd');
-
+ if (this.draggedElement.mouseAction) {
+ this.draggedElement.mouseAction('dragEnd');
+ }
this.treeDraggedElement.set(null);
}
} |
1f7f0676fb07ffa274b1d12ef7ecd5b066938163 | src/Chamilo/Core/Repository/ContentObject/Rubric/Resources/Source/src/Domain/Choice.ts | src/Chamilo/Core/Repository/ContentObject/Rubric/Resources/Source/src/Domain/Choice.ts | export interface ChoiceJsonObject {
selected: boolean,
feedback: string,
hasFixedScore: boolean,
fixedScore: number,
criteriumId: string,
levelId: string
}
export default class Choice {
public selected: boolean;
public feedback: string;
public hasFixedScore: boolean = false;
public fixedScore: number = 10;
public static readonly FIXED_SCORE = 10;
constructor(selected: boolean = false, feedback: string = '') {
this.selected = selected;
this.feedback = feedback;
}
toJSON(criteriumId: string, levelId: string): ChoiceJsonObject {
return {
selected: this.selected,
feedback: this.feedback,
hasFixedScore: this.hasFixedScore,
fixedScore: this.fixedScore,
criteriumId: criteriumId,
levelId: levelId
}
}
static fromJSON(choice:string|ChoiceJsonObject):Choice {
let choiceObject: ChoiceJsonObject;
if (typeof choice === 'string') {
choiceObject = JSON.parse(choice);
} else {
choiceObject = choice;
}
let newChoice = new Choice(
choiceObject.selected,
choiceObject.feedback
);
newChoice.hasFixedScore = choiceObject.hasFixedScore;
newChoice.fixedScore = choiceObject.fixedScore;
return newChoice;
}}
| export interface ChoiceJsonObject {
selected: boolean,
feedback: string,
hasFixedScore: boolean,
fixedScore: number,
criteriumId: string,
levelId: string
}
export default class Choice {
public selected: boolean;
public feedback: string;
public hasFixedScore: boolean = false;
private fixedScore_: number = 10;
public static readonly FIXED_SCORE = 10;
constructor(selected: boolean = false, feedback: string = '') {
this.selected = selected;
this.feedback = feedback;
}
// @ts-ignore
get fixedScore() : number {
return this.fixedScore_;
}
// @ts-ignore
set fixedScore(v: number|string) {
if (typeof v === 'number') {
this.fixedScore_ = v;
} else {
this.fixedScore_ = parseFloat(v);
}
}
toJSON(criteriumId: string, levelId: string): ChoiceJsonObject {
return {
selected: this.selected,
feedback: this.feedback,
hasFixedScore: this.hasFixedScore,
fixedScore: this.fixedScore,
criteriumId: criteriumId,
levelId: levelId
}
}
static fromJSON(choice:string|ChoiceJsonObject):Choice {
let choiceObject: ChoiceJsonObject;
if (typeof choice === 'string') {
choiceObject = JSON.parse(choice);
} else {
choiceObject = choice;
}
let newChoice = new Choice(
choiceObject.selected,
choiceObject.feedback
);
newChoice.hasFixedScore = choiceObject.hasFixedScore;
newChoice.fixedScore = choiceObject.fixedScore;
return newChoice;
}}
| Make sure the fixed score value is a number. | Make sure the fixed score value is a number.
| TypeScript | mit | cosnics/cosnics,cosnics/cosnics,forelo/cosnics,cosnics/cosnics,forelo/cosnics,cosnics/cosnics,cosnics/cosnics,forelo/cosnics,forelo/cosnics,forelo/cosnics,cosnics/cosnics,cosnics/cosnics,forelo/cosnics,forelo/cosnics,forelo/cosnics,cosnics/cosnics | ---
+++
@@ -11,12 +11,26 @@
public selected: boolean;
public feedback: string;
public hasFixedScore: boolean = false;
- public fixedScore: number = 10;
+ private fixedScore_: number = 10;
public static readonly FIXED_SCORE = 10;
constructor(selected: boolean = false, feedback: string = '') {
this.selected = selected;
this.feedback = feedback;
+ }
+
+ // @ts-ignore
+ get fixedScore() : number {
+ return this.fixedScore_;
+ }
+
+ // @ts-ignore
+ set fixedScore(v: number|string) {
+ if (typeof v === 'number') {
+ this.fixedScore_ = v;
+ } else {
+ this.fixedScore_ = parseFloat(v);
+ }
}
toJSON(criteriumId: string, levelId: string): ChoiceJsonObject { |
5c008d8c6f678d2ed0bee64ced213fa1d06b92cb | applications/account/src/app/containers/mail/MailAutoReplySettings.tsx | applications/account/src/app/containers/mail/MailAutoReplySettings.tsx | import React from 'react';
import { c } from 'ttag';
import { AutoReplySection, SettingsPropsShared } from 'react-components';
import PrivateMainSettingsAreaWithPermissions from '../../components/PrivateMainSettingsAreaWithPermissions';
export const getAutoReply = () => {
return {
text: c('Title').t`Auto reply`,
to: '/mail/auto-reply',
icon: 'mailbox',
subsections: [
{
text: c('Title').t`Auto reply`,
id: 'auto-reply',
},
],
};
};
const MailAutoReplySettings = ({ location }: SettingsPropsShared) => {
return (
<PrivateMainSettingsAreaWithPermissions location={location} config={getAutoReply()}>
<AutoReplySection />
</PrivateMainSettingsAreaWithPermissions>
);
};
export default MailAutoReplySettings;
| import React from 'react';
import { c } from 'ttag';
import { AutoReplySection, SettingsPropsShared } from 'react-components';
import PrivateMainSettingsAreaWithPermissions from '../../components/PrivateMainSettingsAreaWithPermissions';
export const getAutoReply = () => {
return {
text: c('Title').t`Auto reply`,
to: '/mail/auto-reply',
icon: 'mailbox',
subsections: [{ id: 'auto-reply' }],
};
};
const MailAutoReplySettings = ({ location }: SettingsPropsShared) => {
return (
<PrivateMainSettingsAreaWithPermissions location={location} config={getAutoReply()}>
<AutoReplySection />
</PrivateMainSettingsAreaWithPermissions>
);
};
export default MailAutoReplySettings;
| Remove settings section title from Auto-Reply | Remove settings section title from Auto-Reply
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -10,12 +10,7 @@
text: c('Title').t`Auto reply`,
to: '/mail/auto-reply',
icon: 'mailbox',
- subsections: [
- {
- text: c('Title').t`Auto reply`,
- id: 'auto-reply',
- },
- ],
+ subsections: [{ id: 'auto-reply' }],
};
};
|
cf7169db9e658bdab086dbc7f4761f3629e85a9f | module/ladda-config.ts | module/ladda-config.ts | import { Injectable } from "@angular/core";
export interface LaddaConfigArgs {
style?: string;
spinnerSize?: number;
spinnerColor?: string;
spinnerLines?: number;
}
export let configAttributes: {[key: string]: keyof LaddaConfigArgs} = {
"data-style": "style",
"data-spinner-size": "spinnerSize",
"data-spinner-color": "spinnerColor",
"data-spinner-lines": "spinnerLines",
};
@Injectable()
export class LaddaConfig implements LaddaConfigArgs {
constructor(config: Object = {}) {
Object.assign(this, config);
}
}
| import { Injectable } from "@angular/core";
export type laddaStyle =
"expand-left" | "expand-right" | "expand-up" | "expand-down" |
"contract" | "contract-overlay" | "zoom-in" | "zoom-out" |
"slide-left" | "slide-right" | "slide-up" | "slide-down";
export interface LaddaConfigArgs {
style?: laddaStyle;
spinnerSize?: number;
spinnerColor?: string;
spinnerLines?: number;
}
export let configAttributes: {[key: string]: keyof LaddaConfigArgs} = {
"data-style": "style",
"data-spinner-size": "spinnerSize",
"data-spinner-color": "spinnerColor",
"data-spinner-lines": "spinnerLines",
};
@Injectable()
export class LaddaConfig implements LaddaConfigArgs {
constructor(config: Object = {}) {
Object.assign(this, config);
}
}
| Enable validation and code completion when setting a default style | Enable validation and code completion when setting a default style
| TypeScript | mit | moff/angular2-ladda,moff/angular2-ladda | ---
+++
@@ -1,7 +1,12 @@
import { Injectable } from "@angular/core";
+export type laddaStyle =
+ "expand-left" | "expand-right" | "expand-up" | "expand-down" |
+ "contract" | "contract-overlay" | "zoom-in" | "zoom-out" |
+ "slide-left" | "slide-right" | "slide-up" | "slide-down";
+
export interface LaddaConfigArgs {
- style?: string;
+ style?: laddaStyle;
spinnerSize?: number;
spinnerColor?: string;
spinnerLines?: number; |
66bb31af472b153a2739fa2f68544f879c6d9361 | src/Rendering/Html/EscapingHelpers.ts | src/Rendering/Html/EscapingHelpers.ts | export function escapeHtmlContent(content: string): string {
return htmlEscape(content, /[&<]/g)
}
export function escapeHtmlAttrValue(attrValue: string | number): string {
return htmlEscape(String(attrValue), /[&"]/g)
}
function htmlEscape(html: string, charsToEscape: RegExp): string {
return html.replace(
charsToEscape,
char => ESCAPED_HTML_ENTITIES_BY_CHAR[char])
}
const ESCAPED_HTML_ENTITIES_BY_CHAR: { [char: string]: string } = {
'&': '&',
'<': '<',
'"': '"'
}
| export function escapeHtmlContent(content: string): string {
return escapeHtml(content, /[&<]/g)
}
export function escapeHtmlAttrValue(attrValue: string | number): string {
return escapeHtml(String(attrValue), /[&"]/g)
}
function escapeHtml(html: string, charsToEscape: RegExp): string {
return html.replace(
charsToEscape,
char => ESCAPED_HTML_ENTITIES_BY_CHAR[char])
}
const ESCAPED_HTML_ENTITIES_BY_CHAR: { [char: string]: string } = {
'&': '&',
'<': '<',
'"': '"'
}
| Use more consistent function name | Use more consistent function name
| TypeScript | mit | start/up,start/up | ---
+++
@@ -1,12 +1,12 @@
export function escapeHtmlContent(content: string): string {
- return htmlEscape(content, /[&<]/g)
+ return escapeHtml(content, /[&<]/g)
}
export function escapeHtmlAttrValue(attrValue: string | number): string {
- return htmlEscape(String(attrValue), /[&"]/g)
+ return escapeHtml(String(attrValue), /[&"]/g)
}
-function htmlEscape(html: string, charsToEscape: RegExp): string {
+function escapeHtml(html: string, charsToEscape: RegExp): string {
return html.replace(
charsToEscape,
char => ESCAPED_HTML_ENTITIES_BY_CHAR[char]) |
f143c3b2c12b5676b3d82f1a7c822a6321f72554 | coreTable/OwidTableUtil.ts | coreTable/OwidTableUtil.ts | import { CoreTable } from "./CoreTable"
import { ColumnSlug } from "./CoreTableConstants"
import { OwidColumnDef, OwidTableSlugs } from "./OwidTableConstants"
export function timeColumnSlugFromColumnDef(def: OwidColumnDef) {
return def.isDailyMeasurement ? OwidTableSlugs.day : OwidTableSlugs.year
}
export function makeOriginalTimeSlugFromColumnSlug(slug: ColumnSlug) {
return `${slug}-originalTime`
}
export function getOriginalTimeColumnSlug(
table: CoreTable,
slug: ColumnSlug
): ColumnSlug | undefined {
const originalTimeSlug = makeOriginalTimeSlugFromColumnSlug(slug)
if (table.columnSlugs.includes(originalTimeSlug)) return originalTimeSlug
return table.timeColumn?.slug
}
| import { CoreTable } from "./CoreTable"
import { ColumnSlug } from "./CoreTableConstants"
import { OwidColumnDef, OwidTableSlugs } from "./OwidTableConstants"
export function timeColumnSlugFromColumnDef(def: OwidColumnDef) {
return def.isDailyMeasurement ? OwidTableSlugs.day : OwidTableSlugs.year
}
export function makeOriginalTimeSlugFromColumnSlug(slug: ColumnSlug) {
return `${slug}-originalTime`
}
export function getOriginalTimeColumnSlug(
table: CoreTable,
slug: ColumnSlug
): ColumnSlug | undefined {
const originalTimeSlug = makeOriginalTimeSlugFromColumnSlug(slug)
if (table.has(originalTimeSlug)) return originalTimeSlug
return table.timeColumn?.slug
}
| Use CoreTable.has() instead of columnSlugs.includes() | Use CoreTable.has() instead of columnSlugs.includes()
| TypeScript | mit | OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher | ---
+++
@@ -15,6 +15,6 @@
slug: ColumnSlug
): ColumnSlug | undefined {
const originalTimeSlug = makeOriginalTimeSlugFromColumnSlug(slug)
- if (table.columnSlugs.includes(originalTimeSlug)) return originalTimeSlug
+ if (table.has(originalTimeSlug)) return originalTimeSlug
return table.timeColumn?.slug
} |
bbb9261ed61b3999074a7d21123f3eed0105058b | src/app/units/states/edit/directives/unit-students-editor/student-campus-select/student-campus-select.component.ts | src/app/units/states/edit/directives/unit-students-editor/student-campus-select/student-campus-select.component.ts | import { Unit } from '../../../../../../ajs-upgraded-providers';
import { Component, Input, OnInit } from '@angular/core';
import { Campus } from 'src/app/api/models/campus/campus';
import { CampusService } from 'src/app/api/models/campus/campus.service';
import { MatSelectChange } from '@angular/material/select';
@Component({
selector: 'student-campus-select',
templateUrl: 'student-campus-select.component.html',
styleUrls: ['student-campus-select.component.scss']
})
export class StudentCampusSelectComponent implements OnInit {
@Input() unit: any;
@Input() student: any;
@Input() update: boolean;
private campuses: Campus[];
private originalCampusId: number;
constructor ( private campusService: CampusService ) {
}
ngOnChanges() {
this.originalCampusId = this.student.campus_id;
}
ngOnInit() {
this.campusService.query().subscribe((campuses) => {
this.campuses = campuses;
});
}
private campusChange(event: MatSelectChange) {
if(this.update) {
this.student.switchToCampus(event.value, this.originalCampusId, () => this.ngOnChanges())
}
}
}
| import { Unit } from '../../../../../../ajs-upgraded-providers';
import { Component, Input, OnInit } from '@angular/core';
import { Campus } from 'src/app/api/models/campus/campus';
import { CampusService } from 'src/app/api/models/campus/campus.service';
import { MatSelectChange } from '@angular/material/select';
@Component({
selector: 'student-campus-select',
templateUrl: 'student-campus-select.component.html',
styleUrls: ['student-campus-select.component.scss']
})
export class StudentCampusSelectComponent implements OnInit {
@Input() unit: any;
@Input() student: any;
@Input() update: boolean;
campuses: Campus[];
private originalCampusId: number;
constructor ( private campusService: CampusService ) {
}
ngOnChanges() {
this.originalCampusId = this.student.campus_id;
}
ngOnInit() {
this.campusService.query().subscribe((campuses) => {
this.campuses = campuses;
});
}
campusChange(event: MatSelectChange) {
if(this.update) {
this.student.switchToCampus(event.value, this.originalCampusId, () => this.ngOnChanges())
}
}
}
| Correct scope issues identified in deploy | FIX: Correct scope issues identified in deploy
| TypeScript | agpl-3.0 | doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web,doubtfire-lms/doubtfire-web | ---
+++
@@ -14,7 +14,7 @@
@Input() student: any;
@Input() update: boolean;
- private campuses: Campus[];
+ campuses: Campus[];
private originalCampusId: number;
constructor ( private campusService: CampusService ) {
@@ -30,7 +30,7 @@
});
}
- private campusChange(event: MatSelectChange) {
+ campusChange(event: MatSelectChange) {
if(this.update) {
this.student.switchToCampus(event.value, this.originalCampusId, () => this.ngOnChanges())
} |
ce44c3316b2dc99db6a128deed1a422a122c392d | client/src/reducers/token.ts | client/src/reducers/token.ts | import { Reducer } from 'redux';
import * as Cookies from 'js-cookie';
import { TokenAction, actionTypes } from '../actions/token';
import { TokenStateSchema, TokenEmptyState } from '../models/token';
export const tokenReducer: Reducer<TokenStateSchema> =
(state: TokenStateSchema = TokenEmptyState, action: TokenAction) => {
switch (action.type) {
case actionTypes.RECEIVE_TOKEN:
Cookies.set('token', action.token.token);
Cookies.set('user', action.username);
return {
...state,
user: action.username,
token: action.token.token
};
case actionTypes.DISCARD_TOKEN:
Cookies.remove('token');
Cookies.remove('user');
return {
...state,
user: '',
token: ''
};
default:
return state;
}
};
| import { Reducer } from 'redux';
import * as Cookies from 'js-cookie';
import { TokenAction, actionTypes } from '../actions/token';
import { TokenStateSchema, TokenEmptyState } from '../models/token';
export const tokenReducer: Reducer<TokenStateSchema> =
(state: TokenStateSchema = TokenEmptyState, action: TokenAction) => {
switch (action.type) {
case actionTypes.RECEIVE_TOKEN:
// Cookies.set('token', action.token.token);
// Cookies.set('user', action.username);
return {
...state,
user: action.username,
token: action.token.token
};
case actionTypes.DISCARD_TOKEN:
// Cookies.remove('token');
// Cookies.remove('user');
// Cookies.remove('sessionid');
return {
...state,
user: '',
token: ''
};
default:
return state;
}
};
| Update reducer to not alter cookie states | Update reducer to not alter cookie states
| TypeScript | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -9,16 +9,17 @@
switch (action.type) {
case actionTypes.RECEIVE_TOKEN:
- Cookies.set('token', action.token.token);
- Cookies.set('user', action.username);
+ // Cookies.set('token', action.token.token);
+ // Cookies.set('user', action.username);
return {
...state,
user: action.username,
token: action.token.token
};
case actionTypes.DISCARD_TOKEN:
- Cookies.remove('token');
- Cookies.remove('user');
+ // Cookies.remove('token');
+ // Cookies.remove('user');
+ // Cookies.remove('sessionid');
return {
...state,
user: '', |
1ae0d7512cd58558607b1b2b1fd0dfc0938b1841 | src/fetch.browser.ts | src/fetch.browser.ts | import { ErrorResponse } from "./types";
import { GLOBAL_OPTIONS, searchParams } from "./utils";
export const fetchGet = <T>(
url: string,
data: { [x: string]: string } = {},
signal?: AbortSignal
): Promise<T> => {
const options: RequestInit = {
method: "GET"
};
if (signal !== undefined) {
options.signal = signal;
}
if (typeof GLOBAL_OPTIONS.key === "string" && GLOBAL_OPTIONS.key.length > 0) {
data["key"] = GLOBAL_OPTIONS.key;
}
let hasError = false;
return fetch(
`${GLOBAL_OPTIONS.baseUrl}/${url}?${searchParams(data)}`,
options
)
.then(response => {
hasError = !response.ok;
return response.json();
})
.then(data => {
if (hasError) {
throw (data as ErrorResponse).error;
}
return data;
});
};
| import { ErrorResponse } from "./types";
import { GLOBAL_OPTIONS, searchParams } from "./utils";
import { version } from "./version";
export const fetchGet = <T>(
url: string,
data: { [x: string]: string } = {},
signal?: AbortSignal
): Promise<T> => {
const options: RequestInit = {
method: "GET",
headers: {
'X-W3W-Wrapper': `what3words-JavaScript/${version} (${navigator.userAgent})`,
}
};
if (signal !== undefined) {
options.signal = signal;
}
if (typeof GLOBAL_OPTIONS.key === "string" && GLOBAL_OPTIONS.key.length > 0) {
data["key"] = GLOBAL_OPTIONS.key;
}
let hasError = false;
return fetch(
`${GLOBAL_OPTIONS.baseUrl}/${url}?${searchParams(data)}`,
options
)
.then(response => {
hasError = !response.ok;
return response.json();
})
.then(data => {
if (hasError) {
throw (data as ErrorResponse).error;
}
return data;
});
};
| Add `X-W3W-Wrapper` head to API requests | Add `X-W3W-Wrapper` head to API requests
| TypeScript | mit | OpenCageData/js-geo-what3words,what3words/w3w-node-wrapper,what3words/w3w-node-wrapper | ---
+++
@@ -1,5 +1,6 @@
import { ErrorResponse } from "./types";
import { GLOBAL_OPTIONS, searchParams } from "./utils";
+import { version } from "./version";
export const fetchGet = <T>(
url: string,
@@ -7,7 +8,10 @@
signal?: AbortSignal
): Promise<T> => {
const options: RequestInit = {
- method: "GET"
+ method: "GET",
+ headers: {
+ 'X-W3W-Wrapper': `what3words-JavaScript/${version} (${navigator.userAgent})`,
+ }
};
if (signal !== undefined) { |
76731052636bf79c675a8d8f4633ab00e9fba38f | app/Version.ts | app/Version.ts | class Version
{
static publishDate: Date = null;
static etc: string = null;
static get version()
{
let date = Version.publishDate || new Date();
return date.getUTCFullYear().toString().substr(2)
+ ("0" + date.getUTCMonth()).slice(-2)
+ ("0" + date.getUTCDay()).slice(-2)
+ "-"
+ ("0" + date.getUTCHours()).slice(-2)
+ ("0" + date.getUTCMinutes()).slice(-2);
}
static get variant()
{
return [Version.etc, Version.publishDate ? null : "dev"].filter(_ => _ != null).join("-");
}
} | class Version
{
static publishDate: Date = null;
static etc: string = null;
static get version()
{
let date = Version.publishDate || new Date();
return date.getUTCFullYear().toString().substr(2)
+ ("0" + (date.getUTCMonth() + 1)).slice(-2)
+ ("0" + date.getUTCDate()).slice(-2)
+ "-"
+ ("0" + date.getUTCHours()).slice(-2)
+ ("0" + date.getUTCMinutes()).slice(-2);
}
static get variant()
{
return [Version.etc, Version.publishDate ? null : "dev"].filter(_ => _ != null).join("-");
}
} | Fix version string to show proper date | Fix version string to show proper date
| TypeScript | mit | InfBuild/InfBuild,InfBuild/InfBuild,InfBuild/InfBuild | ---
+++
@@ -8,8 +8,8 @@
let date = Version.publishDate || new Date();
return date.getUTCFullYear().toString().substr(2)
- + ("0" + date.getUTCMonth()).slice(-2)
- + ("0" + date.getUTCDay()).slice(-2)
+ + ("0" + (date.getUTCMonth() + 1)).slice(-2)
+ + ("0" + date.getUTCDate()).slice(-2)
+ "-"
+ ("0" + date.getUTCHours()).slice(-2)
+ ("0" + date.getUTCMinutes()).slice(-2); |
95b60c5acc2888398e9562ba4bc97d94b4ad90cb | client/src/components/bookmarkStar.tsx | client/src/components/bookmarkStar.tsx | import * as React from 'react';
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
import './bookmarkStar.less';
export interface Props {
active: boolean;
callback?: () => any;
}
function BookmarkStar({active, callback}: Props) {
const className = active ? 'icon-bookmark-active' : '';
const tooltip = active ? 'Remove from bookmarks' : 'Add to bookmarks';
return (
<OverlayTrigger placement="bottom" overlay={<Tooltip id="tooltipId">{tooltip}</Tooltip>}>
<span className={`icon-bookmark ${className}`}>
<a onClick={callback}> <i className="fa fa-star" aria-hidden="true"/> </a>
</span>
</OverlayTrigger>
);
}
export default BookmarkStar;
| import * as React from 'react';
import { OverlayTrigger, Tooltip } from 'react-bootstrap';
import './bookmarkStar.less';
export interface Props {
active: boolean;
callback?: () => any;
}
function BookmarkStar({active, callback}: Props) {
const className = active ? 'icon-bookmark-active' : '';
const tooltip = active ? 'Remove from bookmarks' : 'Add to bookmarks';
return (
<span className={`icon-bookmark ${className}`}>
<OverlayTrigger placement="bottom" overlay={<Tooltip id="tooltipId">{tooltip}</Tooltip>}>
<a onClick={callback}><i className="fa fa-star" aria-hidden="true"/> </a>
</OverlayTrigger>
</span>
);
}
export default BookmarkStar;
| Fix the bookmark tooltip issue | Fix the bookmark tooltip issue
| TypeScript | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -12,11 +12,11 @@
const className = active ? 'icon-bookmark-active' : '';
const tooltip = active ? 'Remove from bookmarks' : 'Add to bookmarks';
return (
- <OverlayTrigger placement="bottom" overlay={<Tooltip id="tooltipId">{tooltip}</Tooltip>}>
- <span className={`icon-bookmark ${className}`}>
- <a onClick={callback}> <i className="fa fa-star" aria-hidden="true"/> </a>
- </span>
- </OverlayTrigger>
+ <span className={`icon-bookmark ${className}`}>
+ <OverlayTrigger placement="bottom" overlay={<Tooltip id="tooltipId">{tooltip}</Tooltip>}>
+ <a onClick={callback}><i className="fa fa-star" aria-hidden="true"/> </a>
+ </OverlayTrigger>
+ </span>
);
}
|
8fe158f79e8109a95aa2f65b7356330bb2e5704b | src/app/compose/compose.component.ts | src/app/compose/compose.component.ts | import {Component, Inject} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {Store} from '@ngrx/store';
import {IAppState} from '../store/index';
import {SEND_EMAIL} from '../store/email/email.actions';
@Component({
selector: 'compose',
styles: [require('./compose.component.scss')],
templateUrl: './compose.component.html',
providers: [NgbActiveModal]
})
export class ComposeComponent {
form: FormGroup;
constructor(@Inject(FormBuilder) fb: FormBuilder,
public activeModal: NgbActiveModal,
public store: Store<IAppState>) {
this.form = fb.group({
toField: ['[email protected],[email protected]', Validators.required],
ccField: ['[email protected]'],
bccField: ['[email protected]'],
subject: ['From MailGun'],
emailBodyText: ['Hi, This is a test message sent using MailGun/SendGrid']
});
}
send() {
if (this.form.valid) {
this.store.dispatch({
type: SEND_EMAIL,
payload: this.form.value
});
this.form.reset();
}
}
close() {
this.activeModal.dismiss();
}
}
| import {Component, Inject} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {Store} from '@ngrx/store';
import {IAppState} from '../store/index';
import {SEND_EMAIL} from '../store/email/email.actions';
@Component({
selector: 'compose',
styles: [require('./compose.component.scss')],
templateUrl: './compose.component.html',
providers: [NgbActiveModal]
})
export class ComposeComponent {
form: FormGroup;
constructor(@Inject(FormBuilder) fb: FormBuilder,
public activeModal: NgbActiveModal,
public store: Store<IAppState>) {
this.form = fb.group({
/* // For testing only
toField: ['[email protected],[email protected]', Validators.required],
ccField: ['[email protected]'],
bccField: ['[email protected]'],
subject: ['From MailGun'],
emailBodyText: ['Hi, This is a test message sent using MailGun/SendGrid']*/
toField: ['', Validators.required],
ccField: [''],
bccField: [''],
subject: [''],
emailBodyText: ['']
});
}
send() {
if (this.form.valid) {
this.store.dispatch({
type: SEND_EMAIL,
payload: this.form.value
});
this.form.reset();
}
}
close() {
this.activeModal.dismiss();
}
}
| Remove the default Addresses and Message | Remove the default Addresses and Message
| TypeScript | mit | muthukumarsp/e-mail-application,muthukumarsp/e-mail-application,muthukumarsp/e-mail-application | ---
+++
@@ -18,11 +18,17 @@
public activeModal: NgbActiveModal,
public store: Store<IAppState>) {
this.form = fb.group({
- toField: ['[email protected],[email protected]', Validators.required],
- ccField: ['[email protected]'],
- bccField: ['[email protected]'],
- subject: ['From MailGun'],
- emailBodyText: ['Hi, This is a test message sent using MailGun/SendGrid']
+ /* // For testing only
+ toField: ['[email protected],[email protected]', Validators.required],
+ ccField: ['[email protected]'],
+ bccField: ['[email protected]'],
+ subject: ['From MailGun'],
+ emailBodyText: ['Hi, This is a test message sent using MailGun/SendGrid']*/
+ toField: ['', Validators.required],
+ ccField: [''],
+ bccField: [''],
+ subject: [''],
+ emailBodyText: ['']
});
} |
2a316f5e2906eb9bc0d57618a980e5fbccd62e17 | src/App.tsx | src/App.tsx | import styled from 'styled-components'
import { Intro, CheckboxTree } from './components'
import data from './data/data.json'
import github from './assets/github.svg'
const Main = styled.main`
display: flex;
flex-direction: column;
width: 80%;
max-width: 64rem;
height: 100vh;
margin: 0 auto;
`
const Section = styled.section`
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
`
const Footer = styled.footer`
align-self: center;
margin: 2rem;
`
export const App = () => (
<Main>
<header>
<Intro />
</header>
<Section>
<article>
<CheckboxTree data={data} />
</article>
</Section>
<Footer>
<a href='https://github.com/joelgeorgev/react-checkbox-tree'>
<img src={github} alt='Go to GitHub repository page' />
</a>
</Footer>
</Main>
)
| import styled from 'styled-components'
import { Intro, CheckboxTree } from './components'
import data from './data/data.json'
import github from './assets/github.svg'
const Main = styled.main`
display: flex;
flex-direction: column;
width: 80%;
max-width: 64rem;
height: 100vh;
margin: 0 auto;
`
const Section = styled.section`
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
`
const Footer = styled.footer`
align-self: center;
margin: 2rem;
`
export const App = () => (
<Main>
<header>
<Intro />
</header>
<Section>
<article>
<CheckboxTree data={data} />
</article>
</Section>
<Footer>
<a href='https://github.com/joelgeorgev/react-checkbox-tree'>
<img src={github} alt='Go to GitHub repository page' />
</a>
</Footer>
</Main>
)
| Add empty line before svg import | Add empty line before svg import
| TypeScript | mit | joelgeorgev/react-checkbox-tree,joelgeorgev/react-checkbox-tree | ---
+++
@@ -2,6 +2,7 @@
import { Intro, CheckboxTree } from './components'
import data from './data/data.json'
+
import github from './assets/github.svg'
const Main = styled.main` |
dc2989b895eb7a950f923ec499f159ab7bbcfea8 | e2e/app.e2e-spec.ts | e2e/app.e2e-spec.ts | import { AppPage } from './app.po';
import { browser, by, element } from 'protractor';
describe('eviction-maps App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
page.navigateTo();
});
it('should have the map element', () => {
expect(page.getMapElement().isPresent()).toBeTruthy();
});
it('should have a search bar', () => {
expect(page.getSearchHeaderElement().isPresent()).toBeTruthy();
});
it('should update the route', () => {
expect(page.getFullPath()).toContain('states');
});
});
| import { AppPage } from './app.po';
import { browser, by, element } from 'protractor';
describe('eviction-maps App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
page.navigateTo();
});
it('should have the map element', () => {
expect(page.getMapElement().isPresent()).toBeTruthy();
});
it('should have a search bar', () => {
expect(page.getSearchHeaderElement().isPresent()).toBeTruthy();
});
it('should update the route', () => {
browser.waitForAngular();
expect(page.getFullPath()).toContain('states');
});
});
| Add additional route wait time | Add additional route wait time
| TypeScript | mit | EvictionLab/eviction-maps,EvictionLab/eviction-maps,EvictionLab/eviction-maps,EvictionLab/eviction-maps | ---
+++
@@ -18,6 +18,7 @@
});
it('should update the route', () => {
+ browser.waitForAngular();
expect(page.getFullPath()).toContain('states');
});
}); |
4745426e1d16de41f9b9e544938394843c593099 | build/webpack.config.production.ts | build/webpack.config.production.ts | /// <reference path='webpack.fix.d.ts' />
import * as ExtractTextPlugin from 'extract-text-webpack-plugin'
import * as path from 'path'
import * as webpack from 'webpack'
import * as ParallelUglifyPlugin from 'webpack-parallel-uglify-plugin'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import baseConfig from './webpack.config.base'
const merge = require('webpack-merge') // tslint:disable-line
export default merge(baseConfig, {
devtool: 'cheap-module-source-map',
entry: ['babel-polyfill', './src/index'],
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}
]
},
output: {
filename: 'respace.bundle.js',
path: path.join(__dirname, '../dist'),
publicPath: '/'
},
plugins: [
new BundleAnalyzerPlugin(),
new ParallelUglifyPlugin({
cacheDir: path.resolve(__dirname, '../.uglifycache')
}),
new webpack.optimize.OccurrenceOrderPlugin(false),
new ExtractTextPlugin({ filename: 'style.css', allChunks: true }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
]
})
| /// <reference path='webpack.fix.d.ts' />
import * as ExtractTextPlugin from 'extract-text-webpack-plugin'
import * as path from 'path'
import * as webpack from 'webpack'
import * as ParallelUglifyPlugin from 'webpack-parallel-uglify-plugin'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import baseConfig from './webpack.config.base'
const merge = require('webpack-merge') // tslint:disable-line
export default merge(baseConfig, {
devtool: 'cheap-module-source-map',
entry: {
app: ['babel-polyfill', './src/index'],
blueprintjs: [ './src/blueprintjs' ]
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
}
]
},
output: {
filename: '[name].bundle.js',
path: path.join(__dirname, '../dist'),
publicPath: '/'
},
plugins: [
new BundleAnalyzerPlugin(),
new ParallelUglifyPlugin({
cacheDir: path.resolve(__dirname, '../.uglifycache')
}),
new webpack.optimize.OccurrenceOrderPlugin(false),
new ExtractTextPlugin({ filename: 'style.css', allChunks: true }),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
]
})
| Add Bluperint entry point in prod | Add Bluperint entry point in prod
| TypeScript | mit | respace-js/respace,respace-js/respace,evansb/respace,evansb/respace,evansb/respace | ---
+++
@@ -14,7 +14,10 @@
export default merge(baseConfig, {
devtool: 'cheap-module-source-map',
- entry: ['babel-polyfill', './src/index'],
+ entry: {
+ app: ['babel-polyfill', './src/index'],
+ blueprintjs: [ './src/blueprintjs' ]
+ },
module: {
rules: [
@@ -29,7 +32,7 @@
},
output: {
- filename: 'respace.bundle.js',
+ filename: '[name].bundle.js',
path: path.join(__dirname, '../dist'),
publicPath: '/'
}, |
cb43ec8685d5e387bdf6fc120c80ab41ca568abc | lib/store/watch.ts | lib/store/watch.ts | import { TextEditor, Disposable } from "atom";
import { action } from "mobx";
import OutputStore from "./output";
import { log } from "./../utils";
import type Kernel from "./../kernel";
export default class WatchStore {
kernel: Kernel;
editor: TextEditor;
outputStore = new OutputStore();
autocompleteDisposable: Disposable | null | undefined;
constructor(kernel: Kernel) {
this.kernel = kernel;
this.editor = atom.workspace.buildTextEditor({
softWrapped: true,
lineNumberGutterVisible: false,
});
const grammar = this.kernel.grammar;
if (grammar)
atom.grammars.assignLanguageMode(this.editor, grammar.scopeName);
this.editor.moveToTop();
this.editor.element.classList.add("watch-input");
}
@action
run = () => {
const code = this.getCode();
log("watchview running:", code);
if (code && code.length > 0) {
this.kernel.executeWatch(code, (result) => {
this.outputStore.appendOutput(result);
});
}
};
@action
setCode = (code: string) => {
this.editor.setText(code);
};
getCode = () => {
return this.editor.getText();
};
focus = () => {
this.editor.element.focus();
};
}
| import { TextEditor, Disposable } from "atom";
import { action } from "mobx";
import OutputStore from "./output";
import { log } from "./../utils";
import type Kernel from "./../kernel";
export default class WatchStore {
kernel: Kernel;
editor: TextEditor;
outputStore = new OutputStore();
autocompleteDisposable: Disposable | null | undefined;
constructor(kernel: Kernel) {
this.kernel = kernel;
this.editor = atom.workspace.buildTextEditor({
softWrapped: true,
lineNumberGutterVisible: false,
});
const grammar = this.kernel.grammar;
if (grammar)
atom.grammars.assignLanguageMode(
this.editor.getBuffer(),
grammar.scopeName
);
this.editor.moveToTop();
this.editor.element.classList.add("watch-input");
}
@action
run = () => {
const code = this.getCode();
log("watchview running:", code);
if (code && code.length > 0) {
this.kernel.executeWatch(code, (result) => {
this.outputStore.appendOutput(result);
});
}
};
@action
setCode = (code: string) => {
this.editor.setText(code);
};
getCode = () => {
return this.editor.getText();
};
focus = () => {
this.editor.element.focus();
};
}
| Fix assignLanguageMode accepts a buffer | Fix assignLanguageMode accepts a buffer
| TypeScript | mit | nteract/hydrogen,nteract/hydrogen | ---
+++
@@ -17,7 +17,10 @@
});
const grammar = this.kernel.grammar;
if (grammar)
- atom.grammars.assignLanguageMode(this.editor, grammar.scopeName);
+ atom.grammars.assignLanguageMode(
+ this.editor.getBuffer(),
+ grammar.scopeName
+ );
this.editor.moveToTop();
this.editor.element.classList.add("watch-input");
} |
ef92467ec4e1ac98474a1676dfe3020da64b3c80 | src/main/lib/dialog/DialogStore.tsx | src/main/lib/dialog/DialogStore.tsx | import { observable, action } from 'mobx'
import {
DialogData,
PromptDialogOptions,
DialogTypes,
MessageBoxDialogOptions
} from './interfaces'
let id = 0
export default class DialogStore {
@observable currentData?: DialogData
@action
setOptions(data?: DialogData) {
this.currentData = data
}
prompt(options: PromptDialogOptions) {
this.setOptions({
id: id++,
type: DialogTypes.Prompt,
...options
})
}
messageBox(options: MessageBoxDialogOptions) {
this.setOptions({
id: id++,
type: DialogTypes.MessageBox,
...options
})
}
closeDialog() {
this.setOptions()
}
}
| import { observable, action } from 'mobx'
import {
DialogData,
PromptDialogOptions,
DialogTypes,
MessageBoxDialogOptions
} from './interfaces'
let id = 0
export default class DialogStore {
@observable currentData?: DialogData
@action
setData(data?: DialogData) {
this.currentData = data
}
prompt(options: PromptDialogOptions) {
this.setData({
id: id++,
type: DialogTypes.Prompt,
...options
})
}
messageBox(options: MessageBoxDialogOptions) {
this.setData({
id: id++,
type: DialogTypes.MessageBox,
...options
})
}
closeDialog() {
this.setData()
}
}
| Rename setOptions method to setData | Rename setOptions method to setData
| TypeScript | mit | Sarah-Seo/Inpad,Sarah-Seo/Inpad | ---
+++
@@ -11,12 +11,12 @@
@observable currentData?: DialogData
@action
- setOptions(data?: DialogData) {
+ setData(data?: DialogData) {
this.currentData = data
}
prompt(options: PromptDialogOptions) {
- this.setOptions({
+ this.setData({
id: id++,
type: DialogTypes.Prompt,
...options
@@ -24,7 +24,7 @@
}
messageBox(options: MessageBoxDialogOptions) {
- this.setOptions({
+ this.setData({
id: id++,
type: DialogTypes.MessageBox,
...options
@@ -32,6 +32,6 @@
}
closeDialog() {
- this.setOptions()
+ this.setData()
}
} |
083f1216837075c369f18650476b2de13e6490d9 | src/export/packer/packer.ts | src/export/packer/packer.ts | import { File } from "file";
import { Compiler } from "./next-compiler";
export class Packer {
private readonly compiler: Compiler;
constructor() {
this.compiler = new Compiler();
}
public async toBuffer(file: File): Promise<Buffer> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({ type: "nodebuffer" })) as Buffer;
return zipData;
}
public async toBase64String(file: File): Promise<string> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({ type: "base64" })) as string;
return zipData;
}
public async toBlob(file: File): Promise<Blob> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({ type: "blob" })) as Blob;
return zipData;
}
}
| import { File } from "file";
import { Compiler } from "./next-compiler";
export class Packer {
private readonly compiler: Compiler;
constructor() {
this.compiler = new Compiler();
}
public async toBuffer(file: File): Promise<Buffer> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({
type: "nodebuffer",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})) as Buffer;
return zipData;
}
public async toBase64String(file: File): Promise<string> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({
type: "base64",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})) as string;
return zipData;
}
public async toBlob(file: File): Promise<Blob> {
const zip = await this.compiler.compile(file);
const zipData = (await zip.generateAsync({
type: "blob",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
})) as Blob;
return zipData;
}
}
| Add correct docx mime type | Add correct docx mime type
| TypeScript | mit | dolanmiu/docx,dolanmiu/docx,dolanmiu/docx | ---
+++
@@ -10,21 +10,30 @@
public async toBuffer(file: File): Promise<Buffer> {
const zip = await this.compiler.compile(file);
- const zipData = (await zip.generateAsync({ type: "nodebuffer" })) as Buffer;
+ const zipData = (await zip.generateAsync({
+ type: "nodebuffer",
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ })) as Buffer;
return zipData;
}
public async toBase64String(file: File): Promise<string> {
const zip = await this.compiler.compile(file);
- const zipData = (await zip.generateAsync({ type: "base64" })) as string;
+ const zipData = (await zip.generateAsync({
+ type: "base64",
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ })) as string;
return zipData;
}
public async toBlob(file: File): Promise<Blob> {
const zip = await this.compiler.compile(file);
- const zipData = (await zip.generateAsync({ type: "blob" })) as Blob;
+ const zipData = (await zip.generateAsync({
+ type: "blob",
+ mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ })) as Blob;
return zipData;
} |
9bbdcfd437c2d21bc2645f286941172b781388b1 | src/RichText.webmodeler.ts | src/RichText.webmodeler.ts | import { Component, createElement } from "react";
import { RichText, RichTextProps } from "./components/RichText";
import TextEditorContainer, { RichTextContainerProps } from "./components/RichTextContainer";
// tslint:disable-next-line class-name
export class preview extends Component<RichTextContainerProps, {}> {
render() {
return createElement(RichText, preview.transformProps(this.props));
}
private static transformProps(props: RichTextContainerProps): RichTextProps {
const valueAttribute = props.stringAttribute ? props.stringAttribute.split(".")[ 2 ] : "";
return {
className: props.class,
editorOption: props.editorOption,
hasContext: true,
maxNumberOfLines: props.maxNumberOfLines,
minNumberOfLines: props.minNumberOfLines,
readOnly: props.editable === "never",
readOnlyStyle: props.readOnlyStyle,
style: TextEditorContainer.parseStyle(props.style),
theme: props.theme,
value: valueAttribute ? "[" + valueAttribute + "]" : props.stringAttribute
};
}
}
export function getPreviewCss() {
return (
require("quill/dist/quill.snow.css") +
require("quill/dist/quill.bubble.css") +
require("./ui/RichText.scss")
);
}
| import { Component, createElement } from "react";
import { RichText, RichTextProps } from "./components/RichText";
import TextEditorContainer, { RichTextContainerProps } from "./components/RichTextContainer";
type VisibilityMap = {
[P in keyof RichTextContainerProps]: boolean;
};
// tslint:disable-next-line class-name
export class preview extends Component<RichTextContainerProps, {}> {
render() {
return createElement(RichText, preview.transformProps(this.props));
}
componentDidMount() {
this.forceUpdate();
}
private static transformProps(props: RichTextContainerProps): RichTextProps {
const valueAttribute = props.stringAttribute ? props.stringAttribute.split(".")[ 2 ] : "";
return {
className: props.class,
editorOption: props.editorOption,
hasContext: true,
maxNumberOfLines: props.maxNumberOfLines,
minNumberOfLines: props.minNumberOfLines,
readOnly: props.editable === "never",
readOnlyStyle: props.readOnlyStyle,
style: TextEditorContainer.parseStyle(props.style),
theme: props.theme,
value: valueAttribute ? `[${valueAttribute}]` : props.stringAttribute
};
}
}
export function getPreviewCss() {
return (
require("quill/dist/quill.snow.css") +
require("quill/dist/quill.bubble.css") +
require("./ui/RichText.scss")
);
}
export function getVisibleProperties(props: RichTextContainerProps, visibilityMap: VisibilityMap) {
if (props.editorOption !== "custom") {
visibilityMap.customOptions = false;
}
}
| Add web modeler conditional visibility | Add web modeler conditional visibility
| TypeScript | apache-2.0 | Andries-Smit/rich-text,Andries-Smit/rich-text | ---
+++
@@ -1,11 +1,19 @@
import { Component, createElement } from "react";
import { RichText, RichTextProps } from "./components/RichText";
import TextEditorContainer, { RichTextContainerProps } from "./components/RichTextContainer";
+
+type VisibilityMap = {
+ [P in keyof RichTextContainerProps]: boolean;
+};
// tslint:disable-next-line class-name
export class preview extends Component<RichTextContainerProps, {}> {
render() {
return createElement(RichText, preview.transformProps(this.props));
+ }
+
+ componentDidMount() {
+ this.forceUpdate();
}
private static transformProps(props: RichTextContainerProps): RichTextProps {
@@ -21,7 +29,7 @@
readOnlyStyle: props.readOnlyStyle,
style: TextEditorContainer.parseStyle(props.style),
theme: props.theme,
- value: valueAttribute ? "[" + valueAttribute + "]" : props.stringAttribute
+ value: valueAttribute ? `[${valueAttribute}]` : props.stringAttribute
};
}
}
@@ -33,3 +41,9 @@
require("./ui/RichText.scss")
);
}
+
+export function getVisibleProperties(props: RichTextContainerProps, visibilityMap: VisibilityMap) {
+ if (props.editorOption !== "custom") {
+ visibilityMap.customOptions = false;
+ }
+} |
edb16480a430fae2d2b15f2b0b177f9c37607661 | output-facebookmessenger/src/models/common/IdentityData.ts | output-facebookmessenger/src/models/common/IdentityData.ts | import { IsNotEmpty, IsOptional, IsString } from '@jovotech/output';
export class IdentityData {
@IsString()
@IsNotEmpty()
id: string;
@IsOptional()
@IsString()
@IsNotEmpty()
user_ref?: string;
@IsOptional()
@IsString()
@IsNotEmpty()
post_id?: string;
@IsOptional()
@IsString()
@IsNotEmpty()
comment_id?: string;
}
| import { IsNotEmpty, IsOptional, IsString } from '@jovotech/output';
export class IdentityData {
@IsString()
id: string;
@IsOptional()
@IsString()
@IsNotEmpty()
user_ref?: string;
@IsOptional()
@IsString()
@IsNotEmpty()
post_id?: string;
@IsOptional()
@IsString()
@IsNotEmpty()
comment_id?: string;
}
| Fix bug that was caused because an identity-id could not be passed | :bug: Fix bug that was caused because an identity-id could not be passed
| TypeScript | apache-2.0 | jovotech/jovo-framework-nodejs,jovotech/jovo-framework-nodejs | ---
+++
@@ -2,7 +2,6 @@
export class IdentityData {
@IsString()
- @IsNotEmpty()
id: string;
@IsOptional() |
0f7c7c3628ff6884c7e5712d6adf6cccba57a425 | interfaces/Types.ts | interfaces/Types.ts |
/// Order by decreasing specificity
export enum PipelineType {
"text-classification" = "text-classification",
"token-classification" = "token-classification",
"table-question-answering" = "table-question-answering",
"question-answering" = "question-answering",
"zero-shot-classification" = "zero-shot-classification",
"translation" = "translation",
"summarization" = "summarization",
"text-generation" = "text-generation",
"text2text-generation" = "text2text-generation",
"fill-mask" = "fill-mask",
/// audio
"text-to-speech" = "text-to-speech",
"automatic-speech-recognition" = "automatic-speech-recognition",
}
export const ALL_PIPELINE_TYPES = Object.keys(PipelineType) as (keyof typeof PipelineType)[];
|
/// In each category, order by decreasing specificity
export enum PipelineType {
/// nlp
"text-classification" = "text-classification",
"token-classification" = "token-classification",
"table-question-answering" = "table-question-answering",
"question-answering" = "question-answering",
"zero-shot-classification" = "zero-shot-classification",
"translation" = "translation",
"summarization" = "summarization",
"text-generation" = "text-generation",
"text2text-generation" = "text2text-generation",
"fill-mask" = "fill-mask",
/// audio
"text-to-speech" = "text-to-speech",
"automatic-speech-recognition" = "automatic-speech-recognition",
"audio-source-separation" = "audio-source-separation",
"voice-activity-detection" = "voice-activity-detection",
}
export const ALL_PIPELINE_TYPES = Object.keys(PipelineType) as (keyof typeof PipelineType)[];
| Add tasks: audio-source-separation and voice-activity-detection | Add tasks: audio-source-separation and voice-activity-detection
cc @hbredin and @jonashaag
commit imported from https://github.com/huggingface/widgets/commit/6e3ecc02a70dbd87c016bf26793a8676dbb24d8f
cc @hbredin and @jonashaag
| TypeScript | apache-2.0 | huggingface/huggingface_hub | ---
+++
@@ -1,6 +1,7 @@
-/// Order by decreasing specificity
+/// In each category, order by decreasing specificity
export enum PipelineType {
+ /// nlp
"text-classification" = "text-classification",
"token-classification" = "token-classification",
"table-question-answering" = "table-question-answering",
@@ -14,6 +15,8 @@
/// audio
"text-to-speech" = "text-to-speech",
"automatic-speech-recognition" = "automatic-speech-recognition",
+ "audio-source-separation" = "audio-source-separation",
+ "voice-activity-detection" = "voice-activity-detection",
}
export const ALL_PIPELINE_TYPES = Object.keys(PipelineType) as (keyof typeof PipelineType)[]; |
9ee3b678e541635bd18419e17e660efa0d0d13d5 | src/ts/config-loader.ts | src/ts/config-loader.ts | import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { ConfigOptions } from "./config";
export class ConfigLoader {
private configFilePath = path.join(os.homedir(), "ueli.config.json");
private defaultConfig: ConfigOptions;
public constructor(defaultConfig: ConfigOptions, configFilePath?: string) {
if (configFilePath !== undefined) {
this.configFilePath = configFilePath;
}
this.defaultConfig = defaultConfig;
}
public loadConigFromConfigFile(): ConfigOptions {
try {
const fileContent = fs.readFileSync(this.configFilePath, "utf-8");
const parsed = JSON.parse(fileContent) as ConfigOptions;
if (parsed.version === undefined || !parsed.version.startsWith("3")) {
this.writeDefaultConfigToConfigFile();
return this.defaultConfig;
} else {
return parsed;
}
} catch (err) {
this.writeDefaultConfigToConfigFile();
return this.defaultConfig;
}
}
private writeDefaultConfigToConfigFile(): void {
const stringifiedConfig = JSON.stringify(this.defaultConfig);
fs.writeFileSync(this.configFilePath, stringifiedConfig, "utf-8");
}
}
| import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { ConfigOptions } from "./config";
export class ConfigLoader {
private configFilePath = path.join(os.homedir(), "ueli.config.json");
private defaultConfig: ConfigOptions;
public constructor(defaultConfig: ConfigOptions, configFilePath?: string) {
if (configFilePath !== undefined) {
this.configFilePath = configFilePath;
}
this.defaultConfig = defaultConfig;
}
public loadConigFromConfigFile(): ConfigOptions {
try {
const fileContent = fs.readFileSync(this.configFilePath, "utf-8");
const parsed = JSON.parse(fileContent) as ConfigOptions;
if (!parsed.version.startsWith("3")) {
this.writeDefaultConfigToConfigFile();
return this.defaultConfig;
} else {
return parsed;
}
} catch (err) {
this.writeDefaultConfigToConfigFile();
return this.defaultConfig;
}
}
private writeDefaultConfigToConfigFile(): void {
const stringifiedConfig = JSON.stringify(this.defaultConfig);
fs.writeFileSync(this.configFilePath, stringifiedConfig, "utf-8");
}
}
| Remove outdated condition in config parsing | Remove outdated condition in config parsing
| TypeScript | mit | oliverschwendener/electronizr,oliverschwendener/electronizr | ---
+++
@@ -18,7 +18,7 @@
try {
const fileContent = fs.readFileSync(this.configFilePath, "utf-8");
const parsed = JSON.parse(fileContent) as ConfigOptions;
- if (parsed.version === undefined || !parsed.version.startsWith("3")) {
+ if (!parsed.version.startsWith("3")) {
this.writeDefaultConfigToConfigFile();
return this.defaultConfig;
} else { |
4d9e58b6999ae2a53d6ac864ff504891613bfa8e | src/smc-webapp/hooks.ts | src/smc-webapp/hooks.ts | import * as React from "react";
import { debounce, Cancelable, DebounceSettings } from "lodash";
type CancelableHOF = <T extends (...args: any[]) => any>(
func: T,
...rest
) => T & Cancelable;
/**
* When a callback is deferred (eg. with debounce) it may
* try to run when the component is no longer rendered
*
* useAsyncCallback automatically runs a clean up function
* like React.useEffect
*/
export function useAsyncCallback<F extends (...args: any[]) => any>(
hof: CancelableHOF,
callback: F,
...rest
): typeof wrapped {
const wrapped = React.useCallback(hof(callback, ...rest), [
callback,
...rest
]);
React.useEffect(() => {
return wrapped.cancel;
}, [wrapped]);
return wrapped;
}
export const useDebounce = <T extends (...args) => any>(
cb: T,
wait?: number,
options?: DebounceSettings
): T & Cancelable => {
return useAsyncCallback(debounce, cb, wait, options);
};
| import * as React from "react";
import { debounce, Cancelable, DebounceSettings } from "lodash";
type CancelableHOF = <T extends (...args: any[]) => any>(
func: T,
...rest
) => T & Cancelable;
type Tail<T extends any[]> = ((...args: T) => any) extends (
_: any,
...tail: infer Rest
) => any
? Rest
: [];
/**
* When a callback is deferred (eg. with debounce) it may
* try to run when the component is no longer rendered
*
* useAsyncCallback automatically runs a clean up function
* like React.useEffect
*/
function useAsyncCallback<
H extends CancelableHOF,
F extends (...args: any[]) => any
>(hof: H, callback: F, ...tail: Tail<Parameters<H>>): typeof wrapped {
const wrapped = React.useCallback(hof(callback, ...tail), [...tail]);
React.useEffect(() => {
return wrapped.cancel;
}, [wrapped]);
return wrapped;
}
export const useDebounce = <T extends (...args) => any>(
cb: T,
wait?: number,
options?: DebounceSettings
): T & Cancelable => {
return useAsyncCallback(debounce, cb, wait, options);
};
| Make a general cancelable hook | Make a general cancelable hook
| TypeScript | agpl-3.0 | DrXyzzy/smc,tscholl2/smc,DrXyzzy/smc,sagemathinc/smc,DrXyzzy/smc,sagemathinc/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc,DrXyzzy/smc,tscholl2/smc,sagemathinc/smc,tscholl2/smc | ---
+++
@@ -6,6 +6,13 @@
...rest
) => T & Cancelable;
+type Tail<T extends any[]> = ((...args: T) => any) extends (
+ _: any,
+ ...tail: infer Rest
+) => any
+ ? Rest
+ : [];
+
/**
* When a callback is deferred (eg. with debounce) it may
* try to run when the component is no longer rendered
@@ -13,15 +20,11 @@
* useAsyncCallback automatically runs a clean up function
* like React.useEffect
*/
-export function useAsyncCallback<F extends (...args: any[]) => any>(
- hof: CancelableHOF,
- callback: F,
- ...rest
-): typeof wrapped {
- const wrapped = React.useCallback(hof(callback, ...rest), [
- callback,
- ...rest
- ]);
+function useAsyncCallback<
+ H extends CancelableHOF,
+ F extends (...args: any[]) => any
+>(hof: H, callback: F, ...tail: Tail<Parameters<H>>): typeof wrapped {
+ const wrapped = React.useCallback(hof(callback, ...tail), [...tail]);
React.useEffect(() => {
return wrapped.cancel; |
15698413e8be66b7a463008f8714e5ba5a28b86d | src/model/optional-range.ts | src/model/optional-range.ts | export interface OptionalRange {
value: string;
endValue?: string;
}
export module OptionalRange {
export const VALUE = 'value';
export const ENDVALUE = 'endValue';
export function isValid(optionalRange: OptionalRange): boolean {
const keys = Object.keys(optionalRange);
if (keys.length !== 1 && keys.length !== 2) return false;
if (keys.length === 1 && keys[0] !== VALUE) return false;
if (keys.length === 2 && typeof optionalRange[VALUE] !== typeof optionalRange[ENDVALUE]) return false;
return true;
}
export function generateLabel(optionalRange: OptionalRange,
getTranslation: (key: string) => string): string {
return optionalRange.endValue
? getTranslation('from') + optionalRange.value + getTranslation('to') + optionalRange.endValue
: optionalRange.value;
}
}
| export interface OptionalRange {
value: string;
endValue?: string;
}
export module OptionalRange {
export const VALUE = 'value';
export const ENDVALUE = 'endValue';
export function isValid(optionalRange: OptionalRange): boolean {
const keys = Object.keys(optionalRange);
if (keys.length !== 1 && keys.length !== 2) return false;
if (keys.length === 1 && keys[0] !== VALUE) return false;
if (keys.length === 2 && typeof optionalRange[VALUE] !== typeof optionalRange[ENDVALUE]) return false;
return true;
}
export function generateLabel(optionalRange: OptionalRange,
getTranslation: (key: string) => string,
getLabel: (object: any) => string): string {
return optionalRange.endValue
? getTranslation('from') + getLabel(optionalRange.value) + getTranslation('to')
+ getLabel(optionalRange.endValue)
: getLabel(optionalRange.value);
}
}
| Use getLabel function in OptionalRange.generateLabel provided via parameter | Use getLabel function in OptionalRange.generateLabel provided via parameter
| TypeScript | apache-2.0 | dainst/idai-components-2,dainst/idai-components-2,dainst/idai-components-2 | ---
+++
@@ -23,10 +23,12 @@
export function generateLabel(optionalRange: OptionalRange,
- getTranslation: (key: string) => string): string {
+ getTranslation: (key: string) => string,
+ getLabel: (object: any) => string): string {
return optionalRange.endValue
- ? getTranslation('from') + optionalRange.value + getTranslation('to') + optionalRange.endValue
- : optionalRange.value;
+ ? getTranslation('from') + getLabel(optionalRange.value) + getTranslation('to')
+ + getLabel(optionalRange.endValue)
+ : getLabel(optionalRange.value);
}
} |
071b230ecd89d88dc21679df52cd3f37f73e3da3 | test/mocks/mockNetworkInterface.ts | test/mocks/mockNetworkInterface.ts | import {
NetworkInterface,
Request,
} from '../../src/networkInterface';
import {
GraphQLResult,
parse,
print
} from 'graphql';
// Pass in multiple mocked responses, so that you can test flows that end up
// making multiple queries to the server
export default function mockNetworkInterface(
...mockedResponses: MockedResponse[]
): NetworkInterface { return new MockNetworkInterface(...mockedResponses) as any }
export interface MockedResponse {
request: Request
result: GraphQLResult
delay?: number
}
class MockNetworkInterface {
private requestToResultMap: any = {};
private requestToDelayMap: any = {};
constructor(...mockedResponses: MockedResponse[]) {
// Populate set of mocked requests
mockedResponses.forEach(({ request, result, delay }) => {
this.requestToResultMap[requestToKey(request)] = result as GraphQLResult;
this.requestToDelayMap[requestToKey(request)] = delay;
});
}
query(request: Request) {
return new Promise((resolve, reject) => {
const resultData = this.requestToResultMap[requestToKey(request)];
const delay = this.requestToDelayMap[requestToKey(request)];
if (! resultData) {
throw new Error(`Passed request that wasn't mocked: ${requestToKey(request)}`);
}
setTimeout(() => {
resolve(resultData);
}, delay ? delay : 0);
});
}
}
function requestToKey(request: Request): string {
const query = request.query && print(parse(request.query));
return JSON.stringify({
variables: request.variables,
debugName: request.debugName,
query,
});
}
| import {
NetworkInterface,
Request,
} from '../../src/networkInterface';
import {
GraphQLResult,
parse,
print
} from 'graphql';
// Pass in multiple mocked responses, so that you can test flows that end up
// making multiple queries to the server
export default function mockNetworkInterface(
...mockedResponses: MockedResponse[]
): NetworkInterface { return new MockNetworkInterface(...mockedResponses) as any }
export interface MockedResponse {
request: Request
result: GraphQLResult
delay?: number
}
class MockNetworkInterface {
private mockedResponsesByKey: { [key:string]: MockedResponse } = {};
constructor(...mockedResponses: MockedResponse[]) {
mockedResponses.forEach((mockedResponse) => {
const key = requestToKey(mockedResponse.request);
this.mockedResponsesByKey[key] = mockedResponse;
});
}
query(request: Request) {
return new Promise((resolve, reject) => {
const key = requestToKey(request);
const { result, delay } = this.mockedResponsesByKey[key];
if (!result) {
throw new Error(`Passed request that wasn't mocked: ${key}`);
}
setTimeout(() => {
resolve(result);
}, delay ? delay : 0);
});
}
}
function requestToKey(request: Request): string {
const query = request.query && print(parse(request.query));
return JSON.stringify({
variables: request.variables,
debugName: request.debugName,
query,
});
}
| Store map of mocked responses instead of separate maps per property | Store map of mocked responses instead of separate maps per property
| TypeScript | mit | apollographql/apollo-client,cesarsolorzano/apollo-client,calebmer/apollo-client,apollostack/apollo-client,convoyinc/apollo-client,stevewillard/apollo-client,stevewillard/apollo-client,calebmer/apollo-client,stevewillard/apollo-client,calebmer/apollo-client,cesarsolorzano/apollo-client,apollostack/apollo-client,cesarsolorzano/apollo-client,apollographql/apollo-client,convoyinc/apollo-client,convoyinc/apollo-client,apollostack/apollo-client | ---
+++
@@ -22,28 +22,26 @@
}
class MockNetworkInterface {
- private requestToResultMap: any = {};
- private requestToDelayMap: any = {};
+ private mockedResponsesByKey: { [key:string]: MockedResponse } = {};
constructor(...mockedResponses: MockedResponse[]) {
- // Populate set of mocked requests
- mockedResponses.forEach(({ request, result, delay }) => {
- this.requestToResultMap[requestToKey(request)] = result as GraphQLResult;
- this.requestToDelayMap[requestToKey(request)] = delay;
+ mockedResponses.forEach((mockedResponse) => {
+ const key = requestToKey(mockedResponse.request);
+ this.mockedResponsesByKey[key] = mockedResponse;
});
}
query(request: Request) {
return new Promise((resolve, reject) => {
- const resultData = this.requestToResultMap[requestToKey(request)];
- const delay = this.requestToDelayMap[requestToKey(request)];
+ const key = requestToKey(request);
+ const { result, delay } = this.mockedResponsesByKey[key];
- if (! resultData) {
- throw new Error(`Passed request that wasn't mocked: ${requestToKey(request)}`);
+ if (!result) {
+ throw new Error(`Passed request that wasn't mocked: ${key}`);
}
setTimeout(() => {
- resolve(resultData);
+ resolve(result);
}, delay ? delay : 0);
});
} |
4f0ac125521573cf69e0bd29af75f6cd68b0d8f6 | src/vs/workbench/contrib/audioCues/browser/audioCues.contribution.ts | src/vs/workbench/contrib/audioCues/browser/audioCues.contribution.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { AudioCueContribution } from 'vs/workbench/contrib/audioCues/browser/audioCueContribution';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(AudioCueContribution, LifecyclePhase.Eventually);
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
'properties': {
'audioCues.enabled': {
'type': 'string',
'description': localize('audioCues.enabled', "Controls whether audio cues are enabled."),
'enum': ['auto', 'on', 'off'],
'default': 'auto',
'enumDescriptions': [
localize('audioCues.enabled.auto', "Enable audio cues when a screen reader is attached."),
localize('audioCues.enabled.on', "Enable audio cues."),
localize('audioCues.enabled.off', "Disable audio cues.")
],
}
}
});
| /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Extensions as ConfigurationExtensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { AudioCueContribution } from 'vs/workbench/contrib/audioCues/browser/audioCueContribution';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(AudioCueContribution, LifecyclePhase.Restored);
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
'properties': {
'audioCues.enabled': {
'type': 'string',
'description': localize('audioCues.enabled', "Controls whether audio cues are enabled."),
'enum': ['auto', 'on', 'off'],
'default': 'auto',
'enumDescriptions': [
localize('audioCues.enabled.auto', "Enable audio cues when a screen reader is attached."),
localize('audioCues.enabled.on', "Enable audio cues."),
localize('audioCues.enabled.off', "Disable audio cues.")
],
}
}
});
| Use LifecyclePhase.Restored instead of LifecyclePhase.Eventually | Use LifecyclePhase.Restored instead of LifecyclePhase.Eventually
| TypeScript | mit | microsoft/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,microsoft/vscode,eamodio/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,eamodio/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,eamodio/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode,microsoft/vscode | ---
+++
@@ -10,7 +10,7 @@
import { AudioCueContribution } from 'vs/workbench/contrib/audioCues/browser/audioCueContribution';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
-Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(AudioCueContribution, LifecyclePhase.Eventually);
+Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(AudioCueContribution, LifecyclePhase.Restored);
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
'properties': { |
c64478ca78852e2de2188aa4922d80f6e032e22a | src/Test/Ast/EdgeCases/CodeBlock.ts | src/Test/Ast/EdgeCases/CodeBlock.ts | import { expect } from 'chai'
import Up from '../../../index'
import { DocumentNode } from '../../../SyntaxNodes/DocumentNode'
import { CodeBlockNode } from '../../../SyntaxNodes/CodeBlockNode'
describe('A code block', () => {
it('can contain a streak of backticks if the streak is preceeded by some whitespace', () => {
const text = `
\`\`\`
\`\`\`
\`\`\``
expect(Up.toAst(text)).to.be.eql(
new DocumentNode([
new CodeBlockNode(' ```'),
]))
})
})
describe('Two consecutive streaks of backticks', () => {
it('produce an empty code block', () => {
const text =`
\`\`\`
\`\`\``
expect(Up.toAst(text)).to.be.eql(
new DocumentNode([
new CodeBlockNode(''),
]))
})
})
| import { expect } from 'chai'
import Up from '../../../index'
import { DocumentNode } from '../../../SyntaxNodes/DocumentNode'
import { CodeBlockNode } from '../../../SyntaxNodes/CodeBlockNode'
import { ParagraphNode } from '../../../SyntaxNodes/ParagraphNode'
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
describe('A code block', () => {
it('can contain a streak of backticks if the streak is preceeded by some whitespace', () => {
const text = `
\`\`\`
\`\`\`
\`\`\``
expect(Up.toAst(text)).to.be.eql(
new DocumentNode([
new CodeBlockNode(' ```'),
]))
})
})
describe('An unmatched streak of backticks following a normal "enclosed" code block', () => {
it("produces a code block node whose contents are the rest of the document", () => {
const text = `
Check out the code below!
\`\`\`
function factorial(n: number): number {
return (
n <= 1
? 1
: n * factorial(n - 1))
}
\`\`\`
\`\`\`
document.write('The factorial of 5 is: ' + factorial(5))`
expect(Up.toAst(text)).to.be.eql(
new DocumentNode([
new ParagraphNode([
new PlainTextNode('Check out the code below!')
]),
new CodeBlockNode(
`function factorial(n: number): number {
return (
n <= 1
? 1
: n * factorial(n - 1))
}`),
new CodeBlockNode("document.write('The factorial of 5 is: ' + factorial(5))")
]))
})
})
describe('Two consecutive streaks of backticks', () => {
it('produce an empty code block', () => {
const text = `
\`\`\`
\`\`\``
expect(Up.toAst(text)).to.be.eql(
new DocumentNode([
new CodeBlockNode(''),
]))
})
})
| Add passing code block test | Add passing code block test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -2,6 +2,8 @@
import Up from '../../../index'
import { DocumentNode } from '../../../SyntaxNodes/DocumentNode'
import { CodeBlockNode } from '../../../SyntaxNodes/CodeBlockNode'
+import { ParagraphNode } from '../../../SyntaxNodes/ParagraphNode'
+import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
describe('A code block', () => {
@@ -18,9 +20,45 @@
})
+describe('An unmatched streak of backticks following a normal "enclosed" code block', () => {
+ it("produces a code block node whose contents are the rest of the document", () => {
+ const text = `
+Check out the code below!
+
+\`\`\`
+function factorial(n: number): number {
+ return (
+ n <= 1
+ ? 1
+ : n * factorial(n - 1))
+}
+\`\`\`
+
+\`\`\`
+document.write('The factorial of 5 is: ' + factorial(5))`
+
+ expect(Up.toAst(text)).to.be.eql(
+ new DocumentNode([
+ new ParagraphNode([
+ new PlainTextNode('Check out the code below!')
+ ]),
+ new CodeBlockNode(
+`function factorial(n: number): number {
+ return (
+ n <= 1
+ ? 1
+ : n * factorial(n - 1))
+}`),
+ new CodeBlockNode("document.write('The factorial of 5 is: ' + factorial(5))")
+ ]))
+ })
+})
+
+
+
describe('Two consecutive streaks of backticks', () => {
it('produce an empty code block', () => {
- const text =`
+ const text = `
\`\`\`
\`\`\``
expect(Up.toAst(text)).to.be.eql( |
afbd2ff3d5427d78fdbacfb8ad18a65c8d91a0bc | src/specs/bacon-dom-spec.ts | src/specs/bacon-dom-spec.ts | /// <reference path="../typings/tsd.d.ts"/>
import chai = require("chai");
import mockBrowser = require("mock-browser");
import Bacon = require("baconjs");
import attach = require("../main/bacon-dom");
var expect = chai.expect;
var document = mockBrowser.mocks.MockBrowser.createDocument();
describe("bacon-dom", () => {
it("triggers no dom changes when the observable does not change", () => {
var emptyDomStream = new Bacon.Bus();
attach(emptyDomStream).to(document.body);
expect(document.body.children.length).to.equal(0);
})
})
| /// <reference path="../typings/tsd.d.ts"/>
import chai = require("chai");
import Bacon = require("baconjs");
import attach = require("../main/bacon-dom");
import h = require("virtual-dom/h")
var expect = chai.expect;
describe("bacon-dom", () => {
it("triggers no dom changes when the observable does not change", () => {
var emptyDomStream = new Bacon.Bus();
attach(emptyDomStream).to(document.body);
expect(document.body.children.length).to.equal(0);
})
it("contains the initial dom state", () => {
var initialDom = Bacon.once(h('.hello-world', []));
attach(initialDom).to(document.body);
expect(document.body.getElementsByClassName('.hello-world'))
.to.have.length(1);
})
})
| Add spec checking actually adding some HTML | Add spec checking actually adding some HTML
| TypeScript | apache-2.0 | joelea/bacon-dom,joelea/bacon-dom | ---
+++
@@ -1,13 +1,11 @@
/// <reference path="../typings/tsd.d.ts"/>
import chai = require("chai");
-import mockBrowser = require("mock-browser");
import Bacon = require("baconjs");
import attach = require("../main/bacon-dom");
+import h = require("virtual-dom/h")
var expect = chai.expect;
-
-var document = mockBrowser.mocks.MockBrowser.createDocument();
describe("bacon-dom", () => {
it("triggers no dom changes when the observable does not change", () => {
@@ -15,4 +13,12 @@
attach(emptyDomStream).to(document.body);
expect(document.body.children.length).to.equal(0);
})
+
+ it("contains the initial dom state", () => {
+ var initialDom = Bacon.once(h('.hello-world', []));
+ attach(initialDom).to(document.body);
+
+ expect(document.body.getElementsByClassName('.hello-world'))
+ .to.have.length(1);
+ })
}) |
61422bbe368a2bcef874358a54baecf6c2b519ec | src/components/Intro/Intro.test.tsx | src/components/Intro/Intro.test.tsx | import { render, screen } from '@testing-library/react'
import { Intro } from '.'
const renderIntro = () => render(<Intro />)
describe('Intro', () => {
test('renders a header', () => {
renderIntro()
expect(
screen.getByRole('heading', { name: 'React Checkbox Tree' })
).toBeDefined()
})
test('renders a description', () => {
const { container } = renderIntro()
const paragraph = container.querySelector('p') as HTMLParagraphElement
expect(paragraph).toBeDefined()
expect(paragraph.textContent).toEqual(
'A react app showcasing a simple checkbox tree component. This project was created using create-react-app.'
)
})
test('renders a link to create-react-app GitHub repository', () => {
renderIntro()
const link = screen.getByRole('link', {
name: 'create-react-app'
})
expect(link).toBeDefined()
expect(link.getAttribute('href')).toEqual(
'https://github.com/facebookincubator/create-react-app'
)
})
})
| import { render, screen } from '@testing-library/react'
import { Intro } from '.'
const renderIntro = () => render(<Intro />)
describe('Intro', () => {
test('renders a header', () => {
renderIntro()
expect(
screen.getByRole('heading', { name: 'React Checkbox Tree' })
).toBeDefined()
})
test('renders a description', () => {
const { container } = renderIntro()
const paragraph = container.getElementsByTagName('p')[0]
expect(paragraph).toBeDefined()
expect(paragraph.textContent).toEqual(
'A react app showcasing a simple checkbox tree component. This project was created using create-react-app.'
)
})
test('renders a link to create-react-app GitHub repository', () => {
renderIntro()
const link = screen.getByRole('link', {
name: 'create-react-app'
})
expect(link).toBeDefined()
expect(link.getAttribute('href')).toEqual(
'https://github.com/facebookincubator/create-react-app'
)
})
})
| Remove type assertion by finding element by tag name | Remove type assertion by finding element by tag name
| TypeScript | mit | joelgeorgev/react-checkbox-tree,joelgeorgev/react-checkbox-tree | ---
+++
@@ -16,7 +16,7 @@
test('renders a description', () => {
const { container } = renderIntro()
- const paragraph = container.querySelector('p') as HTMLParagraphElement
+ const paragraph = container.getElementsByTagName('p')[0]
expect(paragraph).toBeDefined()
expect(paragraph.textContent).toEqual( |
bbd6425a1bd580b9bf00ecb202a4f6b80e5fd233 | src/components/Queue/QueueTable.tsx | src/components/Queue/QueueTable.tsx | import * as React from 'react';
import { Layout, Card, ResourceList, Stack, Button } from '@shopify/polaris';
import EmptyQueue from './EmptyQueue';
import QueueCard from '../../containers/QueueItemCard';
export interface Props {
readonly queueItemIds: string[];
}
export interface Handlers {
readonly onRefresh: () => void;
}
class QueueTable extends React.PureComponent<Props & Handlers, never> {
componentDidMount() {
this.props.onRefresh();
}
public render() {
const { queueItemIds, onRefresh } = this.props;
return queueItemIds.length === 0 ? (
<EmptyQueue onRefresh={onRefresh} />
) : (
<Layout>
<Layout.Section>
<Stack vertical>
<Card sectioned>
<Button onClick={onRefresh}>Refresh queue.</Button>
</Card>
<Card>
<ResourceList
items={queueItemIds}
renderItem={(hitId: string) => <QueueCard hitId={hitId} />}
/>
</Card>
</Stack>
</Layout.Section>
</Layout>
);
}
}
export default QueueTable;
| import * as React from 'react';
import { Layout, Card, ResourceList, Stack, Button } from '@shopify/polaris';
import EmptyQueue from './EmptyQueue';
import QueueCard from '../../containers/QueueItemCard';
export interface Props {
readonly queueItemIds: string[];
}
export interface Handlers {
readonly onRefresh: () => void;
}
class QueueTable extends React.PureComponent<Props & Handlers, never> {
componentWillMount() {
this.props.onRefresh();
}
public render() {
const { queueItemIds, onRefresh } = this.props;
return queueItemIds.length === 0 ? (
<EmptyQueue onRefresh={onRefresh} />
) : (
<Layout>
<Layout.Section>
<Stack vertical>
<Card sectioned>
<Button onClick={onRefresh}>Refresh queue.</Button>
</Card>
<Card>
<ResourceList
items={queueItemIds}
renderItem={(hitId: string) => <QueueCard hitId={hitId} />}
/>
</Card>
</Stack>
</Layout.Section>
</Layout>
);
}
}
export default QueueTable;
| Refresh Queue on componentWillMount instead of componentDidMount. | Refresh Queue on componentWillMount instead of componentDidMount.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -12,7 +12,7 @@
}
class QueueTable extends React.PureComponent<Props & Handlers, never> {
- componentDidMount() {
+ componentWillMount() {
this.props.onRefresh();
}
|
17431331a4e2dd377807eef95eb83fe8f3dd70bd | test/service/twitter-spec.ts | test/service/twitter-spec.ts | /// <reference path="../../definitions/mocha/mocha.d.ts" />
/// <reference path="../../definitions/chai/chai.d.ts" />
/// <reference path="../../src/service/twitter.ts" />
module Spec {
chai.should();
describe('ServiceTwitter', () => {
it('should be true', () => {
true.should.be.false;
});
});
}
| /// <reference path="../../definitions/mocha/mocha.d.ts" />
/// <reference path="../../definitions/chai/chai.d.ts" />
/// <reference path="../../src/service/twitter.ts" />
module Spec {
chai.should();
describe('ServiceTwitter', () => {
it('should be true', () => {
true.should.be.true;
});
});
describe('Sample00', () => {
it('should be fail on purpose', () => {
true.should.be.false;
});
});
describe('Sample01', () => {
it('should be success on purpose', () => {
true.should.be.true;
});
});
}
| Modify tests for exam spec-runner | Modify tests for exam spec-runner
| TypeScript | mit | otiai10/prisc,otiai10/prisc,otiai10/prisc | ---
+++
@@ -8,7 +8,19 @@
describe('ServiceTwitter', () => {
it('should be true', () => {
+ true.should.be.true;
+ });
+ });
+
+ describe('Sample00', () => {
+ it('should be fail on purpose', () => {
true.should.be.false;
});
- });
+ });
+
+ describe('Sample01', () => {
+ it('should be success on purpose', () => {
+ true.should.be.true;
+ });
+ });
} |
1ad4784118810ec7d991db0bde9558b9602580de | website/examples/start.tsx | website/examples/start.tsx | import React from 'react';
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css';
export default function Example() {
const [selected, setSelected] = React.useState<Date>();
let footer = 'Please pick a day.';
if (selected) {
footer = `You picked ${format(selected, 'PP')}.`;
}
return (
<DayPicker
mode="single"
selected={selected}
onSelect={setSelected}
footer={footer}
/>
);
}
| import React from 'react';
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
export default function Example() {
const [selected, setSelected] = React.useState<Date>();
let footer = 'Please pick a day.';
if (selected) {
footer = `You picked ${format(selected, 'PP')}.`;
}
return (
<DayPicker
mode="single"
selected={selected}
onSelect={setSelected}
footer={footer}
/>
);
}
| Revert "docs: include css in example" | Revert "docs: include css in example"
This reverts commit 7f1d7aea4591cf4528fc8a5ec9cdc252d81555d4.
| TypeScript | mit | gpbl/react-day-picker,gpbl/react-day-picker,gpbl/react-day-picker | ---
+++
@@ -2,7 +2,6 @@
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
-import 'react-day-picker/dist/style.css';
export default function Example() {
const [selected, setSelected] = React.useState<Date>(); |
6288ba092c7e3b87e2d41f765a042c4055e20b4b | src/core.ts | src/core.ts | /*
* SweetAlert
* 2014-2017 – Tristan Edwards
* https://github.com/t4t5/sweetalert
*/
import init from './modules/init';
import {
openModal,
onAction,
getState,
stopLoading,
} from './modules/actions';
import state, {
setActionValue,
ActionOptions,
SwalState,
} from './modules/state';
import {
SwalOptions,
getOpts,
setDefaults,
} from './modules/options';
export type SwalParams = (string|Partial<SwalOptions>)[];
export interface SweetAlert {
(...params: SwalParams): Promise<any>,
close? (namespace: string): void,
getState? (): SwalState,
setActionValue? (opts: string|ActionOptions): void,
stopLoading? (): void,
setDefaults? (opts: object): void,
};
const swal:SweetAlert = (...args) => {
// Prevent library to be run in Node env:
if (typeof window === 'undefined') return;
const opts: SwalOptions = getOpts(...args);
return new Promise<any>((resolve, reject) => {
state.promise = { resolve, reject };
init(opts);
// For fade animation to work:
setTimeout(() => {
openModal();
});
});
};
swal.close = onAction;
swal.getState = getState;
swal.setActionValue = setActionValue;
swal.stopLoading = stopLoading;
swal.setDefaults = setDefaults;
export default swal;
| /*
* SweetAlert
* 2014-2017 – Tristan Edwards
* https://github.com/t4t5/sweetalert
*/
import init from './modules/init';
import {
openModal,
onAction,
getState,
stopLoading,
} from './modules/actions';
import state, {
setActionValue,
ActionOptions,
SwalState,
} from './modules/state';
import {
SwalOptions,
getOpts,
setDefaults,
} from './modules/options';
export type SwalParams = (string|Partial<SwalOptions>)[];
export interface SweetAlert {
(...params: SwalParams): Promise<any>,
close? (namespace?: string): void,
getState? (): SwalState,
setActionValue? (opts: string|ActionOptions): void,
stopLoading? (): void,
setDefaults? (opts: object): void,
};
const swal:SweetAlert = (...args) => {
// Prevent library to be run in Node env:
if (typeof window === 'undefined') return;
const opts: SwalOptions = getOpts(...args);
return new Promise<any>((resolve, reject) => {
state.promise = { resolve, reject };
init(opts);
// For fade animation to work:
setTimeout(() => {
openModal();
});
});
};
swal.close = onAction;
swal.getState = getState;
swal.setActionValue = setActionValue;
swal.stopLoading = stopLoading;
swal.setDefaults = setDefaults;
export default swal;
| Set namespace definition to be optional | Set namespace definition to be optional
| TypeScript | mit | t4t5/sweetalert,t4t5/sweetalert | ---
+++
@@ -29,7 +29,7 @@
export interface SweetAlert {
(...params: SwalParams): Promise<any>,
- close? (namespace: string): void,
+ close? (namespace?: string): void,
getState? (): SwalState,
setActionValue? (opts: string|ActionOptions): void,
stopLoading? (): void,
@@ -63,4 +63,3 @@
swal.setDefaults = setDefaults;
export default swal;
- |
2c5539ee8ce5bb3f07a5b09cfe9edc48d5439501 | client/Layout/ThreeColumnLayout.tsx | client/Layout/ThreeColumnLayout.tsx | import * as React from "react";
import { TrackerViewModel } from "../TrackerViewModel";
import { VerticalResizer } from "./VerticalResizer";
import { useStoreBackedState } from "../Utility/useStoreBackedState";
import { Store } from "../Utility/Store";
import { CenterColumn } from "./CenterColumn";
import { ToolbarHost } from "./ToolbarHost";
import { LeftColumn } from "./LeftColumn";
import { RightColumn } from "./RightColumn";
export function ThreeColumnLayout(props: { tracker: TrackerViewModel }) {
const [columnWidth, setColumnWidth] = useStoreBackedState(
Store.User,
"columnWidth",
375
);
return (
<>
<ToolbarHost tracker={props.tracker} />
<LeftColumn tracker={props.tracker} columnWidth={columnWidth} />
<VerticalResizer
adjustWidth={offset => setColumnWidth(columnWidth + offset)}
/>
<CenterColumn tracker={props.tracker} />
<VerticalResizer
adjustWidth={offset => setColumnWidth(columnWidth - offset)}
/>
<RightColumn tracker={props.tracker} columnWidth={columnWidth} />
</>
);
}
| import * as React from "react";
import { TrackerViewModel } from "../TrackerViewModel";
import { VerticalResizer } from "./VerticalResizer";
import { useStoreBackedState } from "../Utility/useStoreBackedState";
import { Store } from "../Utility/Store";
import { CenterColumn } from "./CenterColumn";
import { ToolbarHost } from "./ToolbarHost";
import { LeftColumn } from "./LeftColumn";
import { RightColumn } from "./RightColumn";
export function ThreeColumnLayout(props: { tracker: TrackerViewModel }) {
const [leftColumnWidth, setLeftColumnWidth] = useStoreBackedState(
Store.User,
"columnWidth",
375
);
const [rightColumnWidth, setRightColumnWidth] = useStoreBackedState(
Store.User,
"rightColumnWidth",
375
);
return (
<>
<ToolbarHost tracker={props.tracker} />
<LeftColumn tracker={props.tracker} columnWidth={leftColumnWidth} />
<VerticalResizer
adjustWidth={offset => setLeftColumnWidth(leftColumnWidth + offset)}
/>
<CenterColumn tracker={props.tracker} />
<VerticalResizer
adjustWidth={offset => setRightColumnWidth(rightColumnWidth - offset)}
/>
<RightColumn tracker={props.tracker} columnWidth={rightColumnWidth} />
</>
);
}
| Store left and right column width preferences | Store left and right column width preferences
| TypeScript | mit | cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative | ---
+++
@@ -9,24 +9,29 @@
import { RightColumn } from "./RightColumn";
export function ThreeColumnLayout(props: { tracker: TrackerViewModel }) {
- const [columnWidth, setColumnWidth] = useStoreBackedState(
+ const [leftColumnWidth, setLeftColumnWidth] = useStoreBackedState(
Store.User,
"columnWidth",
+ 375
+ );
+ const [rightColumnWidth, setRightColumnWidth] = useStoreBackedState(
+ Store.User,
+ "rightColumnWidth",
375
);
return (
<>
<ToolbarHost tracker={props.tracker} />
- <LeftColumn tracker={props.tracker} columnWidth={columnWidth} />
+ <LeftColumn tracker={props.tracker} columnWidth={leftColumnWidth} />
<VerticalResizer
- adjustWidth={offset => setColumnWidth(columnWidth + offset)}
+ adjustWidth={offset => setLeftColumnWidth(leftColumnWidth + offset)}
/>
<CenterColumn tracker={props.tracker} />
<VerticalResizer
- adjustWidth={offset => setColumnWidth(columnWidth - offset)}
+ adjustWidth={offset => setRightColumnWidth(rightColumnWidth - offset)}
/>
- <RightColumn tracker={props.tracker} columnWidth={columnWidth} />
+ <RightColumn tracker={props.tracker} columnWidth={rightColumnWidth} />
</>
);
} |
f5142931c7cf9a248987997c668383dfe3926291 | packages/Site/src/routes.tsx | packages/Site/src/routes.tsx | /** Load fronts and global styles */
import './globals'
import { BLUE, PINK, ThemeProvider, WHITE } from '@slup/theming'
import { Container, Content } from './components/container'
import { Route, Router } from 'inferno-router'
import { App } from './components/app'
import { Demo } from './components/demo'
import Home from './pages/home'
import NotFound from './pages/404'
import { URLs } from './pages'
export const THEME = {
text: WHITE,
background: '#303030',
primary: BLUE[500],
secondary: PINK[500],
dark: true
}
export const routes = (
<ThemeProvider theme={THEME}>
<Container>
<App />
{URLs
.slice()
.filter(i => i.url.includes('components'))
.map(item =>
<Route computedMatch path={item.url} component={() => <Demo module={item.title} />} />
)
}
<Route exact path='/' component={Home} />
<Route path='*' component={NotFound} />
</Container>
</ThemeProvider>
) | /** Load fronts and global styles */
import './globals'
import { BLUE, PINK, ThemeProvider, WHITE } from '@slup/theming'
import { Container, Content } from './components/container'
import { Route, Router } from 'inferno-router'
import { App } from './components/app'
import { Demo } from './components/demo'
import Home from './pages/home'
import NotFound from './pages/404'
import { URLs } from './pages'
export const THEME = {
text: WHITE,
background: '#303030',
primary: BLUE[500],
secondary: PINK[500],
dark: true
}
export const routes = (
<ThemeProvider theme={THEME}>
<Container>
<App />
{URLs
.slice()
.filter(i => i.url.includes('components'))
.map(item =>
<Route path={item.url} component={() => <Demo module={item.title} />} />
)
}
<Route exact path='/' component={Home} />
{/*<Route path='*' component={NotFound} />*/}
</Container>
</ThemeProvider>
) | Disable 404 route while we figure out how to fix it | :bug: Disable 404 route while we figure out how to fix it
| TypeScript | mit | slupjs/slup,slupjs/slup | ---
+++
@@ -28,13 +28,13 @@
.slice()
.filter(i => i.url.includes('components'))
.map(item =>
- <Route computedMatch path={item.url} component={() => <Demo module={item.title} />} />
+ <Route path={item.url} component={() => <Demo module={item.title} />} />
)
}
<Route exact path='/' component={Home} />
- <Route path='*' component={NotFound} />
+ {/*<Route path='*' component={NotFound} />*/}
</Container>
</ThemeProvider>
) |
82222bf01b04130387e6878260de92ff74b2e911 | src/components/card/card.component.ts | src/components/card/card.component.ts | import { Component, Input, OnInit } from '@angular/core';
import { humanizeMeasureName } from '../../utils/formatters';
import { Meta } from '../../datasets/metas/types';
import { TabbedChartsMeta } from '../../datasets/metas/tabbed-charts.meta';
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss'],
})
export class CardComponent<T extends Meta> implements OnInit {
@Input() meta: T;
humanizeMeasureName = humanizeMeasureName;
currentTabTitle: string;
get titles(): string[] {
if (this.isTabbed()) {
return this.meta.metas.map(c => c.title);
} else {
return [this.meta.title];
}
}
get currentChart(): Meta {
if (this.isTabbed()) {
const { metas } = this.meta;
return metas.find(c => c.title === this.currentTabTitle) ?? metas[0];
} else {
return this.meta;
}
}
ngOnInit() {
if (this.isTabbed()) {
this.setCurrentTabTitle(this.meta.metas[0].title);
} else {
this.setCurrentTabTitle('');
}
}
setCurrentTabTitle(title) {
this.currentTabTitle = title;
}
isTabbed(): this is CardComponent<TabbedChartsMeta> {
return this.meta.type === 'tabbed';
}
}
| import { Component, Input, OnInit } from '@angular/core';
import { humanizeMeasureName } from '../../utils/formatters';
import { Meta } from '../../datasets/metas/types';
import { TabbedChartsMeta } from '../../datasets/metas/tabbed-charts.meta';
@Component({
selector: 'app-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss'],
})
export class CardComponent<T extends Meta> implements OnInit {
@Input() meta: T;
humanizeMeasureName = humanizeMeasureName;
currentTabTitle?: string;
get titles(): string[] {
if (this.isTabbed()) {
return this.meta.metas.map(c => c.title);
} else {
return [this.meta.title];
}
}
get currentChart(): Meta {
if (this.isTabbed()) {
const { metas } = this.meta;
return metas.find(c => c.title === this.currentTabTitle) ?? metas[0];
} else {
return this.meta;
}
}
ngOnInit() {
if (this.isTabbed()) {
this.setCurrentTabTitle(this.meta.metas[0].title);
} else {
this.setCurrentTabTitle(undefined);
}
}
setCurrentTabTitle(title) {
this.currentTabTitle = title;
}
isTabbed(): this is CardComponent<TabbedChartsMeta> {
return this.meta.type === 'tabbed';
}
}
| Set currentTabTitle to undefined when input is not TabbedChartsMeta | Set currentTabTitle to undefined when input is not TabbedChartsMeta
| TypeScript | apache-2.0 | googleinterns/guide-doge,googleinterns/guide-doge,googleinterns/guide-doge | ---
+++
@@ -11,7 +11,7 @@
export class CardComponent<T extends Meta> implements OnInit {
@Input() meta: T;
humanizeMeasureName = humanizeMeasureName;
- currentTabTitle: string;
+ currentTabTitle?: string;
get titles(): string[] {
if (this.isTabbed()) {
@@ -34,7 +34,7 @@
if (this.isTabbed()) {
this.setCurrentTabTitle(this.meta.metas[0].title);
} else {
- this.setCurrentTabTitle('');
+ this.setCurrentTabTitle(undefined);
}
}
|
6f4fedcd20aa38a6275e5396557d6871cea6753d | src/transpile-if-ts.ts | src/transpile-if-ts.ts | import * as tsc from 'typescript';
import { getTSConfig } from './utils';
export function transpileIfTypescript(path, contents, config?) {
if (path && (path.endsWith('.tsx') || path.endsWith('.ts'))) {
let transpiled = tsc.transpileModule(contents, {
compilerOptions: getTSConfig(config || { __TS_CONFIG__: global['__TS_CONFIG__'] }, true),
fileName: path
});
return transpiled.outputText;
}
return contents;
} | import * as tsc from 'typescript';
import { getTSConfigOptionFromConfig, getTSConfig } from './utils';
export function transpileIfTypescript(path, contents, config?) {
if (path && (path.endsWith('.tsx') || path.endsWith('.ts'))) {
let transpiled = tsc.transpileModule(contents, {
compilerOptions: getTSConfig(config || { 'ts-jest': { tsConfigFile: getTSConfigOptionFromConfig(global) }}, true),
fileName: path
});
return transpiled.outputText;
}
return contents;
}
| Add new schema for config | Add new schema for config
| TypeScript | mit | kulshekhar/ts-jest,kulshekhar/ts-jest | ---
+++
@@ -1,11 +1,11 @@
import * as tsc from 'typescript';
-import { getTSConfig } from './utils';
+import { getTSConfigOptionFromConfig, getTSConfig } from './utils';
export function transpileIfTypescript(path, contents, config?) {
if (path && (path.endsWith('.tsx') || path.endsWith('.ts'))) {
let transpiled = tsc.transpileModule(contents, {
- compilerOptions: getTSConfig(config || { __TS_CONFIG__: global['__TS_CONFIG__'] }, true),
+ compilerOptions: getTSConfig(config || { 'ts-jest': { tsConfigFile: getTSConfigOptionFromConfig(global) }}, true),
fileName: path
});
|
3ead67bec6bc5890a0732c44253b474d15f40b96 | src/git/common.ts | src/git/common.ts | export enum GitStatus {
CLEAN,
DELETED,
MODIFIED,
STAGED,
STAGED_ADDED,
STAGED_COPIED,
STAGED_DELETED,
STAGED_MODIFIED,
STAGED_RENAMED,
STAGED_TYPE,
STAGED_UNKNOWN,
STAGED_UNMERGED,
UNTRACKED
}
export const GitStatedStatus: Map<string, GitStatus> = new Map<string, GitStatus>();
GitStatedStatus.set("A", GitStatus.STAGED_ADDED);
GitStatedStatus.set("C", GitStatus.STAGED_COPIED);
GitStatedStatus.set("M", GitStatus.STAGED_MODIFIED);
GitStatedStatus.set("R", GitStatus.STAGED_RENAMED);
GitStatedStatus.set("T", GitStatus.STAGED_TYPE);
GitStatedStatus.set("U", GitStatus.STAGED_UNMERGED);
GitStatedStatus.set("X", GitStatus.STAGED_UNKNOWN);
| export enum GitStatus {
CLEAN,
DELETED,
MODIFIED,
STAGED,
UNTRACKED
}
export enum GitStagedType {
ADDED,
COPIED,
DELETED,
MODIFIED,
RENAMED,
TYPE,
UNKNOWN,
UNMERGED
}
export const GitStategTypeMap: Map<string, GitStagedType> = new Map<string, GitStagedType>();
GitStategTypeMap.set("A", GitStagedType.ADDED);
GitStategTypeMap.set("C", GitStagedType.COPIED);
GitStategTypeMap.set("M", GitStagedType.MODIFIED);
GitStategTypeMap.set("R", GitStagedType.RENAMED);
GitStategTypeMap.set("T", GitStagedType.TYPE);
GitStategTypeMap.set("U", GitStagedType.UNMERGED);
GitStategTypeMap.set("X", GitStagedType.UNKNOWN);
| Refactor staged into new GitStagedType enum | Refactor staged into new GitStagedType enum
| TypeScript | mit | tht13/gerrit-vscode | ---
+++
@@ -3,22 +3,25 @@
DELETED,
MODIFIED,
STAGED,
- STAGED_ADDED,
- STAGED_COPIED,
- STAGED_DELETED,
- STAGED_MODIFIED,
- STAGED_RENAMED,
- STAGED_TYPE,
- STAGED_UNKNOWN,
- STAGED_UNMERGED,
UNTRACKED
}
-export const GitStatedStatus: Map<string, GitStatus> = new Map<string, GitStatus>();
-GitStatedStatus.set("A", GitStatus.STAGED_ADDED);
-GitStatedStatus.set("C", GitStatus.STAGED_COPIED);
-GitStatedStatus.set("M", GitStatus.STAGED_MODIFIED);
-GitStatedStatus.set("R", GitStatus.STAGED_RENAMED);
-GitStatedStatus.set("T", GitStatus.STAGED_TYPE);
-GitStatedStatus.set("U", GitStatus.STAGED_UNMERGED);
-GitStatedStatus.set("X", GitStatus.STAGED_UNKNOWN);
+export enum GitStagedType {
+ ADDED,
+ COPIED,
+ DELETED,
+ MODIFIED,
+ RENAMED,
+ TYPE,
+ UNKNOWN,
+ UNMERGED
+}
+
+export const GitStategTypeMap: Map<string, GitStagedType> = new Map<string, GitStagedType>();
+GitStategTypeMap.set("A", GitStagedType.ADDED);
+GitStategTypeMap.set("C", GitStagedType.COPIED);
+GitStategTypeMap.set("M", GitStagedType.MODIFIED);
+GitStategTypeMap.set("R", GitStagedType.RENAMED);
+GitStategTypeMap.set("T", GitStagedType.TYPE);
+GitStategTypeMap.set("U", GitStagedType.UNMERGED);
+GitStategTypeMap.set("X", GitStagedType.UNKNOWN); |
3aeae08946a5eaa71c2bf2073fa4eb6a832e81d3 | app/angular/src/server/ts_config.ts | app/angular/src/server/ts_config.ts | import fs from 'fs';
import path from 'path';
import { logger } from '@storybook/node-logger';
function resolveTsConfig(tsConfigPath: string): string | undefined {
if (fs.existsSync(tsConfigPath)) {
logger.info('=> Found custom tsconfig.json');
return tsConfigPath;
}
return undefined;
}
export default function (configDir: string) {
const configFilePath = resolveTsConfig(path.resolve(configDir, 'tsconfig.json'));
return {
transpileOnly: true,
compilerOptions: {
emitDecoratorMetadata: true,
},
configFile: configFilePath || undefined,
};
}
| import fs from 'fs';
import path from 'path';
import { logger } from '@storybook/node-logger';
import { Options } from 'ts-loader';
function resolveTsConfig(tsConfigPath: string): string | undefined {
if (fs.existsSync(tsConfigPath)) {
logger.info('=> Found custom tsconfig.json');
return tsConfigPath;
}
return undefined;
}
export default function (configDir: string) {
const tsLoaderOptions: Partial<Options> = {
transpileOnly: true,
compilerOptions: {
emitDecoratorMetadata: true,
},
};
const configFilePath = resolveTsConfig(path.resolve(configDir, 'tsconfig.json'));
if (configFilePath) tsLoaderOptions.configFile = configFilePath;
return tsLoaderOptions;
}
| Fix `configFile: undefined` in ts-loader options when not using a custom .storybook/tsconfig.json | Fix `configFile: undefined` in ts-loader options when not using a custom .storybook/tsconfig.json
Fixes https://github.com/storybookjs/storybook/issues/13381
| TypeScript | mit | storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook | ---
+++
@@ -1,6 +1,7 @@
import fs from 'fs';
import path from 'path';
import { logger } from '@storybook/node-logger';
+import { Options } from 'ts-loader';
function resolveTsConfig(tsConfigPath: string): string | undefined {
if (fs.existsSync(tsConfigPath)) {
@@ -11,12 +12,15 @@
}
export default function (configDir: string) {
- const configFilePath = resolveTsConfig(path.resolve(configDir, 'tsconfig.json'));
- return {
+ const tsLoaderOptions: Partial<Options> = {
transpileOnly: true,
compilerOptions: {
emitDecoratorMetadata: true,
},
- configFile: configFilePath || undefined,
};
+
+ const configFilePath = resolveTsConfig(path.resolve(configDir, 'tsconfig.json'));
+ if (configFilePath) tsLoaderOptions.configFile = configFilePath;
+
+ return tsLoaderOptions;
} |
b7b85bd2c5daedbc9c7440b241f6766398f25dc3 | app/package-info.ts | app/package-info.ts | const appPackage: Record<string, string> = require('./package.json')
export function getProductName() {
const productName = appPackage.productName
return process.env.NODE_ENV === 'development'
? `${productName}-dev`
: productName
}
export function getCompanyName() {
return appPackage.companyName
}
export function getVersion() {
return appPackage.version
}
export function getBundleID() {
return appPackage.bundleID
}
| const appPackage: Record<string, string> = require('./package.json')
export function getProductName() {
const productName = appPackage.productName
return process.env.NODE_ENV === 'development'
? `${productName}-dev`
: productName
}
export function getCompanyName() {
return appPackage.companyName
}
export function getVersion() {
return appPackage.version
}
export function getBundleID() {
return process.env.NODE_ENV === 'development'
? `${appPackage.bundleID}Dev`
: appPackage.bundleID
}
| Use a custom bundle id for development | Use a custom bundle id for development
| TypeScript | mit | say25/desktop,say25/desktop,shiftkey/desktop,artivilla/desktop,kactus-io/kactus,j-f1/forked-desktop,kactus-io/kactus,shiftkey/desktop,desktop/desktop,say25/desktop,j-f1/forked-desktop,desktop/desktop,kactus-io/kactus,artivilla/desktop,artivilla/desktop,j-f1/forked-desktop,desktop/desktop,kactus-io/kactus,desktop/desktop,shiftkey/desktop,j-f1/forked-desktop,shiftkey/desktop,artivilla/desktop,say25/desktop | ---
+++
@@ -16,5 +16,7 @@
}
export function getBundleID() {
- return appPackage.bundleID
+ return process.env.NODE_ENV === 'development'
+ ? `${appPackage.bundleID}Dev`
+ : appPackage.bundleID
} |
8a6dd20e8f7edd34974f10a7fc8daa4be4766a7b | src/services/player.service.ts | src/services/player.service.ts | import {Injectable} from "@angular/core";
import {Player} from "../models/player.model";
import {Headers, Http} from "@angular/http";
@Injectable()
export class PlayerService{
player1: Player;
player2: Player;
constructor(private http: Http){};
getPlayers(){
let url = 'http://localhost:4000/players';
return this.http.get(url)
.map(res => res.json());
}
setPlayer1(player1: Player){
this.player1 = player1;
}
setPlayer2(player2: Player){
this.player2 = player2;
}
getPlayer1(){
return this.player1;
}
getPlayer2(){
return this.player2;
}
savePlayer(player: Player){
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let url = 'http://localhost:4000/players/savePlayer';
return this.http.post(url, JSON.stringify(player), {headers: headers})
.map(res => res.json());
}
addNewPlayer(name: string){
let nameObject = {name: name};
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let url = 'http://localhost:4000/players/addPlayer';
return this.http.post(url, JSON.stringify(nameObject), {headers: headers})
.map(res => res.json());
}
}
| import {Injectable} from "@angular/core";
import {Player} from "../models/player.model";
import {Headers, Http} from "@angular/http";
@Injectable()
export class PlayerService{
player1: Player;
player2: Player;
API_URL = 'http://192.168.1.3:4000';
constructor(private http: Http){};
getPlayers(){
let url = this.API_URL + '/players';
return this.http.get(url)
.map(res => res.json());
}
setPlayer1(player1: Player){
this.player1 = player1;
}
setPlayer2(player2: Player){
this.player2 = player2;
}
getPlayer1(){
return this.player1;
}
getPlayer2(){
return this.player2;
}
savePlayer(player: Player){
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let url = this.API_URL + '/players/savePlayer';
return this.http.post(url, JSON.stringify(player), {headers: headers})
.map(res => res.json());
}
addNewPlayer(name: string){
let nameObject = {name: name};
let headers = new Headers();
headers.append('Content-Type', 'application/json');
let url = this.API_URL + '/players/addPlayer';
return this.http.post(url, JSON.stringify(nameObject), {headers: headers})
.map(res => res.json());
}
}
| Refactor url address to a single variable | Refactor url address to a single variable
| TypeScript | mit | casperchia/foosmate,casperchia/foosmate,casperchia/foosmate | ---
+++
@@ -6,11 +6,11 @@
export class PlayerService{
player1: Player;
player2: Player;
-
+ API_URL = 'http://192.168.1.3:4000';
constructor(private http: Http){};
getPlayers(){
- let url = 'http://localhost:4000/players';
+ let url = this.API_URL + '/players';
return this.http.get(url)
.map(res => res.json());
}
@@ -34,7 +34,7 @@
savePlayer(player: Player){
let headers = new Headers();
headers.append('Content-Type', 'application/json');
- let url = 'http://localhost:4000/players/savePlayer';
+ let url = this.API_URL + '/players/savePlayer';
return this.http.post(url, JSON.stringify(player), {headers: headers})
.map(res => res.json());
}
@@ -43,7 +43,7 @@
let nameObject = {name: name};
let headers = new Headers();
headers.append('Content-Type', 'application/json');
- let url = 'http://localhost:4000/players/addPlayer';
+ let url = this.API_URL + '/players/addPlayer';
return this.http.post(url, JSON.stringify(nameObject), {headers: headers})
.map(res => res.json());
} |
1ab035cad87f8b696a35838f4f3d03edccc44448 | components/_utils/types/commonTypes.ts | components/_utils/types/commonTypes.ts |
export interface IInputCallbackData {
dataLabel: string | undefined | null;
value: any;
}
export interface IValidationCallbackData {
dataLabel: string | undefined | null;
value?: any;
required?: boolean;
}
|
export interface IInputCallbackData<T = any> {
dataLabel: string | undefined | null;
value: T;
}
export interface IValidationCallbackData<T = any> {
dataLabel: string | undefined | null;
value?: T;
required?: boolean;
}
| Change callback data and validation data to use generics. | Change callback data and validation data to use generics.
| TypeScript | mit | moosend/mooskin-ui,moosend/mooskin-ui | ---
+++
@@ -1,11 +1,11 @@
-export interface IInputCallbackData {
+export interface IInputCallbackData<T = any> {
dataLabel: string | undefined | null;
- value: any;
+ value: T;
}
-export interface IValidationCallbackData {
+export interface IValidationCallbackData<T = any> {
dataLabel: string | undefined | null;
- value?: any;
+ value?: T;
required?: boolean;
} |
44f45f10b599a05936b5fa4fbf92f55719380697 | SPAWithAngularJS/module5/angularjs-controllers/src/app.module.ts | SPAWithAngularJS/module5/angularjs-controllers/src/app.module.ts | // app.module.ts
"use strict";
import { module } from "angular";
RoutesConfig.$inject = ["$stateProvider", "$urlRouterProvider"];
function RoutesConfig(
$stateProvider: angular.ui.IStateProvider,
$urlRouterProvider: angular.ui.IUrlRouterProvider) {
const message1State: angular.ui.IState = {
name: "message1",
url: "/message1",
component: "message1Component",
resolve: {
myData: () => "This data comes from resolve property ui-router"
}
};
const home: angular.ui.IState = {
name: "home",
url: "/"
};
// Redirect to home if no other URL matches
$urlRouterProvider.otherwise("/");
$stateProvider.state(message1State);
$stateProvider.state(home);
}
const myAppModule = module("myApp", ["ui.router"])
.config(RoutesConfig);
export { myAppModule };
| // app.module.ts
"use strict";
import { module } from "angular";
RoutesConfig.$inject = ["$stateProvider", "$urlRouterProvider"];
function RoutesConfig(
$stateProvider: angular.ui.IStateProvider,
$urlRouterProvider: angular.ui.IUrlRouterProvider) {
const message1State: angular.ui.IState = {
name: "message1",
url: "/message1",
component: "message1Component",
resolve: {
myData: () => "This data comes from resolve property ui-router"
}
};
const homeState: angular.ui.IState = {
name: "home",
url: "/"
};
const repositoriesState: angular.ui.IState = {
name: "repositories",
url: "/repositories",
component: "repositoriesComponent"
};
// Redirect to home if no other URL matches
$urlRouterProvider.otherwise("/");
$stateProvider.state(message1State);
$stateProvider.state(homeState);
$stateProvider.state(repositoriesState);
}
const myAppModule = module("myApp", ["ui.router"])
.config(RoutesConfig);
export { myAppModule };
| Edit states. Added one more state for repositories | Edit states. Added one more state for repositories
| TypeScript | mit | var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training | ---
+++
@@ -18,16 +18,23 @@
}
};
- const home: angular.ui.IState = {
+ const homeState: angular.ui.IState = {
name: "home",
url: "/"
+ };
+
+ const repositoriesState: angular.ui.IState = {
+ name: "repositories",
+ url: "/repositories",
+ component: "repositoriesComponent"
};
// Redirect to home if no other URL matches
$urlRouterProvider.otherwise("/");
$stateProvider.state(message1State);
- $stateProvider.state(home);
+ $stateProvider.state(homeState);
+ $stateProvider.state(repositoriesState);
}
const myAppModule = module("myApp", ["ui.router"]) |
79e4614912b2a5466f1de10efab2af1ffbc39607 | src/index.ts | src/index.ts | /**
* Swagchat SDK.
*/
export * from './Client';
export * from './Realtime';
export * from './interface';
export * from './User';
export * from './Room';
export * from './const';
export * from './util';
export const logColor = '#3F51B5'; | /**
* Swagchat SDK.
*/
export * from './Client';
export * from './Realtime';
export * from './interface';
export * from './User';
export * from './Room';
export * from './const';
export * from './util';
export * from './actions/asset';
export * from './actions/client';
export * from './actions/combined';
export * from './actions/message';
export * from './actions/plugin';
export * from './actions/room';
export * from './actions/setting';
export * from './actions/style';
export * from './actions/user';
export * from './reducers/asset';
export * from './reducers/client';
export * from './reducers/message';
export * from './reducers/plugin';
export * from './reducers/room';
export * from './reducers/setting';
export * from './reducers/style';
export * from './reducers/user';
export * from './sagas/asset';
export * from './sagas/message';
export * from './sagas/room';
export * from './sagas/user';
export * from './stores/asset';
export * from './stores/client';
export * from './stores/message';
export * from './stores/plugin';
export * from './stores/room';
export * from './stores/setting';
export * from './stores/style';
export * from './stores/user';
export * from './stores/';
export const logColor = '#3F51B5'; | Add export actions, reducers, sagas, stores | Add export actions, reducers, sagas, stores
| TypeScript | mit | fairway-corp/swagchat-sdk | ---
+++
@@ -8,4 +8,39 @@
export * from './Room';
export * from './const';
export * from './util';
+
+export * from './actions/asset';
+export * from './actions/client';
+export * from './actions/combined';
+export * from './actions/message';
+export * from './actions/plugin';
+export * from './actions/room';
+export * from './actions/setting';
+export * from './actions/style';
+export * from './actions/user';
+
+export * from './reducers/asset';
+export * from './reducers/client';
+export * from './reducers/message';
+export * from './reducers/plugin';
+export * from './reducers/room';
+export * from './reducers/setting';
+export * from './reducers/style';
+export * from './reducers/user';
+
+export * from './sagas/asset';
+export * from './sagas/message';
+export * from './sagas/room';
+export * from './sagas/user';
+
+export * from './stores/asset';
+export * from './stores/client';
+export * from './stores/message';
+export * from './stores/plugin';
+export * from './stores/room';
+export * from './stores/setting';
+export * from './stores/style';
+export * from './stores/user';
+export * from './stores/';
+
export const logColor = '#3F51B5'; |
4fc5de8cd53ba81e40e0dffdf6348ecda4420990 | src/index.ts | src/index.ts | if ( process.platform === 'win32' ) {
let Application = require( './application' );
Application.start();
}
import { Logger } from './common/logger';
export * from './common/logger';
Logger.hijack();
export * from './autostarter';
export * from './downloader';
export * from './downloader/stream-speed';
export * from './extractor';
export * from './launcher';
export * from './patcher';
export * from './uninstaller';
export * from './queue';
export * from './shortcut';
| if ( process.platform === 'win32' ) {
let Application = require( './application' ).Application;
Application.start();
}
import { Logger } from './common/logger';
export * from './common/logger';
Logger.hijack();
export * from './autostarter';
export * from './downloader';
export * from './downloader/stream-speed';
export * from './extractor';
export * from './launcher';
export * from './patcher';
export * from './uninstaller';
export * from './queue';
export * from './shortcut';
| Fix require statement on Windows for Application. | Fix require statement on Windows for Application.
| TypeScript | mit | gamejolt/client-voodoo,gamejolt/client-voodoo | ---
+++
@@ -1,5 +1,5 @@
if ( process.platform === 'win32' ) {
- let Application = require( './application' );
+ let Application = require( './application' ).Application;
Application.start();
}
@@ -16,4 +16,3 @@
export * from './uninstaller';
export * from './queue';
export * from './shortcut';
- |
c236a3d28a309146dc1be46b267d65fe33fedf54 | src/index.ts | src/index.ts | /* The MIT License (MIT)
*
* Copyright (c) 2017 Cyril Schumacher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/// <reference types="node"/>
import * as http from "http";
import * as net from "net";
import { handleRequest } from "./handleRequest";
import { createMetricsAsync } from "./metrics/createMetricsAsync";
export async function getMetricsAsync() {
return createMetricsAsync();
}
export function listen(port = 9000) {
const server = http.createServer(handleRequest);
return server.listen(port);
}
async function test() {
console.log(await getMetricsAsync());
}
test();
| /* The MIT License (MIT)
*
* Copyright (c) 2017 Cyril Schumacher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/// <reference types="node"/>
import * as http from "http";
import * as net from "net";
import { handleRequest } from "./handleRequest";
import { createMetricsAsync } from "./metrics/createMetricsAsync";
export async function getMetricsAsync() {
return createMetricsAsync();
}
export function listen(port = 9000) {
const server = http.createServer(handleRequest);
return server.listen(port);
} | Remove unnecessary TypeScript source code. | Remove unnecessary TypeScript source code.
| TypeScript | mit | cyrilschumacher/prometheus-node-usage | ---
+++
@@ -37,9 +37,3 @@
const server = http.createServer(handleRequest);
return server.listen(port);
}
-
-async function test() {
- console.log(await getMetricsAsync());
-}
-
-test(); |
d175d81a64356fe7734ed8dd8f2c1b353ce19352 | src/app/shared/storage.service.ts | src/app/shared/storage.service.ts | import { Injectable } from '@angular/core';
import { Subject, BehaviorSubject, Observable } from 'rxjs';
@Injectable()
export class StorageService {
storageKey: string = 'marvel-reading-stats';
currentStorage: Subject<any> = new BehaviorSubject<any>(null);
constructor() {
}
initStorage(): any {
this.updateStorage({});
}
getStorage(): any {
let storage = JSON.parse(localStorage.getItem(this.storageKey));
if (!storage) {
this.initStorage();
} else {
this.currentStorage.next(storage);
}
}
updateStorage(newStorage: any): void {
localStorage.setItem(
this.storageKey,
JSON.stringify(newStorage)
);
this.currentStorage.next(newStorage);
}
deleteStorage(): void {
localStorage.removeItem(this.storageKey);
this.currentStorage.next(null);
}
}
| import { Injectable } from '@angular/core';
import { Subject, BehaviorSubject, Observable } from 'rxjs';
@Injectable()
export class StorageService {
storageKey: string = 'marvel-reading-stats';
currentStorage: Subject<any> = new BehaviorSubject<any>(null);
constructor() {
}
initStorage(): any {
this.updateStorage({
comics: []
});
}
getStorage(): any {
let storage = JSON.parse(localStorage.getItem(this.storageKey));
if (!storage) {
this.initStorage();
} else {
this.currentStorage.next(storage);
}
}
updateStorage(newStorage: any): void {
localStorage.setItem(
this.storageKey,
JSON.stringify(newStorage)
);
this.currentStorage.next(newStorage);
}
deleteStorage(): void {
localStorage.removeItem(this.storageKey);
this.currentStorage.next(null);
}
}
| Update default value for dataUser storage | Update default value for dataUser storage
| TypeScript | mit | SBats/marvel-reading-stats-frontend,SBats/marvel-reading-stats-frontend,SBats/marvel-reading-stats-frontend | ---
+++
@@ -10,7 +10,9 @@
}
initStorage(): any {
- this.updateStorage({});
+ this.updateStorage({
+ comics: []
+ });
}
getStorage(): any { |
3d6c7317755a34131db06cecbb2b950e1af4dbb9 | app/shared/map-field.ts | app/shared/map-field.ts | export class MapField {
label: string;
namespace: string;
name: string;
uri: string;
guidelines_uri: string;
same_as: string;
definition: string;
obligation: string;
range: any;
required: string;
repeatable: boolean;
hidden: boolean;
}
| export class MapField {
label: string;
namespace: string;
name: string;
uri: string;
guidelines: string;
source: string;
definition: string;
obligation: string;
range: any;
repeatable: boolean;
input: string;
visible: boolean;
}
| Update MapField properties to match BCDAMS-MAP api source | Update MapField properties to match BCDAMS-MAP api source
| TypeScript | mit | uhlibraries-digital/brays,uhlibraries-digital/brays,uhlibraries-digital/brays | ---
+++
@@ -3,12 +3,12 @@
namespace: string;
name: string;
uri: string;
- guidelines_uri: string;
- same_as: string;
+ guidelines: string;
+ source: string;
definition: string;
obligation: string;
range: any;
- required: string;
repeatable: boolean;
- hidden: boolean;
+ input: string;
+ visible: boolean;
} |
0e1f7ddc9ad9e5a097c74d5d05d15bd75bd9dd9b | src/main/modules/module-window.ts | src/main/modules/module-window.ts | /**
* Example of Module, other modules should extent this class
*/
import Module from './module';
class ModuleWindow extends Module {
protected window: Electron.BrowserWindow;
constructor (window: Electron.BrowserWindow) {
super();
if (!window || typeof window !== 'object') {
throw (new TypeError('ModuleWindow expecs a valid BrowserWindow to be passed as argument'));
}
this.window = window;
}
getWindow () {
return this.window;
}
}
export default ModuleWindow;
| /**
* Example of Module, other modules should extent this class
*/
import Module from './module';
class ModuleWindow extends Module {
protected window: Electron.BrowserWindow;
constructor (window: Electron.BrowserWindow) {
super();
this.window = window;
}
getWindow () {
return this.window;
}
}
export default ModuleWindow;
| Remove BrowserWindow check in ModuleWindow (thx TS) | Remove BrowserWindow check in ModuleWindow (thx TS)
| TypeScript | mit | KeitIG/museeks,KeitIG/museeks,KeitIG/museeks | ---
+++
@@ -9,11 +9,6 @@
constructor (window: Electron.BrowserWindow) {
super();
-
- if (!window || typeof window !== 'object') {
- throw (new TypeError('ModuleWindow expecs a valid BrowserWindow to be passed as argument'));
- }
-
this.window = window;
}
|
f95a91b41185bcaab4c9bba218b5338f3d1479dd | src/ng2-restangular-helper.ts | src/ng2-restangular-helper.ts | import {URLSearchParams, Headers, RequestOptions, RequestMethod} from '@angular/http';
export class RestangularHelper {
static createRequestOptions(options) {
let requestQueryParams = RestangularHelper.createRequestQueryParams(options.params);
let requestHeaders = RestangularHelper.createRequestHeaders(options.headers);
let methodName = options.method.charAt(0).toUpperCase() + options.method.substr(1).toLowerCase();
let withCredentials = options.withCredentials || false;
let requestOptions = new RequestOptions({
method: RequestMethod[methodName],
headers: requestHeaders,
search: requestQueryParams,
url: options.url,
body: options.data,
withCredentials
});
return requestOptions;
}
static createRequestQueryParams(queryParams) {
let requestQueryParams = Object.assign({}, queryParams);
let search: URLSearchParams = new URLSearchParams();
for (let key in requestQueryParams) {
let value: any = requestQueryParams[key];
if (typeof value === 'object') {
value = JSON.stringify(value);
}
search.append(key, value);
}
return search;
}
static createRequestHeaders(headers) {
for (let key in headers) {
let value: any = headers[key];
if (typeof value === 'undefined') {
delete headers[key];
}
}
return new Headers(Object.assign({}, headers));
}
}
| import {URLSearchParams, Headers, RequestOptions, RequestMethod} from '@angular/http';
export class RestangularHelper {
static createRequestOptions(options) {
let requestQueryParams = RestangularHelper.createRequestQueryParams(options.params);
let requestHeaders = RestangularHelper.createRequestHeaders(options.headers);
let methodName = options.method.charAt(0).toUpperCase() + options.method.substr(1).toLowerCase();
let withCredentials = options.withCredentials || false;
let requestOptions = new RequestOptions({
method: RequestMethod[methodName],
headers: requestHeaders,
search: requestQueryParams,
url: options.url,
body: options.data,
withCredentials
});
return requestOptions;
}
static createRequestQueryParams(queryParams) {
let requestQueryParams = Object.assign({}, queryParams);
let search: URLSearchParams = new URLSearchParams();
for (let key in requestQueryParams) {
let value: any = requestQueryParams[key];
if (Array.isArray(value)) {
value.forEach(function(val){
search.append(key, val);
});
} else {
if (typeof value === 'object') {
value = JSON.stringify(value);
}
search.append(key, value);
}
}
return search;
}
static createRequestHeaders(headers) {
for (let key in headers) {
let value: any = headers[key];
if (typeof value === 'undefined') {
delete headers[key];
}
}
return new Headers(Object.assign({}, headers));
}
}
| Fix URLSearchParams for query params of type Array | Fix URLSearchParams for query params of type Array
| TypeScript | mit | 2muchcoffeecom/ng2-restangular,2muchcoffeecom/ngx-restangular,2muchcoffeecom/ng2-restangular,2muchcoffeecom/ngx-restangular | ---
+++
@@ -26,10 +26,18 @@
for (let key in requestQueryParams) {
let value: any = requestQueryParams[key];
- if (typeof value === 'object') {
- value = JSON.stringify(value);
+
+ if (Array.isArray(value)) {
+ value.forEach(function(val){
+ search.append(key, val);
+ });
+ } else {
+ if (typeof value === 'object') {
+ value = JSON.stringify(value);
+ }
+ search.append(key, value);
}
- search.append(key, value);
+
}
return search; |
2119b535871bb709e0fc68b5a1728e81a61ce60c | examples/compose/app.ts | examples/compose/app.ts | import { Context, Component, stateOf, interfaceOf } from '../../src'
import { styleGroup, StyleGroup } from '../../src/utils/style'
import { ViewInterface } from '../../src/interfaces/view'
import h from 'snabbdom/h'
let name = 'Main'
let components = {
counter: require('./counter').default,
}
let state = ({key}) => ({
key,
count: 0,
})
let actions = {
Set: (count: number) => state => {
state.count = count
return state
},
Inc: () => state => {
state.count ++
return state
},
}
let inputs = (ctx: Context) => ({
set: (n: number) => actions.Set(n),
inc: () => actions.Inc(),
})
let view: ViewInterface = (ctx, s) =>
h('div', {
key: name,
class: { [style.base]: true },
}, [
h('div', {
class: { [style.childCount]: true },
}, [
stateOf(ctx, 'counter').count,
]),
interfaceOf(ctx, 'counter', 'view'),
])
let style: any = styleGroup({
base: {
width: '160px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '12px',
backgroundColor: '#DDE2E9',
},
childCount: {
padding: '10px',
},
}, name)
let mDef: Component = {
name,
state,
components,
inputs,
actions,
interfaces: {
view,
},
}
export default mDef
| import { Context, Component, stateOf, interfaceOf } from '../../src'
import { styleGroup, StyleGroup } from '../../src/utils/style'
import { ViewInterface } from '../../src/interfaces/view'
import h from 'snabbdom/h'
let name = 'Main'
let components = {
counter: require('./counter').default,
}
let state = ({key}) => ({
key,
})
let view: ViewInterface = (ctx, s) =>
h('div', {
key: name,
class: { [style.base]: true },
}, [
h('div', {
class: { [style.childCount]: true },
}, [
stateOf(ctx, 'counter').count,
]),
interfaceOf(ctx, 'counter', 'view'),
])
let style: any = styleGroup({
base: {
width: '160px',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '12px',
backgroundColor: '#DDE2E9',
},
childCount: {
padding: '10px',
},
}, name)
let mDef: Component = {
name,
state,
components,
inputs: ctx => ({}),
actions: {},
interfaces: {
view,
},
}
export default mDef
| Remove unused stuff from compose example | Remove unused stuff from compose example
| TypeScript | mit | FractalBlocks/Fractal,FractalBlocks/Fractal,FractalBlocks/Fractal | ---
+++
@@ -11,23 +11,6 @@
let state = ({key}) => ({
key,
- count: 0,
-})
-
-let actions = {
- Set: (count: number) => state => {
- state.count = count
- return state
- },
- Inc: () => state => {
- state.count ++
- return state
- },
-}
-
-let inputs = (ctx: Context) => ({
- set: (n: number) => actions.Set(n),
- inc: () => actions.Inc(),
})
let view: ViewInterface = (ctx, s) =>
@@ -63,8 +46,8 @@
name,
state,
components,
- inputs,
- actions,
+ inputs: ctx => ({}),
+ actions: {},
interfaces: {
view,
}, |
d78bd37a9939c900c4afccc9e7a9b81037f103ad | lib/plugins.ts | lib/plugins.ts | import { access } from 'fs';
import { join } from 'path';
import { some } from 'async';
import { build } from './pubsub';
const nconf = require.main.require('nconf');
const baseDir = nconf.get('base_dir');
const noop = () => {};
// build when a plugin is (de)activated if that plugin is an emoji pack
const toggle = ({ id }: { id: string }, cb: NodeBack = noop) => {
some([
join(baseDir, 'node_modules', id, 'emoji.json'),
join(baseDir, 'node_modules', id, 'emoji.js'),
], (path, next) => {
access(path, (err) => {
if (err && err.code !== 'ENOENT') {
next(err);
} else {
next(null, !err);
}
});
}, (err: NodeJS.ErrnoException, result: boolean) => {
if (err) {
cb(err);
return;
}
if (!result) {
cb();
return;
}
build(cb);
});
};
export {
toggle as activation,
toggle as deactivation,
};
| import { readFile } from 'fs';
import { join } from 'path';
import { some } from 'async';
import { build } from './pubsub';
const nconf = require.main.require('nconf');
const baseDir = nconf.get('base_dir');
const noop = () => {};
// build when a plugin is (de)activated if that plugin is an emoji pack
const toggle = ({ id }: { id: string }, cb: NodeBack = noop) => {
readFile(
join(baseDir, 'node_modules', id, 'plugin.json'),
'utf8',
(err, file) => {
if (err && err.code !== 'ENOENT') {
cb(err);
return;
}
if (err || !file) {
cb();
return;
}
let plugin;
try {
plugin = JSON.parse(file);
} catch (e) {
cb(e);
return;
}
const hasHook = plugin.hooks && plugin.hooks
.some((hook: { hook: string }) => hook.hook === 'filter:emoji.packs');
if (hasHook) {
build(cb);
}
},
);
};
export {
toggle as activation,
toggle as deactivation,
};
| Fix emoji pack change detection | Fix emoji pack change detection
| TypeScript | mit | julianlam/nodebb-plugin-emoji,julianlam/nodebb-plugin-emoji,julianlam/nodebb-plugin-emoji | ---
+++
@@ -1,4 +1,4 @@
-import { access } from 'fs';
+import { readFile } from 'fs';
import { join } from 'path';
import { some } from 'async';
@@ -11,30 +11,36 @@
// build when a plugin is (de)activated if that plugin is an emoji pack
const toggle = ({ id }: { id: string }, cb: NodeBack = noop) => {
- some([
- join(baseDir, 'node_modules', id, 'emoji.json'),
- join(baseDir, 'node_modules', id, 'emoji.js'),
- ], (path, next) => {
- access(path, (err) => {
+ readFile(
+ join(baseDir, 'node_modules', id, 'plugin.json'),
+ 'utf8',
+ (err, file) => {
if (err && err.code !== 'ENOENT') {
- next(err);
- } else {
- next(null, !err);
+ cb(err);
+ return;
}
- });
- }, (err: NodeJS.ErrnoException, result: boolean) => {
- if (err) {
- cb(err);
- return;
- }
- if (!result) {
- cb();
- return;
- }
+ if (err || !file) {
+ cb();
+ return;
+ }
- build(cb);
- });
+ let plugin;
+ try {
+ plugin = JSON.parse(file);
+ } catch (e) {
+ cb(e);
+ return;
+ }
+
+ const hasHook = plugin.hooks && plugin.hooks
+ .some((hook: { hook: string }) => hook.hook === 'filter:emoji.packs');
+
+ if (hasHook) {
+ build(cb);
+ }
+ },
+ );
};
export { |
9f3078f77fd3ab7e0a76c6029ca9adbfebe86f49 | app/app.component.ts | app/app.component.ts | import { Component } from '@angular/core';
// import { ROUTER_DIRECTIVES } from '@angular/router';
// import { LoginComponent } from './login.component';
@Component({
selector: 'my-app',
template: `
<md-sidenav-layout>
<md-sidenav #start (open)="closeStartButton.focus()">
Start Sidenav.
<br>
<button md-button #closeStartButton (click)="start.close()">Close</button>
</md-sidenav>
<button md-button (click)="start.open()">Menu</button>
<router-outlet></router-outlet>
</md-sidenav-layout>
`,
// directives: [ROUTER_DIRECTIVES]
})
export class AppComponent{
title = "Recomposition";
} | import { Component } from '@angular/core';
// import { ROUTER_DIRECTIVES } from '@angular/router';
// import { LoginComponent } from './login.component';
@Component({
selector: 'my-app',
template: `
<md-sidenav-layout>
<md-sidenav #start (open)="closeStartButton.focus()">
Navigation Menu
<br>
<button md-button routerLink="/home" routerLinkActive="active">Home</button>
<br>
<button md-button routerLink="/vn" routerLinkActive="active">VN</button>
<br>
<button md-button #closeStartButton (click)="start.close()">Close</button>
</md-sidenav>
<button md-button (click)="start.open()">Menu</button>
<router-outlet></router-outlet>
</md-sidenav-layout>
`,
// directives: [ROUTER_DIRECTIVES]
})
export class AppComponent{
title = "Recomposition";
} | Add some navigations to side navbar | Add some navigations to side navbar
| TypeScript | mit | skyvory/recomposition,skyvory/recompose,skyvory/recompose,skyvory/recomposition,skyvory/recomposition,skyvory/recompose | ---
+++
@@ -7,14 +7,18 @@
selector: 'my-app',
template: `
<md-sidenav-layout>
- <md-sidenav #start (open)="closeStartButton.focus()">
- Start Sidenav.
- <br>
- <button md-button #closeStartButton (click)="start.close()">Close</button>
- </md-sidenav>
+ <md-sidenav #start (open)="closeStartButton.focus()">
+ Navigation Menu
+ <br>
+ <button md-button routerLink="/home" routerLinkActive="active">Home</button>
+ <br>
+ <button md-button routerLink="/vn" routerLinkActive="active">VN</button>
+ <br>
+ <button md-button #closeStartButton (click)="start.close()">Close</button>
+
+ </md-sidenav>
-
- <button md-button (click)="start.open()">Menu</button>
+ <button md-button (click)="start.open()">Menu</button>
<router-outlet></router-outlet>
</md-sidenav-layout> |
8900acb2a5a973289c8a93b49dd4c8a9c195252a | app/vue/src/client/preview/types.ts | app/vue/src/client/preview/types.ts | import { Component } from 'vue';
export { RenderContext } from '@storybook/core';
export interface ShowErrorArgs {
title: string;
description: string;
}
// TODO: some vue expert needs to look at this
export type StoryFnVueReturnType = string | Component;
export interface IStorybookStory {
name: string;
render: () => any;
}
export interface IStorybookSection {
kind: string;
stories: IStorybookStory[];
}
| import { Component } from 'vue';
import { Args } from '@storybook/addons';
export { RenderContext } from '@storybook/core';
export interface ShowErrorArgs {
title: string;
description: string;
}
// TODO: some vue expert needs to look at this
export type StoryFnVueReturnType = string | (Component & { args?: Args });
export interface IStorybookStory {
name: string;
render: () => any;
}
export interface IStorybookSection {
kind: string;
stories: IStorybookStory[];
}
| Add args to the story return type | Vue: Add args to the story return type
| TypeScript | mit | storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook | ---
+++
@@ -1,4 +1,5 @@
import { Component } from 'vue';
+import { Args } from '@storybook/addons';
export { RenderContext } from '@storybook/core';
@@ -8,7 +9,7 @@
}
// TODO: some vue expert needs to look at this
-export type StoryFnVueReturnType = string | Component;
+export type StoryFnVueReturnType = string | (Component & { args?: Args });
export interface IStorybookStory {
name: string; |
810bf529b46c62cf6f16233bc503a5e12e191792 | lib/tasks/Mappings.ts | lib/tasks/Mappings.ts | import Clean from "./Clean";
import NodeWatchBuild from "./NodeWatchBuild";
import Test from "./Test";
import Typescript from "./Typescript";
import Build from "./Build";
import WatchBuild from "./WatchBuild";
import Scaffolding from "./Scaffolding";
const gulp = require("gulp");
export const frontend = {
"clean": Clean,
"build": gulp.series(Clean, Build),
"watch-build": WatchBuild,
"test": Test,
"new": Scaffolding
};
export const module = {
"clean": Clean,
"build": Typescript,
"test": Test,
"new": Scaffolding
};
export const nodejs = {
"clean": Clean,
"build": Typescript,
"watch-build": NodeWatchBuild,
"test": Test,
"new": Scaffolding
};
| import Clean from "./Clean";
import NodeWatchBuild from "./NodeWatchBuild";
import Test from "./Test";
import Typescript from "./Typescript";
import Build from "./Build";
import WatchBuild from "./WatchBuild";
import Scaffolding from "./Scaffolding";
const gulp = require("gulp");
export const frontend = {
"build": gulp.series(Clean, Build),
"watch-build": WatchBuild,
"test": Test,
"new": Scaffolding
};
export const module = {
"build": Typescript,
"test": Test,
"new": Scaffolding
};
export const nodejs = {
"build": Typescript,
"watch-build": NodeWatchBuild,
"test": Test,
"new": Scaffolding
};
| Remove clean task from mappings | Remove clean task from mappings
| TypeScript | mit | mtfranchetto/smild,mtfranchetto/smild,mtfranchetto/smild | ---
+++
@@ -8,7 +8,6 @@
const gulp = require("gulp");
export const frontend = {
- "clean": Clean,
"build": gulp.series(Clean, Build),
"watch-build": WatchBuild,
"test": Test,
@@ -16,14 +15,12 @@
};
export const module = {
- "clean": Clean,
"build": Typescript,
"test": Test,
"new": Scaffolding
};
export const nodejs = {
- "clean": Clean,
"build": Typescript,
"watch-build": NodeWatchBuild,
"test": Test, |
82411881240b267bb54fd3f4ea8907509cd43ba0 | platforms/platform-web/src/index.ts | platforms/platform-web/src/index.ts | import { Core, CorePlatform, CorePlatformConfig } from '@jovotech/platform-core';
declare module '@jovotech/framework/dist/types/Extensible' {
interface ExtensiblePluginConfig {
WebPlatform?: CorePlatformConfig<'web'>;
}
interface ExtensiblePlugins {
WebPlatform?: CorePlatform<'web'>;
}
}
declare module '@jovotech/framework/dist/types/Jovo' {
interface Jovo {
$web?: Core;
}
}
export const WebPlatform = CorePlatform.createCustomPlatform('WebPlatform', 'web');
export * from '@jovotech/platform-core';
| import {
Core,
CorePlatform,
CorePlatformConfig,
NormalizedCoreOutputTemplate,
} from '@jovotech/platform-core';
declare module '@jovotech/framework/dist/types/Extensible' {
interface ExtensiblePluginConfig {
WebPlatform?: CorePlatformConfig<'web'>;
}
interface ExtensiblePlugins {
WebPlatform?: CorePlatform<'web'>;
}
}
declare module '@jovotech/framework/dist/types/Jovo' {
interface Jovo {
$web?: Core;
}
}
declare module '@jovotech/framework/dist/types/index' {
interface NormalizedOutputTemplatePlatforms {
web?: NormalizedCoreOutputTemplate;
}
}
export const WebPlatform = CorePlatform.createCustomPlatform('WebPlatform', 'web');
export * from '@jovotech/platform-core';
| Add augment platforms property to include a typed web-property | :sparkles: Add augment platforms property to include a typed web-property
| TypeScript | apache-2.0 | jovotech/jovo-framework-nodejs,jovotech/jovo-framework-nodejs | ---
+++
@@ -1,4 +1,9 @@
-import { Core, CorePlatform, CorePlatformConfig } from '@jovotech/platform-core';
+import {
+ Core,
+ CorePlatform,
+ CorePlatformConfig,
+ NormalizedCoreOutputTemplate,
+} from '@jovotech/platform-core';
declare module '@jovotech/framework/dist/types/Extensible' {
interface ExtensiblePluginConfig {
@@ -16,5 +21,11 @@
}
}
+declare module '@jovotech/framework/dist/types/index' {
+ interface NormalizedOutputTemplatePlatforms {
+ web?: NormalizedCoreOutputTemplate;
+ }
+}
+
export const WebPlatform = CorePlatform.createCustomPlatform('WebPlatform', 'web');
export * from '@jovotech/platform-core'; |
70f71865d653dcb2b1986d1e45ba15d0239dc335 | src/demo/ts/dialogs/WordcountDialog.ts | src/demo/ts/dialogs/WordcountDialog.ts | import { createTable } from 'src/main/ts/ephox/bridge/components/dialog/Table';
export const createWordcountDialog = () => {
createTable({
type: 'table',
header: [ 'hello', 'world'],
cells: [
['hej', 'vaerld'],
['yahoo', 'sekai']
]
});
}; | import { createTable } from '../../../main/ts/ephox/bridge/components/dialog/Table';
export const createWordcountDialog = () => {
createTable({
type: 'table',
header: [ 'hello', 'world'],
cells: [
['hej', 'vaerld'],
['yahoo', 'sekai']
]
});
}; | Use proper relative paths to the table module | Use proper relative paths to the table module
| TypeScript | mit | tinymce/tinymce,TeamupCom/tinymce,tinymce/tinymce,tinymce/tinymce,FernCreek/tinymce,TeamupCom/tinymce,FernCreek/tinymce,FernCreek/tinymce | ---
+++
@@ -1,4 +1,4 @@
-import { createTable } from 'src/main/ts/ephox/bridge/components/dialog/Table';
+import { createTable } from '../../../main/ts/ephox/bridge/components/dialog/Table';
export const createWordcountDialog = () => {
createTable({ |
84ee65325cc38a3984bbfb29f3083dd7a6e96c62 | src/index.ts | src/index.ts | /**
* @file The primary entry for Innerface.
*
* @author Justin Toon
* @license MIT
*/
import {forEach} from 'lodash-es';
import { SELECTORS } from './if.const';
import * as controllers from './controllers';
/**
* A system of simple UI actions implemented with an HTML API.
*
* @since 0.1.0
*/
export default class Innerface {
/**
* Initialize the library.
*/
public static init() {
forEach(controllers, (controller : () => Innerface.Controller, key : string) => {
controller().initialize();
});
}
}
| /**
* @file The primary entry for Innerface.
*
* @author Justin Toon
* @license MIT
*/
import {forEach} from 'lodash-es';
import {SELECTORS} from './if.const';
import * as controllers from './controllers';
/**
* A system of simple UI actions implemented with an HTML API.
*
* @since 0.1.0
*/
class Innerface {
/**
* Initialize the library.
*/
public static init() {
forEach(controllers, (controller : () => Innerface.Controller, key : string) => {
controller().initialize();
});
}
}
document.addEventListener('DOMContentLoaded', () => {
Innerface.init();
}); | Initialize innerface on page load | Initialize innerface on page load
| TypeScript | mit | overneath42/innerface,overneath42/innerface | ---
+++
@@ -7,7 +7,7 @@
import {forEach} from 'lodash-es';
-import { SELECTORS } from './if.const';
+import {SELECTORS} from './if.const';
import * as controllers from './controllers';
/**
@@ -15,7 +15,7 @@
*
* @since 0.1.0
*/
-export default class Innerface {
+class Innerface {
/**
* Initialize the library.
*/
@@ -24,4 +24,8 @@
controller().initialize();
});
}
- }
+}
+
+document.addEventListener('DOMContentLoaded', () => {
+ Innerface.init();
+}); |
ba52ff503564365822cffdab913619eb65190983 | src/index.ts | src/index.ts | import { createStore, Store, StoreOptions } from "./Store"
import { Resource, ResourceActionOptions, ResourceOptions } from "./Resource"
export class Vapi {
private resource: Resource
constructor(options: ResourceOptions) {
this.resource = new Resource(options)
return this
}
get(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "get" }))
}
delete(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "delete" }))
}
post(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "post" }))
}
put(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "put" }))
}
patch(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "patch" }))
}
add(options: ResourceActionOptions): Vapi {
this.resource.add(options)
return this
}
getStore(options: StoreOptions = {}): Store {
return createStore(this.resource, options)
}
}
export default Vapi | import { createStore, Store, StoreOptions } from "./Store"
import { Resource, ResourceActionOptions, ResourceOptions } from "./Resource"
export class Vapi {
private resource: Resource
constructor(options: ResourceOptions) {
this.resource = new Resource(options)
return this
}
get(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "get" }))
}
delete(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "delete" }))
}
head(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "head" }))
}
post(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "post" }))
}
put(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "put" }))
}
patch(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "patch" }))
}
add(options: ResourceActionOptions): Vapi {
this.resource.add(options)
return this
}
getStore(options: StoreOptions = {}): Store {
return createStore(this.resource, options)
}
}
export default Vapi | Add missing head shortcut function | Add missing head shortcut function
| TypeScript | mit | christianmalek/vuex-rest-api,christianmalek/vuex-rest-api,christianmalek/vuex-rest-api | ---
+++
@@ -15,6 +15,10 @@
delete(options: ResourceActionOptions) {
return this.add(Object.assign(options, { method: "delete" }))
+ }
+
+ head(options: ResourceActionOptions) {
+ return this.add(Object.assign(options, { method: "head" }))
}
post(options: ResourceActionOptions) { |
ae59a787c1fc7ac7031f48646c7d444dda37dd6a | 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/1.0.4',
RELEASEVERSION: '1.0.4'
};
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/1.0.5',
RELEASEVERSION: '1.0.5'
};
export = BaseConfig;
| Increase release version to 1.0.5 | Increase release version to 1.0.5
| 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/1.0.4',
- RELEASEVERSION: '1.0.4'
+ RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/1.0.5',
+ RELEASEVERSION: '1.0.5'
};
export = BaseConfig; |
78b202363ffdba973967e2fa1576ef9553721a42 | components/feature-table/feature-table.component.ts | components/feature-table/feature-table.component.ts | /* eslint-disable @typescript-eslint/no-unused-vars */
import {Component, OnInit} from '@angular/core';
import {HsConfig} from '../../config.service';
import {HsFeatureTableService} from './feature-table.service';
import {Layer} from 'ol/layer';
/**
* @memberof hs.featureTable
* @ngdoc component
* @name HsFeatureTableComponent
*/
@Component({
selector: 'hs-feature-table',
template: require('./partials/feature-table.html'),
})
export class HsFeatureTableComponent implements OnInit {
layers: Layer[] = [];
constructor(
private HsFeatureTableService: HsFeatureTableService,
private HsConfig: HsConfig
) {}
ngOnInit(): void {
for (const layer of this.HsConfig.layersInFeatureTable) {
this.addLayerToTable(layer);
}
}
addLayerToTable(layer: Layer): void {
const layerDiscriptor = this.HsFeatureTableService.addLayer(layer);
if (layerDiscriptor) {
this.layers.push(layerDiscriptor);
}
}
}
| /* eslint-disable @typescript-eslint/no-unused-vars */
import {Component, OnInit} from '@angular/core';
import {HsConfig} from '../../config.service';
import {HsFeatureTableService} from './feature-table.service';
import {Layer} from 'ol/layer';
/**
* @memberof hs.featureTable
* @ngdoc component
* @name HsFeatureTableComponent
*/
@Component({
selector: 'hs-feature-table',
template: require('./partials/feature-table.html'),
})
export class HsFeatureTableComponent implements OnInit {
layers: Layer[] = [];
constructor(
private HsFeatureTableService: HsFeatureTableService,
private HsConfig: HsConfig
) {}
ngOnInit(): void {
for (const layer of this.HsConfig.layersInFeatureTable || []) {
this.addLayerToTable(layer);
}
}
addLayerToTable(layer: Layer): void {
const layerDiscriptor = this.HsFeatureTableService.addLayer(layer);
if (layerDiscriptor) {
this.layers.push(layerDiscriptor);
}
}
}
| Fix crash when layersInFeatureTable config is not set | Fix crash when layersInFeatureTable config is not set
| TypeScript | mit | hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng,hslayers/hslayers-ng | ---
+++
@@ -19,7 +19,7 @@
private HsConfig: HsConfig
) {}
ngOnInit(): void {
- for (const layer of this.HsConfig.layersInFeatureTable) {
+ for (const layer of this.HsConfig.layersInFeatureTable || []) {
this.addLayerToTable(layer);
}
} |
aa84883240b4b99c01639911a606f0f5ddb09f78 | src/main.tsx | src/main.tsx | import * as React from "react";
import * as ReactDOM from "react-dom";
import * as injectTapEventPlugin from "react-tap-event-plugin";
import MenuBar from "./components/menu/MenuBar";
import SimpleContent from "./components/SimpleContent";
import TopPage from "./components/top/TopPage";
import EventPage from "./components/event/EventPage";
import StagePage from "./components/stage/StagePage";
import SearchPage from "./components/search/SearchPage";
import MapPage from "./components/map/MapPage";
import MapEventList from "./components/map/MapEventList";
import { Router, Route, hashHistory, IndexRoute } from "react-router";
injectTapEventPlugin();
interface Text {
content: string;
}
class TestElement extends React.Component<Text, {}> {
render() {
return (
<div className="test">
<MenuBar appName="Shibaura Fes Navi" />
{this.props.children || <TopPage />}
</div>
);
}
}
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={TestElement}>
<IndexRoute component={TopPage} />
<Route path="/event" component={EventPage} />
<Route path="/stage" component={StagePage} />
<Route path="/search" component={SearchPage} />
<Route path="/map" component={MapPage} />
<Route path="/building/:building/:room_or_stall" component={MapEventList} />
</Route>
</Router>
), document.getElementById("app")); | import * as React from "react";
import * as ReactDOM from "react-dom";
import * as injectTapEventPlugin from "react-tap-event-plugin";
import MenuBar from "./components/menu/MenuBar";
import SimpleContent from "./components/SimpleContent";
import TopPage from "./components/top/TopPage";
import EventPage from "./components/event/EventPage";
import StagePage from "./components/stage/StagePage";
import SearchPage from "./components/search/SearchPage";
import MapPage from "./components/map/MapPage";
import MapEventList from "./components/map/MapEventList";
import AboutPage from "./components/about/AboutPage";
import { Router, Route, hashHistory, IndexRoute } from "react-router";
injectTapEventPlugin();
interface Text {
content: string;
}
class TestElement extends React.Component<Text, {}> {
render() {
return (
<div className="test">
<MenuBar appName="Shibaura Fes Navi" />
{this.props.children || <TopPage />}
</div>
);
}
}
ReactDOM.render((
<Router history={hashHistory}>
<Route path="/" component={TestElement}>
<IndexRoute component={TopPage} />
<Route path="/event" component={EventPage} />
<Route path="/stage" component={StagePage} />
<Route path="/search" component={SearchPage} />
<Route path="/map" component={MapPage} />
<Route path="/building/:building/:room_or_stall" component={MapEventList} />
<Route path="/about" component={AboutPage} />
</Route>
</Router>
), document.getElementById("app")); | Add react-router path for abou | Add react-router path for abou
| TypeScript | mit | SIT-DigiCre/ShibaurasaiApp,SIT-DigiCre/ShibaurasaiApp,SIT-DigiCre/ShibaurasaiApp | ---
+++
@@ -9,6 +9,7 @@
import SearchPage from "./components/search/SearchPage";
import MapPage from "./components/map/MapPage";
import MapEventList from "./components/map/MapEventList";
+import AboutPage from "./components/about/AboutPage";
import { Router, Route, hashHistory, IndexRoute } from "react-router";
injectTapEventPlugin();
@@ -37,6 +38,7 @@
<Route path="/search" component={SearchPage} />
<Route path="/map" component={MapPage} />
<Route path="/building/:building/:room_or_stall" component={MapEventList} />
+ <Route path="/about" component={AboutPage} />
</Route>
</Router>
), document.getElementById("app")); |
546bc651fc38cd2581822b850b14fb20e760c81b | src/index.ts | src/index.ts | /**
* This module exports the public API for visual-plugin, registers
* visual-plugin as an Intern plugin, and installs the visual regression
* reporter.
*/ /** */
import assertVisuals from './assert';
import config, { Config } from './config';
import visualTest from './test';
import resizeWindow from './helpers/resizeWindow';
import VisualRegression from './reporters/VisualRegression';
const helpers = {
resizeWindow
};
export { assertVisuals, config, helpers, visualTest };
intern.registerPlugin('visual', options => {
const opts: Config = <Config>options || {};
Object.assign(config, opts);
let reporter: VisualRegression | undefined;
if (config.report !== false) {
reporter = new VisualRegression(intern, config);
}
return {
reporter
};
});
| /**
* This module exports the public API for visual-plugin, registers
* visual-plugin as an Intern plugin, and installs the visual regression
* reporter.
*/ /** */
import assertVisuals from './assert';
import config, { Config } from './config';
import visualTest from './test';
import resizeWindow from './helpers/resizeWindow';
import VisualRegression from './reporters/VisualRegression';
const helpers = {
resizeWindow
};
export { assertVisuals, config, helpers, visualTest };
intern.registerPlugin('visual', options => {
const opts: Config = <Config>options || {};
Object.assign(config, opts);
let reporter: VisualRegression | undefined;
if (config.report !== false) {
reporter = new VisualRegression(intern, config);
}
// All the standard exports, as well as the reporter, are available on the
// registered plugin.
return {
reporter,
assertVisuals,
config,
helpers,
visualTest
};
});
| Include all package exports on registerd plugin | Include all package exports on registerd plugin
| TypeScript | mpl-2.0 | theintern/intern-visual,theintern/intern-visual,theintern/intern-visual | ---
+++
@@ -25,7 +25,13 @@
reporter = new VisualRegression(intern, config);
}
+ // All the standard exports, as well as the reporter, are available on the
+ // registered plugin.
return {
- reporter
+ reporter,
+ assertVisuals,
+ config,
+ helpers,
+ visualTest
};
}); |
3f65aee884dd5a7027e177d0ddeab8021ed0cecf | src/Types.ts | src/Types.ts | export type Map<T> = {[key: string]: T};
export type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH';
| import { IncomingMessage } from 'http';
import { Buffer } from 'buffer';
export type Map<T> = {[key: string]: T};
export type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH';
export interface ProxyResponse {
message: IncomingMessage,
body: string | Buffer
}
| Add a proxy response type. | Add a proxy response type.
| TypeScript | mit | syrp-nz/ts-lambda-handler,syrp-nz/ts-lambda-handler | ---
+++
@@ -1,3 +1,12 @@
+import { IncomingMessage } from 'http';
+import { Buffer } from 'buffer';
+
+
export type Map<T> = {[key: string]: T};
export type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'OPTIONS' | 'PATCH';
+
+export interface ProxyResponse {
+ message: IncomingMessage,
+ body: string | Buffer
+} |
c5a2b2c19beedfce79492f96e734e8505b003d61 | src/index.ts | src/index.ts | // Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
| // Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
throw new Error("Use the `webreed` or `webreed-core` package to interact with webreed API.");
| Throw error when attempting to import package directly. | Throw error when attempting to import package directly.
| TypeScript | mit | webreed/webreed-cli,webreed/webreed-cli | ---
+++
@@ -1,3 +1,4 @@
// Copyright (c) Rotorz Limited. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root.
+throw new Error("Use the `webreed` or `webreed-core` package to interact with webreed API."); |
a33607a09af9058a1d8ab0120e4ae29520334016 | src/PictData.ts | src/PictData.ts | import { BaseData, DefaultBaseData } from "./BaseData";
import * as fs from "fs";
import * as path from "path";
interface PictData extends BaseData {
PNG: Buffer
}
console.log(path.resolve("./"))
const DefaultPictData: PictData = {
...DefaultBaseData,
PNG: fs.readFileSync(path.join(__dirname, "default.png"))
}
export { PictData, DefaultPictData }
| import { BaseData, DefaultBaseData } from "./BaseData";
import * as fs from "fs";
import * as path from "path";
interface PictData extends BaseData {
PNG: Buffer
}
const DefaultPictData: PictData = {
...DefaultBaseData,
PNG: fs.readFileSync(require.resolve("./default.png"))
}
export { PictData, DefaultPictData }
| Fix a bug where the default png is loaded from the wrong path | Fix a bug where the default png is loaded from the wrong path
| TypeScript | mit | mattsoulanille/NovaJS,mattsoulanille/NovaJS,mattsoulanille/NovaJS | ---
+++
@@ -5,10 +5,10 @@
interface PictData extends BaseData {
PNG: Buffer
}
-console.log(path.resolve("./"))
+
const DefaultPictData: PictData = {
...DefaultBaseData,
- PNG: fs.readFileSync(path.join(__dirname, "default.png"))
+ PNG: fs.readFileSync(require.resolve("./default.png"))
}
export { PictData, DefaultPictData } |
ed9d904ef4398cf0994ff3de616e698dcbc756b6 | src/Test/Html/Config/ToggleSpoiler.ts | src/Test/Html/Config/ToggleSpoiler.ts | import { expect } from 'chai'
import Up from '../../../index'
import { InlineSpoilerNode } from '../../../SyntaxNodes/InlineSpoilerNode'
describe("The text in an inline spoiler's label", () => {
it("uses the provided term for 'toggleSpoiler'", () => {
const up = new Up({
i18n: {
terms: { toggleSpoiler: 'show/hide' }
}
})
const node = new InlineSpoilerNode([])
const html =
'<span class="up-spoiler up-revealable">'
+ '<label for="up-spoiler-1">show/hide</label>'
+ '<input id="up-spoiler-1" type="checkbox">'
+ '<span></span>'
+ '</span>'
expect(up.toHtml(node)).to.be.eql(html)
})
})
| import { expect } from 'chai'
import Up from '../../../index'
import { InlineSpoilerNode } from '../../../SyntaxNodes/InlineSpoilerNode'
import { SpoilerBlockNode } from '../../../SyntaxNodes/SpoilerBlockNode'
describe("The text in an inline spoiler's label", () => {
it("uses the provided term for 'toggleSpoiler'", () => {
const up = new Up({
i18n: {
terms: { toggleSpoiler: 'show/hide' }
}
})
const node = new InlineSpoilerNode([])
const html =
'<span class="up-spoiler up-revealable">'
+ '<label for="up-spoiler-1">show/hide</label>'
+ '<input id="up-spoiler-1" type="checkbox">'
+ '<span></span>'
+ '</span>'
expect(up.toHtml(node)).to.be.eql(html)
})
})
describe("The text in a spoiler block's label", () => {
it("uses the provided term for 'toggleSpoiler'", () => {
const up = new Up({
i18n: {
terms: { toggleSpoiler: 'show/hide' }
}
})
const node = new SpoilerBlockNode([])
const html =
'<div class="up-spoiler up-revealable">'
+ '<label for="up-spoiler-1">show/hide</label>'
+ '<input id="up-spoiler-1" type="checkbox">'
+ '<div></div>'
+ '</div>'
expect(up.toHtml(node)).to.be.eql(html)
})
})
| Add passing spoiler block HTML test | Add passing spoiler block HTML test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -1,6 +1,7 @@
import { expect } from 'chai'
import Up from '../../../index'
import { InlineSpoilerNode } from '../../../SyntaxNodes/InlineSpoilerNode'
+import { SpoilerBlockNode } from '../../../SyntaxNodes/SpoilerBlockNode'
describe("The text in an inline spoiler's label", () => {
@@ -23,3 +24,26 @@
expect(up.toHtml(node)).to.be.eql(html)
})
})
+
+
+describe("The text in a spoiler block's label", () => {
+ it("uses the provided term for 'toggleSpoiler'", () => {
+ const up = new Up({
+ i18n: {
+ terms: { toggleSpoiler: 'show/hide' }
+ }
+ })
+
+ const node = new SpoilerBlockNode([])
+
+ const html =
+ '<div class="up-spoiler up-revealable">'
+ + '<label for="up-spoiler-1">show/hide</label>'
+ + '<input id="up-spoiler-1" type="checkbox">'
+ + '<div></div>'
+ + '</div>'
+
+ expect(up.toHtml(node)).to.be.eql(html)
+ })
+})
+ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.