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 |
|---|---|---|---|---|---|---|---|---|---|---|
cffe062e3775a81b335346abd1c5986887bb058d | app/javascript/SortableUtils.ts | app/javascript/SortableUtils.ts | import { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
import { CSS, Transform } from '@dnd-kit/utilities';
import { CSSProperties } from 'react';
export function useSortableDndSensors(): ReturnType<typeof useSensors> {
return useSensors(
useSensor(PointerSensor),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
}),
);
}
export function getSortableStyle(
transform: Transform | null,
transition: string | null,
isDragging: boolean,
): CSSProperties {
return {
transform: CSS.Transform.toString(transform),
transition: transition ?? undefined,
opacity: isDragging ? 0.5 : undefined,
};
}
| import { KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
import { CSS, Transform } from '@dnd-kit/utilities';
import { CSSProperties } from 'react';
export function useSortableDndSensors(): ReturnType<typeof useSensors> {
return useSensors(
useSensor(PointerSensor),
useSensor(KeyboardSensor, {
coordinateGetter: sortableKeyboardCoordinates,
}),
);
}
export function getSortableStyle(
transform: Transform | null,
transition: string | undefined,
isDragging: boolean,
): CSSProperties {
return {
transform: CSS.Transform.toString(transform),
transition: transition ?? undefined,
opacity: isDragging ? 0.5 : undefined,
};
}
| Fix types for new dnd-kit version | Fix types for new dnd-kit version
| TypeScript | mit | neinteractiveliterature/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library,neinteractiveliterature/larp_library | ---
+++
@@ -14,7 +14,7 @@
export function getSortableStyle(
transform: Transform | null,
- transition: string | null,
+ transition: string | undefined,
isDragging: boolean,
): CSSProperties {
return { |
cdada4c185ab5a634c5be777c592e45b57b14ae7 | src/util/statusBarTextUtils.ts | src/util/statusBarTextUtils.ts | import { ModeName } from '../mode/mode';
import { StatusBar } from '../statusBar';
import { VimState } from '../state/vimState';
import { configuration } from '../configuration/configuration';
export function ReportClear(vimState: VimState) {
StatusBar.Set('', vimState.currentMode, vimState.isRecordingMacro, true);
}
export function ReportLinesChanged(numLinesChanged: number, vimState: VimState) {
if (numLinesChanged > configuration.report) {
StatusBar.Set(
numLinesChanged + ' more lines',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else if (-numLinesChanged > configuration.report) {
StatusBar.Set(
numLinesChanged + ' fewer lines',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else {
ReportClear(vimState);
}
}
export function ReportLinesYanked(numLinesYanked: number, vimState: VimState) {
if (numLinesYanked > configuration.report) {
if (vimState.currentMode === ModeName.VisualBlock) {
StatusBar.Set(
'block of ' + numLinesYanked + ' lines yanked',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else {
StatusBar.Set(
numLinesYanked + ' lines yanked',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
}
} else {
ReportClear(vimState);
}
}
| import { ModeName } from '../mode/mode';
import { StatusBar } from '../statusBar';
import { VimState } from '../state/vimState';
import { configuration } from '../configuration/configuration';
export function ReportClear(vimState: VimState) {
StatusBar.Set('', vimState.currentMode, vimState.isRecordingMacro, true);
}
export function ReportLinesChanged(numLinesChanged: number, vimState: VimState) {
if (numLinesChanged > configuration.report) {
StatusBar.Set(
numLinesChanged + ' more lines',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else if (-numLinesChanged > configuration.report) {
StatusBar.Set(
Math.abs(numLinesChanged) + ' fewer lines',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else {
ReportClear(vimState);
}
}
export function ReportLinesYanked(numLinesYanked: number, vimState: VimState) {
if (numLinesYanked > configuration.report) {
if (vimState.currentMode === ModeName.VisualBlock) {
StatusBar.Set(
'block of ' + numLinesYanked + ' lines yanked',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
} else {
StatusBar.Set(
numLinesYanked + ' lines yanked',
vimState.currentMode,
vimState.isRecordingMacro,
true
);
}
} else {
ReportClear(vimState);
}
}
| Fix accidentally displaying minus sign | Fix accidentally displaying minus sign
| TypeScript | mit | VSCodeVim/Vim,VSCodeVim/Vim | ---
+++
@@ -17,7 +17,7 @@
);
} else if (-numLinesChanged > configuration.report) {
StatusBar.Set(
- numLinesChanged + ' fewer lines',
+ Math.abs(numLinesChanged) + ' fewer lines',
vimState.currentMode,
vimState.isRecordingMacro,
true |
4f03539b6b0be5daceca828bec28e5cc103fd3b9 | src/Parsing/Inline/ParseLink.ts | src/Parsing/Inline/ParseLink.ts | import { parseInlineConventions } from './ParseInlineConventions'
import { TextConsumer } from '../TextConsumer'
import { applyBackslashEscaping } from '../TextHelpers'
import { LinkNode } from '../../SyntaxNodes/LinkNode'
import { InlineParserArgs, InlineParser } from './InlineParser'
export function parseLink(args: InlineParserArgs): boolean {
const consumer = new TextConsumer(args.text)
const linkNode = new LinkNode(args.parentNode)
// Links cannot be nested within other links
if (linkNode.ancestors().some(ancestor => ancestor instanceof LinkNode)) {
return false
}
// TODO: Handle terminator?
return (
// Parse the opening bracket
consumer.consumeIfMatches('[')
// Parse the link's content and the URL arrow
&& parseInlineConventions({
text: consumer.remainingText(),
parentNode: linkNode,
terminator: ' -> ',
then: (resultNodes, lengthParsed) => {
consumer.skip(lengthParsed)
linkNode.addChildren(resultNodes)
}
})
// Parse the URL and the closing bracket
&& consumer.consumeUpTo({
needle: ']',
then: (url) => {
linkNode.url = applyBackslashEscaping(url)
args.then([linkNode], consumer.lengthConsumed())
}
})
)
} | import { parseInlineConventions } from './ParseInlineConventions'
import { TextConsumer } from '../TextConsumer'
import { applyBackslashEscaping } from '../TextHelpers'
import { LinkNode } from '../../SyntaxNodes/LinkNode'
import { InlineParserArgs, InlineParser } from './InlineParser'
export function parseLink(args: InlineParserArgs): boolean {
const consumer = new TextConsumer(args.text)
const linkNode = new LinkNode(args.parentNode)
// TODO: Handle terminator?
return (
// Parse the opening bracket
consumer.consumeIfMatches('[')
// Parse the link's content and the URL arrow
&& parseInlineConventions({
text: consumer.remainingText(),
parentNode: linkNode,
terminator: ' -> ',
then: (resultNodes, lengthParsed) => {
consumer.skip(lengthParsed)
linkNode.addChildren(resultNodes)
}
})
// Parse the URL and the closing bracket
&& consumer.consumeUpTo({
needle: ']',
then: (url) => {
linkNode.url = applyBackslashEscaping(url)
args.then([linkNode], consumer.lengthConsumed())
}
})
)
} | Allow nested links; fail a test | Allow nested links; fail a test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -7,11 +7,6 @@
export function parseLink(args: InlineParserArgs): boolean {
const consumer = new TextConsumer(args.text)
const linkNode = new LinkNode(args.parentNode)
-
- // Links cannot be nested within other links
- if (linkNode.ancestors().some(ancestor => ancestor instanceof LinkNode)) {
- return false
- }
// TODO: Handle terminator?
|
a1930a4aa9e3b114ab15c94cd0cfbbd17bf1945d | src/browser/audio/Component.tsx | src/browser/audio/Component.tsx | import React, { useState, FunctionComponent, ChangeEvent } from "react";
type Props = {
initialVolume: number;
onChangeVolume: (volume: number) => void;
};
const Component: FunctionComponent<Props> = props => {
const [volume, setVolume] = useState(props.initialVolume);
const onChange = (event: ChangeEvent<HTMLInputElement>) => {
const volume = parseFloat(event.target.value);
setVolume(volume);
props.onChangeVolume(volume);
};
return (
<form id="controls">
Volume{" "}
<input
type="range"
min="0"
max="1"
step="0.01"
value={volume}
onChange={onChange}
/>
</form>
);
};
export default Component;
| import React, { useState, FunctionComponent, ChangeEvent } from "react";
type Props = {
initialVolume: number;
onChangeVolume: (volume: number) => void;
};
const Component: FunctionComponent<Props> = props => {
const [volume, setVolume] = useState(props.initialVolume);
const onChange = (event: ChangeEvent<HTMLInputElement>) => {
const volume = parseFloat(event.target.value);
setVolume(volume);
props.onChangeVolume(volume);
};
return (
<form id="controls">
<label>
Volume{" "}
<input
type="range"
min="0"
max="1"
step="0.01"
value={volume}
onChange={onChange}
/>
</label>
</form>
);
};
export default Component;
| Fix "Form elements do not have associated labels" | Fix "Form elements do not have associated labels"
(from Lighthouse Accessibility audit)
| TypeScript | mit | frosas/lag,frosas/lag,frosas/lag | ---
+++
@@ -16,15 +16,17 @@
return (
<form id="controls">
- Volume{" "}
- <input
- type="range"
- min="0"
- max="1"
- step="0.01"
- value={volume}
- onChange={onChange}
- />
+ <label>
+ Volume{" "}
+ <input
+ type="range"
+ min="0"
+ max="1"
+ step="0.01"
+ value={volume}
+ onChange={onChange}
+ />
+ </label>
</form>
);
}; |
c9232b73e1bfb0e1cb76b424c3ad6b5acf8e025b | src/services/DeviceService.ts | src/services/DeviceService.ts | import winston from 'winston';
import DeviceModel from '../models/device';
export default class DeviceService {
// region public static methods
public static async addDevice(platform: string, mail: string, token: string) {
let device = await DeviceModel.findOne({ platform, mail });
if (!device) {
device = new DeviceModel({
platform,
mail,
tokens: [],
});
await device.save();
}
if (device.tokens.indexOf(token) !== -1) {
const errorMessage = `Could not add Device: Device (platform: ${platform}, mail: ${mail},
token: ${token}) already exists.`;
winston.error(errorMessage);
throw new Error(errorMessage);
}
device.tokens.push(token);
await device.save();
}
public static async getDevices(platform: string, mail: string): Promise<string[]> {
const device = await DeviceModel.findOne({ platform, mail });
if (!device) {
const errorMessage = `Could not find Device: Device (mail: ${mail}) does not exists.`;
winston.error(errorMessage);
throw new Error(errorMessage);
}
return device.tokens;
}
// endregion
// region private static methods
// endregion
// region public members
// endregion
// region private members
// endregion
// region constructor
// endregion
// region public methods
// endregion
// region private methods
// endregion
}
| import winston from 'winston';
import DeviceModel from '../models/device';
export default class DeviceService {
// region public static methods
public static async addDevice(platform: string, mail: string, token: string) {
let device = await DeviceModel.findOne({ platform, mail });
if (!device) {
device = new DeviceModel({
platform,
mail,
tokens: [],
});
await device.save();
}
if (device.tokens.indexOf(token) !== -1) {
const errorMessage = `Could not add Device: Device (platform: ${platform}, mail: ${mail},
token: ${token}) already exists.`;
winston.error(errorMessage);
throw new Error(errorMessage);
}
device.tokens.push(token);
await device.save();
}
public static async getDevices(platform: string, mail: string): Promise<string[]> {
const device = await DeviceModel.findOne({ platform, mail });
if (!device) {
return new Promise<string[]>((resolve) => {
resolve([]);
});
}
return device.tokens;
}
// endregion
// region private static methods
// endregion
// region public members
// endregion
// region private members
// endregion
// region constructor
// endregion
// region public methods
// endregion
// region private methods
// endregion
}
| Return empty array if the user has no devices | Return empty array if the user has no devices
| TypeScript | mit | schulcloud/node-notification-service,schulcloud/node-notification-service,schulcloud/node-notification-service | ---
+++
@@ -28,9 +28,9 @@
public static async getDevices(platform: string, mail: string): Promise<string[]> {
const device = await DeviceModel.findOne({ platform, mail });
if (!device) {
- const errorMessage = `Could not find Device: Device (mail: ${mail}) does not exists.`;
- winston.error(errorMessage);
- throw new Error(errorMessage);
+ return new Promise<string[]>((resolve) => {
+ resolve([]);
+ });
}
return device.tokens; |
4ad09c7189564393fbb0931fb0d22c279cfe086e | src/api/acceptHit.ts | src/api/acceptHit.ts | import axios from 'axios';
import { API_URL } from '../constants';
// import { validateHitAccept } from '../utils/parsing';
export interface HitAcceptResponse {
readonly successful: boolean;
}
/**
* Strange code ahead, explanation:
*
* 1. This API call will *always* hit the catch block in production.
* 2. This is because successfully accepting a HIT will redirect to a HTTP URL,
* prompting the browser to cancel the request.
* 3. Failing to accept a HIT will also hit the catch block because of a 404.
* 4. We get the 404 only by sending in a nonsense string as the format.
* 5. Therefore, if the request ends in a 404, the accept failed.
* 6. Otherwise, it was successful.
*/
export const sendHitAcceptRequest = async (
groupId: string
): Promise<HitAcceptResponse> => {
try {
await axios.get<Document>(
`${API_URL}/projects/${groupId}/tasks/accept_random`,
{
params: {
format: 'gibberish'
},
responseType: 'document'
}
);
return {
successful: true
};
} catch (e) {
if (e.response && e.response.status === 404) {
return {
successful: false
};
} else {
return {
successful: true
};
}
}
};
| import axios from 'axios';
import { API_URL } from '../constants';
import { validateHitAccept } from '../utils/parsing';
export interface HitAcceptResponse {
readonly successful: boolean;
}
/**
* Strange code ahead, explanation:
*
* 1. This API call will *always* hit the catch block in production.
* 2. This is because successfully accepting a HIT will redirect to a HTTP URL,
* prompting the browser to cancel the request.
* 3. Failing to accept a HIT will also hit the catch block because of a 404.
* 4. We get the 404 only by sending in a nonsense string as the format.
* 5. Therefore, if the request ends in a 404, the accept failed.
* 6. Otherwise, it was successful.
*/
export const sendHitAcceptRequest = async (
groupId: string
): Promise<HitAcceptResponse> => {
try {
const response = await axios.get<Document>(
`${API_URL}/projects/${groupId}/tasks/accept_random`,
{
params: {
format: 'gibberish'
},
responseType: 'document'
}
);
return {
successful: validateHitAccept(response.data)
};
} catch (e) {
if (
(e.response && e.response.status === 404) ||
(e.response && e.response.status === 429)
) {
return {
successful: false
};
} else {
return {
successful: true
};
}
}
};
| Return unsuccessful on 429 error code. | Return unsuccessful on 429 error code.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -1,6 +1,6 @@
import axios from 'axios';
import { API_URL } from '../constants';
-// import { validateHitAccept } from '../utils/parsing';
+import { validateHitAccept } from '../utils/parsing';
export interface HitAcceptResponse {
readonly successful: boolean;
@@ -22,7 +22,7 @@
groupId: string
): Promise<HitAcceptResponse> => {
try {
- await axios.get<Document>(
+ const response = await axios.get<Document>(
`${API_URL}/projects/${groupId}/tasks/accept_random`,
{
params: {
@@ -32,10 +32,13 @@
}
);
return {
- successful: true
+ successful: validateHitAccept(response.data)
};
} catch (e) {
- if (e.response && e.response.status === 404) {
+ if (
+ (e.response && e.response.status === 404) ||
+ (e.response && e.response.status === 429)
+ ) {
return {
successful: false
}; |
38b53105f8ff8356140e80b49a7a85ca2e5589a2 | source/features/fix-squash-and-merge-title.tsx | source/features/fix-squash-and-merge-title.tsx | import select from 'select-dom';
import features from '../libs/features';
function init() {
const btn = select('.merge-message .btn-group-squash [type=submit]');
if (!btn) {
return false;
}
btn.addEventListener('click', () => {
const title = select('.js-issue-title').textContent;
const number = select('.gh-header-number').textContent;
select<HTMLTextAreaElement>('#merge_title_field').value = `${title.trim()} (${number})`;
});
}
features.add({
id: 'fix-squash-and-merge-title',
include: [
features.isPR
],
load: features.onAjaxedPages,
init
});
| import select from 'select-dom';
import features from '../libs/features';
function init() {
const btn = select('.merge-message .btn-group-squash [type=button]');
if (!btn) {
return false;
}
btn.addEventListener('click', () => {
const title = select('.js-issue-title').textContent;
const number = select('.gh-header-number').textContent;
select<HTMLTextAreaElement>('#merge_title_field').value = `${title.trim()} (${number})`;
});
}
features.add({
id: 'fix-squash-and-merge-title',
include: [
features.isPR
],
load: features.onAjaxedPages,
init
});
| Fix features around the PR merge button /2 | Fix features around the PR merge button /2
| TypeScript | mit | sindresorhus/refined-github,sindresorhus/refined-github,busches/refined-github,busches/refined-github | ---
+++
@@ -2,7 +2,7 @@
import features from '../libs/features';
function init() {
- const btn = select('.merge-message .btn-group-squash [type=submit]');
+ const btn = select('.merge-message .btn-group-squash [type=button]');
if (!btn) {
return false;
} |
b9829108e291f513eb2ed27f5ce98fafb7a2cf77 | src/app/board/board.service.ts | src/app/board/board.service.ts | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {
ApiResponse,
User,
Board
} from '../shared/index';
@Injectable()
export class BoardService {
constructor(private http: Http) {
}
getBoards(): Observable<ApiResponse> {
return this.http.get('api/boards')
.map(res => {
let response: ApiResponse = res.json();
return response;
})
.catch((res, caught) => {
let response: ApiResponse = res.json();
return Observable.of(response);
});
}
}
| import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {
ApiResponse,
User,
Board
} from '../shared/index';
@Injectable()
export class BoardService {
constructor(private http: Http) {
}
getBoards(): Observable<ApiResponse> {
return this.http.get('api/boards')
.map(res => {
let response: ApiResponse = res.json();
return response;
})
.catch((res, caught) => {
let response: ApiResponse = res.json();
return Observable.of(response);
});
}
refreshToken(): void {
this.http.post('api/refresh', {}).subscribe();
}
}
| Add method to refresh token | Add method to refresh token
| TypeScript | mit | kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard | ---
+++
@@ -28,5 +28,9 @@
return Observable.of(response);
});
}
+
+ refreshToken(): void {
+ this.http.post('api/refresh', {}).subscribe();
+ }
}
|
ac7b352d46bbc09f99e0905c7ccbdb55c364891f | src/patchYarn.ts | src/patchYarn.ts | import { red, yellow } from "chalk"
import { existsSync } from "fs"
import { join } from "./path"
import { applyPatch } from "./applyPatches"
import { bold, green } from "chalk"
const yarnPatchFile = join(__dirname, "../yarn.patch")
export default function patchYarn(appPath: string) {
try {
applyPatch(yarnPatchFile)
const yarnVersion = require(join(
appPath,
"node_modules",
"yarn",
"package.json",
)).version
console.log(`${bold("yarn")}@${yarnVersion} ${green("✔")}`)
} catch (e) {
if (existsSync(join(appPath, "node_modules", "yarn"))) {
printIncompatibleYarnError()
} else {
printNoYarnWarning()
}
}
}
function printIncompatibleYarnError() {
console.error(`
${red.bold("***ERROR***")}
${red(`This version of patch-package in incompatible with your current local
version of yarn. Please update both.`)}
`)
}
function printNoYarnWarning() {
console.warn(`
${yellow.bold("***Warning***")}
You asked patch-package to patch yarn, but you don't seem to have yarn installed
`)
}
| import { red, yellow } from "chalk"
import { existsSync } from "fs"
import { join } from "./path"
import { applyPatch } from "./applyPatches"
import { bold, green } from "chalk"
const yarnPatchFile = join(__dirname, "../yarn.patch")
export default function patchYarn(appPath: string) {
try {
applyPatch(yarnPatchFile)
const yarnVersion = require(join(
appPath,
"node_modules",
"yarn",
"package.json",
)).version
console.log(`${bold("yarn")}@${yarnVersion} ${green("✔")}`)
} catch (e) {
if (existsSync(join(appPath, "node_modules", "yarn"))) {
printIncompatibleYarnError()
} else {
printNoYarnWarning()
}
}
}
function printIncompatibleYarnError() {
console.error(`
${red.bold("***ERROR***")}
${red(`This version of patch-package is incompatible with your current local
version of yarn. Please update both.`)}
`)
}
function printNoYarnWarning() {
console.warn(`
${yellow.bold("***Warning***")}
You asked patch-package to patch yarn, but you don't seem to have yarn installed
`)
}
| Fix typo in printIncompatibleYarnError function | Fix typo in printIncompatibleYarnError function | TypeScript | mit | ds300/patch-package,ds300/patch-package,ds300/patch-package | ---
+++
@@ -28,7 +28,7 @@
function printIncompatibleYarnError() {
console.error(`
${red.bold("***ERROR***")}
-${red(`This version of patch-package in incompatible with your current local
+${red(`This version of patch-package is incompatible with your current local
version of yarn. Please update both.`)}
`)
} |
9e90ab47a7b80b68a7c618fddcb5ecf6fd80b2e0 | src/create_assignment/index.ts | src/create_assignment/index.ts | import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import {
INotebookTracker
} from '@jupyterlab/notebook';
import {
BoxPanel
} from '@lumino/widgets';
import {
CreateAssignmentWidget
} from './create_assignment_extension';
/**
* Initialization data for the create_assignment extension.
*/
export const create_assignment_extension: JupyterFrontEndPlugin<void> = {
id: 'create-assignment',
autoStart: true,
requires: [INotebookTracker],
activate: activate_extension
};
function activate_extension(app: JupyterFrontEnd, tracker: INotebookTracker) {
console.log('Activating extension "create_assignment".');
const panel = new BoxPanel();
const createAssignmentWidget = new CreateAssignmentWidget(tracker);
panel.addWidget(createAssignmentWidget);
panel.id = 'nbgrader-create_assignemnt';
panel.title.label = 'Create Assignment';
panel.title.caption = 'nbgrader Create Assignment';
app.shell.add(panel, 'right');
console.log('Extension "create_assignment" activated.');
}
export default create_assignment_extension;
| import {
JupyterFrontEnd,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import {
INotebookTracker
} from '@jupyterlab/notebook';
import {
Panel, PanelLayout
} from '@lumino/widgets';
import {
CreateAssignmentWidget
} from './create_assignment_extension';
/**
* Initialization data for the create_assignment extension.
*/
export const create_assignment_extension: JupyterFrontEndPlugin<void> = {
id: 'create-assignment',
autoStart: true,
requires: [INotebookTracker],
activate: activate_extension
};
function activate_extension(app: JupyterFrontEnd, tracker: INotebookTracker) {
console.log('Activating extension "create_assignment".');
const panel = new Panel({layout: new PanelLayout({fitPolicy: 'set-min-size'})});
const createAssignmentWidget = new CreateAssignmentWidget(tracker);
panel.addWidget(createAssignmentWidget);
panel.id = 'nbgrader-create_assignemnt';
panel.title.label = 'Create Assignment';
panel.title.caption = 'nbgrader Create Assignment';
app.shell.add(panel, 'right');
console.log('Extension "create_assignment" activated.');
}
export default create_assignment_extension;
| Change create assignment panel from 'BoxPanel' to 'Panel'. Using BoxPanel the min size was changed to 0px, and the panel does not seem to open | Change create assignment panel from 'BoxPanel' to 'Panel'. Using BoxPanel the min size was changed to 0px, and the panel does not seem to open
| TypeScript | bsd-3-clause | jupyter/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader | ---
+++
@@ -8,7 +8,7 @@
} from '@jupyterlab/notebook';
import {
- BoxPanel
+ Panel, PanelLayout
} from '@lumino/widgets';
import {
@@ -27,7 +27,7 @@
function activate_extension(app: JupyterFrontEnd, tracker: INotebookTracker) {
console.log('Activating extension "create_assignment".');
- const panel = new BoxPanel();
+ const panel = new Panel({layout: new PanelLayout({fitPolicy: 'set-min-size'})});
const createAssignmentWidget = new CreateAssignmentWidget(tracker);
panel.addWidget(createAssignmentWidget);
panel.id = 'nbgrader-create_assignemnt'; |
185c64a4784fc720cc3864f522f11329ba28d353 | src/app.component.ts | src/app.component.ts | import '../shims.js';
import { Component } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import { RESOURCE_PROVIDERS } from 'ng2-resource-rest';
import { CollectionsComponent } from './collections.component.ts';
@Component({
selector: 'qi-app',
template: '<qi-collections></qi-collections>',
directives: [CollectionsComponent]
})
class AppComponent { }
bootstrap(AppComponent, [HTTP_PROVIDERS, RESOURCE_PROVIDERS]);
| import '../shims.js';
import { Component } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { HTTP_PROVIDERS } from '@angular/http';
import { RESOURCE_PROVIDERS } from 'ng2-resource-rest';
import { CollectionsComponent } from './collections/collections.component.ts';
@Component({
selector: 'qi-app',
template: '<qi-collections></qi-collections>',
directives: [CollectionsComponent]
})
class AppComponent { }
bootstrap(AppComponent, [HTTP_PROVIDERS, RESOURCE_PROVIDERS]);
| Move collection* to collections subdirectory. | Move collection* to collections subdirectory.
| TypeScript | bsd-2-clause | ohsu-qin/qiprofile,ohsu-qin/qiprofile,ohsu-qin/qiprofile,ohsu-qin/qiprofile | ---
+++
@@ -4,7 +4,7 @@
import { HTTP_PROVIDERS } from '@angular/http';
import { RESOURCE_PROVIDERS } from 'ng2-resource-rest';
-import { CollectionsComponent } from './collections.component.ts';
+import { CollectionsComponent } from './collections/collections.component.ts';
@Component({
selector: 'qi-app', |
9dc3a4759ab9fc5003e74e570ef299afefc78045 | app/app.component.ts | app/app.component.ts | import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template:`
<h1>{{title}}</h1>
<h2>{{hero.name}} details!</h2>
<div><label>id: </label>{{hero.id}}</div>
<div><label>name: </label>{{hero.name}}</div>
})
export class AppComponent {
title = 'Tour of Heroes';
hero: Hero = {
id: 10000,
name: 'Windstorm'
};
}
export class Hero {
id: number;
name: string;
} | import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template:
<h1>{{title}}</h1>
<h2>{{hero.name}} details!</h2>
<div><label>id: </label>{{hero.id}}</div>
<div><label>name: </label>{{hero.name}}</div>
})
export class AppComponent {
title = 'Tour of Heroes';
hero: Hero = {
id: 10000,
name: 'Windstorm'
};
}
export class Hero {
id: number;
name: string;
} | Change template to multi-line. Should not change UI | Change template to multi-line. Should not change UI
| TypeScript | mit | atbtm/Angular2-Pull-Repo,atbtm/Angular2-Pull-Repo,atbtm/Angular2-Pull-Repo | ---
+++
@@ -2,7 +2,7 @@
@Component({
selector: 'my-app',
- template:`
+ template:
<h1>{{title}}</h1>
<h2>{{hero.name}} details!</h2>
<div><label>id: </label>{{hero.id}}</div> |
916c78f4ecf952c70bcb6b3658ea40c967f0fae7 | src/tests/index.ts | src/tests/index.ts | //
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
//
// This file is providing the test runner to use when running extension tests.
// By default the test runner in use is Mocha based.
//
// You can provide your own test runner if you want to override it by exporting
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.
var testRunner = require('vscode/lib/testrunner');
// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
});
module.exports = testRunner; | //
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
//
// This file is providing the test runner to use when running extension tests.
// By default the test runner in use is Mocha based.
//
// You can provide your own test runner if you want to override it by exporting
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.
import testRunner = require("vscode/lib/testrunner");
// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
});
module.exports = testRunner; | Rework the tests according to tslint | Rework the tests according to tslint
| TypeScript | mit | manuth/MarkdownConverter,manuth/MarkdownConverter,manuth/MarkdownConverter | ---
+++
@@ -9,13 +9,12 @@
// host can call to run the tests. The test runner is expected to use console.log
// to report the results back to the caller. When the tests are finished, return
// a possible error to the callback or null if none.
-
-var testRunner = require('vscode/lib/testrunner');
+import testRunner = require("vscode/lib/testrunner");
// You can directly control Mocha options by uncommenting the following lines
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
testRunner.configure({
- ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
+ ui: "tdd", // the TDD UI is being used in extension.test.ts (suite, test, etc.)
useColors: true // colored output from test results
});
|
4649eeae3f226d50256345fb95eb0b96cf12a0de | app/services/weather.service.ts | app/services/weather.service.ts | import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Jsonp, URLSearchParams } from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class WeatherService {
constructor(private http: Http) {
console.log('WeatherService init');
}
getWeather(base: string) {
}
}
| import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Jsonp, URLSearchParams } from '@angular/http';
import 'rxjs/add/operator/map';
const basePath = 'http://api.openweathermap.org/data/2.5';
const appid = 'b9ec610b4f86466f14269dac1d6aa0ec';
const queryTypes = ['weather', 'forecast'];
@Injectable()
export class WeatherService {
constructor(private http: Http) {
console.log('WeatherService init');
}
_getWeather(queryType: string, location: string) {
if (!~queryTypes.indexOf(queryType) || !location) {
return null;
}
let params = new URLSearchParams();
params.set('q', location);
params.set('appid', appid);
return this.http.get(`${basePath}/${queryType}`, {
search: params
}).map(res => res.json());
}
getCurent(location: string) {
return this._getWeather('weather', location);
}
getForecast(location: string) {
return this._getWeather('forecast', location);
}
}
| Update weatherService to actually make calls to server | Update weatherService to actually make calls to server
| TypeScript | mit | satbirjhuti/ng2Widgets,satbirjhuti/ng2Widgets,satbirjhuti/ng2Widgets | ---
+++
@@ -2,6 +2,10 @@
import { Http } from '@angular/http';
import { Jsonp, URLSearchParams } from '@angular/http';
import 'rxjs/add/operator/map';
+
+const basePath = 'http://api.openweathermap.org/data/2.5';
+const appid = 'b9ec610b4f86466f14269dac1d6aa0ec';
+const queryTypes = ['weather', 'forecast'];
@Injectable()
@@ -10,7 +14,23 @@
console.log('WeatherService init');
}
- getWeather(base: string) {
+ _getWeather(queryType: string, location: string) {
+ if (!~queryTypes.indexOf(queryType) || !location) {
+ return null;
+ }
+ let params = new URLSearchParams();
+ params.set('q', location);
+ params.set('appid', appid);
+ return this.http.get(`${basePath}/${queryType}`, {
+ search: params
+ }).map(res => res.json());
+ }
+ getCurent(location: string) {
+ return this._getWeather('weather', location);
+ }
+
+ getForecast(location: string) {
+ return this._getWeather('forecast', location);
}
} |
8e942a1bce43d813d80e2e7cc4c4134ce37688f0 | src/mavensmate/command.ts | src/mavensmate/command.ts | interface Command {
command: string,
async: boolean,
currentTextDocument?: boolean,
body?: {
paths?: string[]
args: {
ui: boolean
}
}
}
export default Command; | interface Command {
command: string,
async: boolean,
currentTextDocument?: boolean,
body?: {
paths?: string[]
args?: {
ui: boolean
}
}
}
export default Command; | Allow there to be no args on Command Body | Allow there to be no args on Command Body
Just allows more flexible test data
| TypeScript | mit | joeferraro/MavensMate-VisualStudioCode | ---
+++
@@ -4,7 +4,7 @@
currentTextDocument?: boolean,
body?: {
paths?: string[]
- args: {
+ args?: {
ui: boolean
}
} |
920d4eaa1d32123be3fb5d058cfd9b38c6ca6187 | types/react-virtualized.d.tsx | types/react-virtualized.d.tsx | /**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
declare module 'react-virtualized' {
const AutoSizer: any;
const Collection: any;
}
| /**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
declare module 'react-virtualized' {
const AutoSizer: any;
const Collection: any;
const CellMeasurerCache: any;
const CellMeasurer: any;
const List: any;
}
| Migrate Mobile Config plugin to tsx | Migrate Mobile Config plugin to tsx
Summary: This diff migrates the Mobile config plugin to typescript. In the later diffs, I will refactor the logic of the plugin to use persisted state as it can then be used to export the data, which is required for the litho support form.
Reviewed By: jknoxville
Differential Revision: D17628276
fbshipit-source-id: b48d4fb346b582408774ef08ffbead23adc7aaac
| TypeScript | mit | facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper | ---
+++
@@ -8,4 +8,7 @@
declare module 'react-virtualized' {
const AutoSizer: any;
const Collection: any;
+ const CellMeasurerCache: any;
+ const CellMeasurer: any;
+ const List: any;
} |
4a2c7dacfe2d8c1cec0e30bfcb6cba980f2fcdb7 | test/routes/companyRouterTest.ts | test/routes/companyRouterTest.ts | import * as CompanyRouter from "../../src/routes/companyRouter";
import * as express from "express";
import * as Chai from "chai";
/**
* This is the test for CompanyRouter class
*
* @history
* | Author | Action Performed | Data |
* | --- | --- | --- |
* | Davide Rigoni | Create class | 03/05/2016 |
*
* @author Davide Rigoni
* @copyright MIT
*
* Created by Davide Rigoni on 03/05/16.
*/
describe("DatabaseRouter", () => {
/* nothing to test for now
let toTest : DatabaseRouter;
let dummyExpress : express.Express = express();
beforeEach(function () : void {
toTest = new DatabaseRouter(dummyExpress);
});
describe("#nameOfWhatYouAreTesting", () => {
it ("should <say what it should do>", () => {
// Your code here
});
});
*/
});
| import {CompanyRouter} from "../../src/routes/companyRouter";
import * as express from "express";
import * as Chai from "chai";
import * as superAgent from "superagent";
/**
* This is the test for CompanyRouter class
*
* @history
* | Author | Action Performed | Data |
* | --- | --- | --- |
* | Davide Rigoni | Create class | 03/05/2016 |
*
* @author Davide Rigoni
* @copyright MIT
*
* Created by Davide Rigoni on 03/05/16.
*/
describe("CompanyRouterTest", () => {
/* nothing to test for now
let toTest : DatabaseRouter;
let dummyExpress : express.Express = express();
beforeEach(function () : void {
toTest = new DatabaseRouter(dummyExpress);
});
describe("#nameOfWhatYouAreTesting", () => {
it ("should <say what it should do>", () => {
// Your code here
});
});
*/
/*let toTest : CompanyRouter;
let routerToTest : express.Router;
before( function () : void {
toTest = new CompanyRouter();
routerToTest = toTest.getRouter();
});
describe("#createCompany", () => {
it("should create a company", () => {
// I don't know the JSON to send
let companyToCreate : Object = {
company: "CompanyTest",
_id: "" // Need the user id of the owner
}
superAgent
// But is this correct?
.post("/api/admin/companies")
.send(companyToCreate)
.set("Content-Type', 'application/json")
.end(function (err : Object, res : superAgent.Response) {
Chai.expect(err).to.not.undefined;
});
});
});*/
});
| Write a draft for createCompany test | Write a draft for createCompany test
Waiting @WeissL for a reply about API
| TypeScript | mit | BugBusterSWE/MaaS,BugBusterSWE/MaaS,BugBusterSWE/MaaS,BugBusterSWE/MaaS | ---
+++
@@ -1,6 +1,7 @@
-import * as CompanyRouter from "../../src/routes/companyRouter";
+import {CompanyRouter} from "../../src/routes/companyRouter";
import * as express from "express";
import * as Chai from "chai";
+import * as superAgent from "superagent";
/**
* This is the test for CompanyRouter class
@@ -15,7 +16,7 @@
*
* Created by Davide Rigoni on 03/05/16.
*/
-describe("DatabaseRouter", () => {
+describe("CompanyRouterTest", () => {
/* nothing to test for now
let toTest : DatabaseRouter;
@@ -29,5 +30,35 @@
});
});
*/
+
+ /*let toTest : CompanyRouter;
+ let routerToTest : express.Router;
+
+ before( function () : void {
+
+ toTest = new CompanyRouter();
+ routerToTest = toTest.getRouter();
+ });
+
+ describe("#createCompany", () => {
+ it("should create a company", () => {
+
+ // I don't know the JSON to send
+ let companyToCreate : Object = {
+
+ company: "CompanyTest",
+ _id: "" // Need the user id of the owner
+ }
+
+ superAgent
+ // But is this correct?
+ .post("/api/admin/companies")
+ .send(companyToCreate)
+ .set("Content-Type', 'application/json")
+ .end(function (err : Object, res : superAgent.Response) {
+ Chai.expect(err).to.not.undefined;
+ });
+ });
+ });*/
});
|
015d9dec91ecb7a17e4e79407d187aac8a19206d | server/lib/peertube-socket.ts | server/lib/peertube-socket.ts | import * as SocketIO from 'socket.io'
import { authenticateSocket } from '../middlewares'
import { UserNotificationModel } from '../models/account/user-notification'
import { logger } from '../helpers/logger'
import { Server } from 'http'
class PeerTubeSocket {
private static instance: PeerTubeSocket
private userNotificationSockets: { [ userId: number ]: SocketIO.Socket } = {}
private constructor () {}
init (server: Server) {
const io = SocketIO(server)
io.of('/user-notifications')
.use(authenticateSocket)
.on('connection', socket => {
const userId = socket.handshake.query.user.id
logger.debug('User %d connected on the notification system.', userId)
this.userNotificationSockets[userId] = socket
socket.on('disconnect', () => {
logger.debug('User %d disconnected from SocketIO notifications.', userId)
delete this.userNotificationSockets[userId]
})
})
}
sendNotification (userId: number, notification: UserNotificationModel) {
const socket = this.userNotificationSockets[userId]
if (!socket) return
socket.emit('new-notification', notification.toFormattedJSON())
}
static get Instance () {
return this.instance || (this.instance = new this())
}
}
// ---------------------------------------------------------------------------
export {
PeerTubeSocket
}
| import * as SocketIO from 'socket.io'
import { authenticateSocket } from '../middlewares'
import { UserNotificationModel } from '../models/account/user-notification'
import { logger } from '../helpers/logger'
import { Server } from 'http'
class PeerTubeSocket {
private static instance: PeerTubeSocket
private userNotificationSockets: { [ userId: number ]: SocketIO.Socket[] } = {}
private constructor () {}
init (server: Server) {
const io = SocketIO(server)
io.of('/user-notifications')
.use(authenticateSocket)
.on('connection', socket => {
const userId = socket.handshake.query.user.id
logger.debug('User %d connected on the notification system.', userId)
if (!this.userNotificationSockets[userId]) this.userNotificationSockets[userId] = []
this.userNotificationSockets[userId].push(socket)
socket.on('disconnect', () => {
logger.debug('User %d disconnected from SocketIO notifications.', userId)
this.userNotificationSockets[userId] = this.userNotificationSockets[userId].filter(s => s !== socket)
})
})
}
sendNotification (userId: number, notification: UserNotificationModel) {
const sockets = this.userNotificationSockets[userId]
if (!sockets) return
for (const socket of sockets) {
socket.emit('new-notification', notification.toFormattedJSON())
}
}
static get Instance () {
return this.instance || (this.instance = new this())
}
}
// ---------------------------------------------------------------------------
export {
PeerTubeSocket
}
| Fix socket notification with multiple user tabs | Fix socket notification with multiple user tabs
| TypeScript | agpl-3.0 | Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube | ---
+++
@@ -8,7 +8,7 @@
private static instance: PeerTubeSocket
- private userNotificationSockets: { [ userId: number ]: SocketIO.Socket } = {}
+ private userNotificationSockets: { [ userId: number ]: SocketIO.Socket[] } = {}
private constructor () {}
@@ -22,22 +22,26 @@
logger.debug('User %d connected on the notification system.', userId)
- this.userNotificationSockets[userId] = socket
+ if (!this.userNotificationSockets[userId]) this.userNotificationSockets[userId] = []
+
+ this.userNotificationSockets[userId].push(socket)
socket.on('disconnect', () => {
logger.debug('User %d disconnected from SocketIO notifications.', userId)
- delete this.userNotificationSockets[userId]
+ this.userNotificationSockets[userId] = this.userNotificationSockets[userId].filter(s => s !== socket)
})
})
}
sendNotification (userId: number, notification: UserNotificationModel) {
- const socket = this.userNotificationSockets[userId]
+ const sockets = this.userNotificationSockets[userId]
- if (!socket) return
+ if (!sockets) return
- socket.emit('new-notification', notification.toFormattedJSON())
+ for (const socket of sockets) {
+ socket.emit('new-notification', notification.toFormattedJSON())
+ }
}
static get Instance () { |
f8df91eee7bebb3aa29a7fe32840512cef3e56e4 | crawler/src/clases/HttpRequest.ts | crawler/src/clases/HttpRequest.ts | import { IncomingHttpHeaders } from 'http'
import { Url } from 'url'
import * as request from 'request'
type Request = request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>
/**
* Pattern: <<~Singleton>>
*/
export class HttpRequest {
private static headers = {
'user-agent': 'TFG-DAVID'
}
private static agentOptions = {
keepAlive: false // true
}
private static request: Request
public static getRequest (): Request {
if (!this.request) {
HttpRequest.request = request.defaults({
headers: this.headers,
agentOptions: this.agentOptions,
timeout: 30000
})
}
return this.request
}
}
// request .on('response') response argument is this instead of http.IncomingMessage
export interface CustomIncomingMessage {
headers: IncomingHttpHeaders
statusCode: number
request: {
uri: Url
method: string
headers: IncomingHttpHeaders
}
}
| import { IncomingHttpHeaders } from 'http'
import { Url } from 'url'
import * as request from 'request'
type Request = request.RequestAPI<request.Request, request.CoreOptions, request.RequiredUriUrl>
/**
* Pattern: <<~Singleton>>
*/
export class HttpRequest {
private static headers = {
'user-agent': 'TFG-DAVID'
}
private static agentOptions = {
keepAlive: false // true
}
private static request: Request
public static getRequest (): Request {
if (!this.request) {
HttpRequest.request = request.defaults({
headers: this.headers,
agentOptions: this.agentOptions,
timeout: 30000
})
}
return this.request
}
public static async get (url: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
HttpRequest.getRequest()(url, function (error, response, body) {
if (error) {
reject(error)
} else if (response && response.statusCode !== 200) {
reject(response)
} else {
resolve(body)
}
})
})
}
}
// request .on('response') response argument is this instead of http.IncomingMessage
export interface CustomIncomingMessage {
headers: IncomingHttpHeaders
statusCode: number
request: {
uri: Url
method: string
headers: IncomingHttpHeaders
}
}
| Add simple promise request get method | Add simple promise request get method
| TypeScript | mit | davidglezz/tfg,davidglezz/tfg,davidglezz/tfg,davidglezz/tfg | ---
+++
@@ -30,6 +30,20 @@
return this.request
}
+
+ public static async get (url: string): Promise<string> {
+ return new Promise<string>((resolve, reject) => {
+ HttpRequest.getRequest()(url, function (error, response, body) {
+ if (error) {
+ reject(error)
+ } else if (response && response.statusCode !== 200) {
+ reject(response)
+ } else {
+ resolve(body)
+ }
+ })
+ })
+ }
}
// request .on('response') response argument is this instead of http.IncomingMessage |
0d884a6cfefe27720c0c4f5e5692cab8442f323c | src/index.tsx | src/index.tsx | import { createRoot } from "react-dom/client";
import App from "./App";
if (process.env.NODE_ENV === "production") {
if (window.location.host === "www.npcgenerator.com") {
console.log("you are accessing us via www. Redirecting you to non-www.");
window.location.href = window.location.href.replace("www.", "");
}
// if (window.location.protocol === "http:") {
// console.log("you are accessing us via an insecure protocol (HTTP). Redirecting you to HTTPS.");
// window.location.href = window.location.href.replace("http:", "https:");
// }
}
createRoot(document.getElementById("root")!).render(<App />);
| import { createRoot } from "react-dom/client";
import App from "./App";
createRoot(document.getElementById("root")!).render(<App />);
| Revert "Javascript redirect of www.npcgenerator.com to npcgenerator.com" | Revert "Javascript redirect of www.npcgenerator.com to npcgenerator.com"
This reverts commit ed519b129e223d8ab1c58face022dbfa0868d995.
| TypeScript | mit | Cellule/dndGenerator,Cellule/dndGenerator,Cellule/dndGenerator | ---
+++
@@ -1,15 +1,4 @@
import { createRoot } from "react-dom/client";
import App from "./App";
-if (process.env.NODE_ENV === "production") {
- if (window.location.host === "www.npcgenerator.com") {
- console.log("you are accessing us via www. Redirecting you to non-www.");
- window.location.href = window.location.href.replace("www.", "");
- }
- // if (window.location.protocol === "http:") {
- // console.log("you are accessing us via an insecure protocol (HTTP). Redirecting you to HTTPS.");
- // window.location.href = window.location.href.replace("http:", "https:");
- // }
-}
-
createRoot(document.getElementById("root")!).render(<App />); |
5acc7f87ec193c471ba2edb6d185745ea32198f2 | src/marketplace-checklist/StatsTable.tsx | src/marketplace-checklist/StatsTable.tsx | import * as React from 'react';
import * as Table from 'react-bootstrap/lib/Table';
import { translate } from '@waldur/i18n';
export const StatsTable = props => (
<Table
responsive={true}
bordered={true}
striped={true}
className="m-t-md"
>
<thead>
<tr>
<th className="col-sm-1">#</th>
<th>{translate('Organization')}</th>
<th>{translate('Score')}</th>
</tr>
</thead>
<tbody>
{props.stats.map((customer, index) => (
<tr key={customer.uuid}>
<td>
{index + 1}
</td>
<td>
{customer.name}
</td>
<td>
{customer.score}
</td>
</tr>
))}
</tbody>
</Table>
);
| import * as React from 'react';
import * as Table from 'react-bootstrap/lib/Table';
import { StateIndicator } from '@waldur/core/StateIndicator';
import { translate } from '@waldur/i18n';
export const StatsTable = props => (
<Table
responsive={true}
bordered={true}
striped={true}
className="m-t-md"
>
<thead>
<tr>
<th className="col-sm-1">#</th>
<th>{translate('Organization')}</th>
<th>{translate('Score')}</th>
</tr>
</thead>
<tbody>
{props.stats.map((customer, index) => (
<tr key={customer.uuid}>
<td>
{index + 1}
</td>
<td>
{customer.name}
</td>
<td>
<StateIndicator
label={`${customer.score} %`}
variant={customer.score < 25 ? 'danger' : customer.score < 75 ? 'warning' : 'primary'}
/>
</td>
</tr>
))}
</tbody>
</Table>
);
| Add color coding for scoring | Add color coding for scoring [WAL-2789]
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | ---
+++
@@ -1,6 +1,7 @@
import * as React from 'react';
import * as Table from 'react-bootstrap/lib/Table';
+import { StateIndicator } from '@waldur/core/StateIndicator';
import { translate } from '@waldur/i18n';
export const StatsTable = props => (
@@ -27,7 +28,10 @@
{customer.name}
</td>
<td>
- {customer.score}
+ <StateIndicator
+ label={`${customer.score} %`}
+ variant={customer.score < 25 ? 'danger' : customer.score < 75 ? 'warning' : 'primary'}
+ />
</td>
</tr>
))} |
3b16176de512188143466582d78e56a1d2c30e4f | resources/assets/lib/interfaces/beatmapset-extended-json.ts | resources/assets/lib/interfaces/beatmapset-extended-json.ts | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
import BeatmapsetJson from './beatmapset-json';
interface Availability {
download_disabled: boolean;
more_information: string | null;
}
interface NominationsSummary {
current: number;
required: number;
}
interface BeatmapsetExtendedJsonAdditionalAttributes {
availability: Availability;
bpm: number;
can_be_hyped: boolean;
discussion_enabled: boolean;
discussion_locked: boolean;
is_scoreable: boolean;
last_updated: string;
legacy_thread_url: string;
nominations_summary: NominationsSummary;
ranked: number;
ranked_date: string | null;
storyboard: boolean;
submitted_date: string | null;
tags: string;
}
type BeatmapsetExtendedJson = BeatmapsetJson & BeatmapsetExtendedJsonAdditionalAttributes;
export default BeatmapsetExtendedJson;
export type BeatmapsetJsonForShow = BeatmapsetExtendedJson & Required<Pick<BeatmapsetExtendedJson,
| 'beatmaps' // TODO: also mark failtimes and max_combo as included
| 'converts' // TODO: also mark failtimes as included
| 'current_user_attributes'
| 'description'
| 'genre'
| 'language'
| 'ratings'
| 'recent_favourites'
| 'user'
>>;
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
import BeatmapsetJson from './beatmapset-json';
interface Availability {
download_disabled: boolean;
more_information: string | null;
}
interface NominationsSummary {
current: number;
required: number;
}
interface BeatmapsetExtendedJsonAdditionalAttributes {
availability: Availability;
bpm: number;
can_be_hyped: boolean;
discussion_enabled: boolean;
discussion_locked: boolean;
is_scoreable: boolean;
last_updated: string;
legacy_thread_url: string | null;
nominations_summary: NominationsSummary;
ranked: number;
ranked_date: string | null;
storyboard: boolean;
submitted_date: string | null;
tags: string;
}
type BeatmapsetExtendedJson = BeatmapsetJson & BeatmapsetExtendedJsonAdditionalAttributes;
export default BeatmapsetExtendedJson;
export type BeatmapsetJsonForShow = BeatmapsetExtendedJson & Required<Pick<BeatmapsetExtendedJson,
| 'beatmaps' // TODO: also mark failtimes and max_combo as included
| 'converts' // TODO: also mark failtimes as included
| 'current_user_attributes'
| 'description'
| 'genre'
| 'language'
| 'ratings'
| 'recent_favourites'
| 'user'
>>;
| Fix typing for beatmapset extended json | Fix typing for beatmapset extended json
| TypeScript | agpl-3.0 | nanaya/osu-web,nanaya/osu-web,nanaya/osu-web,LiquidPL/osu-web,notbakaneko/osu-web,ppy/osu-web,LiquidPL/osu-web,LiquidPL/osu-web,ppy/osu-web,ppy/osu-web,LiquidPL/osu-web,notbakaneko/osu-web,LiquidPL/osu-web,nanaya/osu-web,notbakaneko/osu-web,ppy/osu-web,ppy/osu-web,nanaya/osu-web,notbakaneko/osu-web,notbakaneko/osu-web | ---
+++
@@ -21,7 +21,7 @@
discussion_locked: boolean;
is_scoreable: boolean;
last_updated: string;
- legacy_thread_url: string;
+ legacy_thread_url: string | null;
nominations_summary: NominationsSummary;
ranked: number;
ranked_date: string | null; |
416b4576513cc3f53d06573b78c49a183a762e61 | server/entities/phone-number.ts | server/entities/phone-number.ts | import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, BaseEntity } from 'typeorm';
import Household from './household';
import encOptions from '../common/util/encryption-options';
import { ExtendedColumnOptions } from "typeorm-encrypted";
@Entity('household_phones')
export default class PhoneNumber extends BaseEntity {
private constructor(props) {
super();
Object.assign(this, props);
}
@PrimaryGeneratedColumn()
id: number
@Column('int', {name: 'household_id'})
householdId: number
@Column('text')
type: string
@Column('varchar', <ExtendedColumnOptions> encOptions)
number: string
@ManyToOne(() => Household)
@JoinColumn({ name: "household_id" })
household: Household
static fromJSON(props) {
const entity = new PhoneNumber(props);
return entity;
}
} | import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, BaseEntity } from 'typeorm';
import Household from './household';
import encOptions from '../common/util/encryption-options';
import { ExtendedColumnOptions } from "typeorm-encrypted";
@Entity('household_phones')
export default class PhoneNumber extends BaseEntity {
private constructor(props) {
super();
Object.assign(this, props);
}
@PrimaryGeneratedColumn()
id: number
@Column('int', {name: 'household_id'})
householdId: number
@Column('text')
type: string
@Column('varchar', <ExtendedColumnOptions> encOptions)
number: string
@ManyToOne(() => Household)
@JoinColumn({ name: "household_id" })
household: Household
@Column('boolean')
deleted: boolean = false
static fromJSON(props) {
const entity = new PhoneNumber(props);
return entity;
}
} | Add deleted flag to phone number | Add deleted flag to phone number
| TypeScript | mit | CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/cmpd-holiday-gift-backend,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/CMPD-Holiday-Gift,CodeForCharlotte/cmpd-holiday-gift-backend | ---
+++
@@ -29,6 +29,9 @@
@JoinColumn({ name: "household_id" })
household: Household
+ @Column('boolean')
+ deleted: boolean = false
+
static fromJSON(props) {
const entity = new PhoneNumber(props);
|
fe8a450b9d182b9934cb627dbfc3319261ccbb81 | src/app/core/pipes/time.pipe.ts | src/app/core/pipes/time.pipe.ts | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'timeElapsed'})
export class TimeElapsedPipe implements PipeTransform {
transform(secs: number): string {
let min = Math.floor(secs / 60);
let sec = secs % 60;
return `${min}min ${sec}sec`;
}
} | import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'timeSpent'})
export class TimeElapsedPipe implements PipeTransform {
transform(secs: number): string {
if(secs >= 0) {
let min = Math.floor(secs / 60);
let sec = secs % 60;
return `${min}min ${sec}sec`;
} else {
let min = Math.floor(-secs / 60);
let sec = -secs % 60;
return `-${min}min ${sec}sec`;
}
}
} | Refactor to handle negative values (when the counter is set to do a countdown). Applied red color to the text when the time expires | Refactor to handle negative values (when the counter is set to do a countdown). Applied red color to the text when the time expires
| TypeScript | mit | semagarcia/javascript-kata-player,semagarcia/javascript-kata-player,semagarcia/javascript-kata-player | ---
+++
@@ -1,10 +1,16 @@
import { Pipe, PipeTransform } from '@angular/core';
-@Pipe({name: 'timeElapsed'})
+@Pipe({name: 'timeSpent'})
export class TimeElapsedPipe implements PipeTransform {
transform(secs: number): string {
- let min = Math.floor(secs / 60);
- let sec = secs % 60;
- return `${min}min ${sec}sec`;
+ if(secs >= 0) {
+ let min = Math.floor(secs / 60);
+ let sec = secs % 60;
+ return `${min}min ${sec}sec`;
+ } else {
+ let min = Math.floor(-secs / 60);
+ let sec = -secs % 60;
+ return `-${min}min ${sec}sec`;
+ }
}
} |
47a99cbd62305614bbccbe5a97e15d5f687522cc | src/components/boolean-radio.tsx | src/components/boolean-radio.tsx | import i18next from "i18next";
import React from "react";
import {RadioButton, RadioGroup} from "react-toolbox/lib/radio";
import {themr} from "../theme";
import * as styles from "./__style__/boolean-radio.css";
export type BooleanRadioStyle = Partial<typeof styles>;
const Theme = themr("booleanRadio", styles);
export interface BooleanRadioProps {
/** Disabled radio-select, default to: false */
disabled?: boolean;
/** Error message to display. */
error?: string;
/** Name for input field. */
name: string;
/** Call with each value change. */
onChange: (value: boolean) => void;
/** CSS. */
theme?: BooleanRadioStyle;
/** Value. */
value?: boolean;
}
export function BooleanRadio({disabled, error, name, onChange, theme: pTheme, value}: BooleanRadioProps) {
return (
<Theme theme={pTheme}>
{theme => (
<>
<RadioGroup
name={name}
value={value === true ? "true" : value === false ? "false" : undefined}
onChange={(x: string) => onChange(x === "true")}
>
<RadioButton label={i18next.t("focus.boolean.yes")} value={"true"} disabled={disabled} />
<RadioButton label={i18next.t("focus.boolean.no")} value={"false"} disabled={disabled} />
</RadioGroup>
{error ? <div>{error}</div> : null}
</>
)}
</Theme>
);
}
| import i18next from "i18next";
import React from "react";
import {RadioButton, RadioGroup} from "react-toolbox/lib/radio";
import {themr} from "../theme";
import * as styles from "./__style__/boolean-radio.css";
export type BooleanRadioStyle = Partial<typeof styles>;
const Theme = themr("booleanRadio", styles);
export interface BooleanRadioProps {
/** Disabled radio-select, default to: false */
disabled?: boolean;
/** Error message to display. */
error?: string;
/** Name for input field. */
name: string;
/** Call with each value change. */
onChange: (value: boolean) => void;
/** CSS. */
theme?: BooleanRadioStyle;
/** Value. */
value?: boolean;
}
export function BooleanRadio({disabled, error, name, onChange, theme: pTheme, value}: BooleanRadioProps) {
return (
<Theme theme={pTheme}>
{theme => (
<>
<RadioGroup
name={name}
value={value === true ? "true" : value === false ? "false" : undefined}
onChange={(x: string) => onChange(x === "true")}
className={theme.radio}
>
<RadioButton label={i18next.t("focus.boolean.yes")} value={"true"} disabled={disabled} />
<RadioButton label={i18next.t("focus.boolean.no")} value={"false"} disabled={disabled} />
</RadioGroup>
{error ? <div>{error}</div> : null}
</>
)}
</Theme>
);
}
| Fix erreur dans la PR de @sebez | Fix erreur dans la PR de @sebez
| TypeScript | mit | get-focus/focus4,get-focus/focus4 | ---
+++
@@ -32,6 +32,7 @@
name={name}
value={value === true ? "true" : value === false ? "false" : undefined}
onChange={(x: string) => onChange(x === "true")}
+ className={theme.radio}
>
<RadioButton label={i18next.t("focus.boolean.yes")} value={"true"} disabled={disabled} />
<RadioButton label={i18next.t("focus.boolean.no")} value={"false"} disabled={disabled} /> |
c8a106f1e315151a77dce3e7e7b37e26f3ac3759 | lib/index.d.ts | lib/index.d.ts | import * as t from "./types";
export declare class Address {
readonly merge_sub_and_building: boolean;
readonly postcode_inward: string;
readonly postcode_outward: string;
readonly po_box: string;
readonly postcode: string;
readonly post_town: string;
readonly dependant_locality: string;
readonly double_dependant_locality: string;
readonly thoroughfare: string;
readonly dependant_thoroughfare: string;
readonly building_number: string;
readonly building_name: string;
readonly sub_building_name: string;
readonly department_name: string;
readonly organisation_name: string;
readonly postcode_type: string;
readonly su_organisation_indicator: string;
readonly delivery_point_suffix: string;
readonly county: string;
readonly traditional_county: string;
readonly administrative_county: string;
readonly postal_county: string;
readonly district: string;
readonly ward: string;
readonly country: string;
readonly northings: number | t.EmptyString;
readonly eastings: number | t.EmptyString;
readonly udprn: number | t.EmptyString;
readonly umprn: number | t.EmptyString;
readonly longitude: number | t.EmptyString;
readonly latitude: number | t.EmptyString;
private cache;
constructor(data: AddressRecord);
raw(): t.RawAddress;
toJSON(): t.AddressJSON;
formattedAddress(): t.FormattedAddress;
static formatPostcode(postcode: string): string;
static sort(a: Address, b: Address): Number;
}
export declare type AddressRecord = t.AddressRecord;
| import * as t from "./types";
export declare class Address {
readonly merge_sub_and_building: boolean;
readonly postcode_inward: string;
readonly postcode_outward: string;
readonly po_box: string;
readonly postcode: string;
readonly post_town: string;
readonly dependant_locality: string;
readonly double_dependant_locality: string;
readonly thoroughfare: string;
readonly dependant_thoroughfare: string;
readonly building_number: string;
readonly building_name: string;
readonly sub_building_name: string;
readonly department_name: string;
readonly organisation_name: string;
readonly postcode_type: string;
readonly su_organisation_indicator: string;
readonly delivery_point_suffix: string;
readonly county: string;
readonly traditional_county: string;
readonly administrative_county: string;
readonly postal_county: string;
readonly district: string;
readonly ward: string;
readonly country: string;
readonly northings: number | t.EmptyString;
readonly eastings: number | t.EmptyString;
readonly udprn: number | t.EmptyString;
readonly umprn: number | t.EmptyString;
readonly longitude: number | t.EmptyString;
readonly latitude: number | t.EmptyString;
private cache;
constructor(data: AddressRecord);
raw(): t.RawAddress;
toJSON(): t.AddressJSON;
formattedAddress(): t.FormattedAddress;
static formatPostcode(postcode: string): string;
static sort(a: Address, b: Address): number;
}
export declare type AddressRecord = t.AddressRecord;
| Fix typing for the sort function | Fix typing for the sort function
| TypeScript | mit | cblanc/uk-clear-addressing,ideal-postcodes/uk-clear-addressing,ideal-postcodes/uk-clear-addressing | ---
+++
@@ -37,6 +37,6 @@
toJSON(): t.AddressJSON;
formattedAddress(): t.FormattedAddress;
static formatPostcode(postcode: string): string;
- static sort(a: Address, b: Address): Number;
+ static sort(a: Address, b: Address): number;
}
export declare type AddressRecord = t.AddressRecord; |
fa194a8ca1c470d729f247e551373e5701226e03 | packages/web-client/app/utils/wallet-providers.ts | packages/web-client/app/utils/wallet-providers.ts | import metamaskLogo from '@cardstack/web-client/images/logos/metamask-logo.svg';
import walletConnectLogo from '@cardstack/web-client/images/logos/wallet-connect-logo.svg';
export interface WalletProvider {
id: string;
name: string;
logo: string;
}
const walletProviders: WalletProvider[] = [
{
id: 'metamask',
name: 'MetaMask',
logo: metamaskLogo,
},
{
id: 'wallet-connect',
name: 'WalletConnect',
logo: walletConnectLogo,
},
];
export default walletProviders;
| import metamaskLogo from '@cardstack/web-client/images/logos/metamask-logo.svg';
import walletConnectLogo from '@cardstack/web-client/images/logos/wallet-connect-logo.svg';
export type WalletProviderId = 'metamask' | 'wallet-connect';
export interface WalletProvider {
id: WalletProviderId;
name: string;
logo: string;
}
const walletProviders: WalletProvider[] = [
{
id: 'metamask',
name: 'MetaMask',
logo: metamaskLogo,
},
{
id: 'wallet-connect',
name: 'WalletConnect',
logo: walletConnectLogo,
},
];
export default walletProviders;
| Make WalletProvider id typing stricter | Make WalletProvider id typing stricter
| TypeScript | mit | cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack | ---
+++
@@ -1,8 +1,9 @@
import metamaskLogo from '@cardstack/web-client/images/logos/metamask-logo.svg';
import walletConnectLogo from '@cardstack/web-client/images/logos/wallet-connect-logo.svg';
+export type WalletProviderId = 'metamask' | 'wallet-connect';
export interface WalletProvider {
- id: string;
+ id: WalletProviderId;
name: string;
logo: string;
} |
d0c3535b72813497232a7167a0ec83c11b077167 | src/lib/finalMetrics.ts | src/lib/finalMetrics.ts | /*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Metric} from '../types.js';
export const finalMetrics: WeakSet<Metric>|Set<Metric> = typeof WeakSet === 'function'
? new WeakSet()
: new Set();
| /*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Metric} from '../types.js';
export const finalMetrics: WeakSet<Metric> | Set<Metric> =
typeof WeakSet === 'function' ? new WeakSet() : new Set();
| Update code to match styleguide | Update code to match styleguide
| TypeScript | apache-2.0 | GoogleChrome/web-vitals,GoogleChrome/web-vitals | ---
+++
@@ -16,6 +16,6 @@
import {Metric} from '../types.js';
-export const finalMetrics: WeakSet<Metric>|Set<Metric> = typeof WeakSet === 'function'
- ? new WeakSet()
- : new Set();
+
+export const finalMetrics: WeakSet<Metric> | Set<Metric> =
+ typeof WeakSet === 'function' ? new WeakSet() : new Set(); |
dad08eda1b8725c462cb948ed4e5d719b8b1ca83 | client/app/tables/table-host.component.ts | client/app/tables/table-host.component.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { TableName } from '../common/api';
import { createTableName } from '../common/util';
@Component({
templateUrl: 'table-host.component.html',
styleUrls: ['table-host.component.scss']
})
export class TableHostComponent implements OnInit {
public selectedTable: TableName;
public constructor(public route: ActivatedRoute) {}
public ngOnInit(): void {
this.route.params.subscribe((params: Params) => {
this.selectedTable = createTableName(params.name);
});
}
}
| import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { TableName } from '../common/api';
import { createTableName } from '../common/util';
@Component({
templateUrl: 'table-host.component.html',
styleUrls: ['table-host.component.scss']
})
export class TableHostComponent implements OnInit {
public selectedTable: TableName;
public constructor(public route: ActivatedRoute) {}
public ngOnInit(): void {
this.route.params.subscribe((params: Params) => {
this.selectedTable = params.name ? createTableName(params.name) : null;
});
}
}
| Fix an error being thrown when accessing /tables/ | Fix an error being thrown when accessing /tables/
| TypeScript | mit | mattbdean/Helium,mattbdean/Helium,mattbdean/Helium,mattbdean/Helium | ---
+++
@@ -14,7 +14,7 @@
public ngOnInit(): void {
this.route.params.subscribe((params: Params) => {
- this.selectedTable = createTableName(params.name);
+ this.selectedTable = params.name ? createTableName(params.name) : null;
});
}
} |
280ed973c549aec8892606f7be1d5824aca80b90 | src/app/welcome.ts | src/app/welcome.ts | module welcome {
export class Welcome {
heading = 'Welcome to the Aurelia Navigation App!';
firstName = 'John';
lastName = 'Doe';
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
welcome() {
alert(`Welcome, ${this.fullName}!`);
}
}
export class UpperValueConverter {
toView(value) {
return value && value.toUpperCase();
}
}
}
| module welcome {
export class Welcome {
heading = 'Welcome to the Aurelia Navigation App!';
firstName = 'John';
lastName = 'Doe';
get fullName() {
return `${this.firstName} ${this.lastName}`;
}
welcome() {
alert(`Welcome, ${this.fullName}!`);
}
}
export class UpperValueConverter {
toView(value) {
return value && value.toUpperCase();
}
}
}
export = welcome;
| Add export statement to Welcome module | Add export statement to Welcome module
| TypeScript | mit | bohnen/aurelia-skeleton-navigation-gulp-typescript,bohnen/aurelia-skeleton-navigation-gulp-typescript,Enrapt/aurelia-skeleton-navigation-gulp-typescript,bohnen/aurelia-skeleton-navigation-gulp-typescript,Enrapt/aurelia-skeleton-navigation-gulp-typescript,Enrapt/aurelia-skeleton-navigation-gulp-typescript | ---
+++
@@ -22,3 +22,5 @@
}
}
}
+
+export = welcome; |
96e46c0dd96f90e0f05494b236020eb151a9fa4a | site/server/views/SiteFooter.tsx | site/server/views/SiteFooter.tsx | import * as React from 'react'
import { webpack } from 'utils/server/staticGen'
export const SiteFooter = () => {
return <footer className="SiteFooter">
<div>
<a href="/" className="logo">Our World in Data</a> is a <a href="https://creativecommons.org/licenses/by-sa/4.0/">creative commons</a> publication about human civilization at a global scale.
</div>
<nav>
<a href="/about">About</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLScTaT03ggC7yo8KzRLvoCJY-5mtfuA6jOHheLLFtD5lSHkXlg/viewform">Feedback</a>
<a href="/subscribe">Subscribe</a>
<a href="https://twitter.com/OurWorldInData">Twitter</a>
<a href="https://www.facebook.com/OurWorldinData">Facebook</a>
<a href="https://github.com/owid">GitHub</a>
<a href="/support">Donate</a>
</nav>
<div className="feedbackPromptContainer"></div>
<script src={webpack('commons.js', 'site')}/>
<script src={webpack('owid.js', 'site')}/>
<script dangerouslySetInnerHTML={{__html: `
runHeaderMenus();
runFeedback();
Grapher.embedAll();
`}}/>
</footer>
} | import * as React from 'react'
import { webpack } from 'utils/server/staticGen'
export const SiteFooter = () => {
return <footer className="SiteFooter">
<div>
<a href="/" className="logo">Our World in Data</a> is a <a href="https://creativecommons.org/licenses/by-sa/4.0/">creative commons</a> publication about human civilization at a global scale.
</div>
<nav>
<a href="/about">About</a>
<a href="/subscribe">Subscribe</a>
<a href="https://twitter.com/OurWorldInData">Twitter</a>
<a href="https://www.facebook.com/OurWorldinData">Facebook</a>
<a href="https://github.com/owid">GitHub</a>
<a href="/support">Donate</a>
</nav>
<div className="feedbackPromptContainer"></div>
<script src={webpack('commons.js', 'site')}/>
<script src={webpack('owid.js', 'site')}/>
<script dangerouslySetInnerHTML={{__html: `
runHeaderMenus();
runFeedback();
Grapher.embedAll();
`}}/>
</footer>
} | Remove old feedback link in footer | Remove old feedback link in footer
| TypeScript | mit | OurWorldInData/owid-grapher,OurWorldInData/our-world-in-data-grapher,OurWorldInData/our-world-in-data-grapher,OurWorldInData/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,OurWorldInData/owid-grapher,owid/owid-grapher,owid/owid-grapher,OurWorldInData/our-world-in-data-grapher,OurWorldInData/our-world-in-data-grapher | ---
+++
@@ -8,7 +8,6 @@
</div>
<nav>
<a href="/about">About</a>
- <a href="https://docs.google.com/forms/d/e/1FAIpQLScTaT03ggC7yo8KzRLvoCJY-5mtfuA6jOHheLLFtD5lSHkXlg/viewform">Feedback</a>
<a href="/subscribe">Subscribe</a>
<a href="https://twitter.com/OurWorldInData">Twitter</a>
<a href="https://www.facebook.com/OurWorldinData">Facebook</a> |
70b7027f68ddc896a02f6b11b7450c5c3d8262b2 | src/Test/Html/Escaping/Content.ts | src/Test/Html/Escaping/Content.ts | import { expect } from 'chai'
import Up from '../../../index'
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
describe('All instances of "<" and "&" inside a plain text node', () => {
it('are replaced with "<" and "&", respectively', () => {
const node = new PlainTextNode('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
expect(Up.toHtml(node)).to.be.eql('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
})
})
| import { expect } from 'chai'
import Up from '../../../index'
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
describe('Inside plain text nodes, all instances of < and &', () => {
it('are replaced with "<" and "&", respectively', () => {
const node = new PlainTextNode('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
expect(Up.toHtml(node)).to.be.eql('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
})
})
describe('Inside a plain text node, >, \', and "', () => {
it('are preserved', () => {
const text = 'John said, "1 and 2 > 0. I can\'t believe it."'
const node = new PlainTextNode(text)
expect(Up.toHtml(node)).to.be.eql(text)
})
})
| Add passing html escaping test | Add passing html escaping test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -3,9 +3,19 @@
import { PlainTextNode } from '../../../SyntaxNodes/PlainTextNode'
-describe('All instances of "<" and "&" inside a plain text node', () => {
+describe('Inside plain text nodes, all instances of < and &', () => {
it('are replaced with "<" and "&", respectively', () => {
const node = new PlainTextNode('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
expect(Up.toHtml(node)).to.be.eql('4 & 5 < 10, and 6 & 7 < 10. Coincidence?')
})
})
+
+
+describe('Inside a plain text node, >, \', and "', () => {
+ it('are preserved', () => {
+ const text = 'John said, "1 and 2 > 0. I can\'t believe it."'
+ const node = new PlainTextNode(text)
+ expect(Up.toHtml(node)).to.be.eql(text)
+ })
+})
+ |
1118452ada43eacb58a69cda42607eb2ce083c8f | src/app/_core/models/app-state.ts | src/app/_core/models/app-state.ts | import { PlaylistItem, User } from 'core/models';
export class AppState {
constructor(
public langage?: string,
public theme?: string,
public displayType?: string,
public selectedTab?: number,
public showPlayerBar?: boolean,
public loading?: boolean,
public isMiniSideBar?: boolean,
public multiPlayer?: boolean,
public onPlayList?: PlaylistItem[],
public historicList?: PlaylistItem[],
public selectedPl?: string,
) {
this.langage = langage || 'en';
this.theme = theme || 'dark';
this.displayType = displayType || 'grid';
this.selectedTab = selectedTab || 1;
this.showPlayerBar = showPlayerBar || false;
this.loading = loading || false;
this.isMiniSideBar = isMiniSideBar || false;
this.multiPlayer = multiPlayer || true;
this.onPlayList = onPlayList || [];
this.historicList = historicList || [];
this.selectedPl = selectedPl || '';
}
}
| import { PlaylistItem, User } from 'core/models';
export class AppState {
constructor(
public langage?: string,
public theme?: string,
public displayType?: string,
public selectedTab?: number,
public showPlayerBar?: boolean,
public isMiniSideBar?: boolean,
public multiPlayer?: boolean,
public onPlayList?: PlaylistItem[],
public historicList?: PlaylistItem[],
public selectedPl?: string,
) {
this.langage = langage || 'en';
this.theme = theme || 'dark';
this.displayType = displayType || 'grid';
this.selectedTab = selectedTab || 1;
this.showPlayerBar = showPlayerBar || false;
this.isMiniSideBar = isMiniSideBar || false;
this.multiPlayer = multiPlayer || true;
this.onPlayList = onPlayList || [];
this.historicList = historicList || [];
this.selectedPl = selectedPl || '';
}
}
| Remove loading status from appState model | Remove loading status from appState model
| TypeScript | mit | radiium/turntable,radiium/turntable,radiium/turntable | ---
+++
@@ -7,7 +7,6 @@
public displayType?: string,
public selectedTab?: number,
public showPlayerBar?: boolean,
- public loading?: boolean,
public isMiniSideBar?: boolean,
public multiPlayer?: boolean,
public onPlayList?: PlaylistItem[],
@@ -19,7 +18,6 @@
this.displayType = displayType || 'grid';
this.selectedTab = selectedTab || 1;
this.showPlayerBar = showPlayerBar || false;
- this.loading = loading || false;
this.isMiniSideBar = isMiniSideBar || false;
this.multiPlayer = multiPlayer || true;
this.onPlayList = onPlayList || []; |
a39ba7674bf656b2c8bf5dd9a5e7416e00ac3a2a | modules/agar/src/main/ts/ephox/agar/server/SeleniumAction.ts | modules/agar/src/main/ts/ephox/agar/server/SeleniumAction.ts | import { DataType, Http } from '@ephox/jax';
import Promise from '@ephox/wrap-promise-polyfill';
import { Chain } from '../api/Chain';
import { Step } from '../api/Step';
const postInfo = (path: string, info: any, die: (err: any) => void, next: (v: {}) => void): void => {
Http.post({
url: path,
body: {
type: DataType.JSON,
data: info
},
responseType: DataType.JSON
}).get((res) => {
res.fold(die, next);
});
};
const sPerform = <T> (path: string, info: any): Step<T, T> =>
Step.async<T>((next, die) => {
postInfo(path, info, die, next);
});
const cPerform = <T> (path: string): Chain<T, T> =>
Chain.async((info, next, die) => {
postInfo(path, info, die, next);
});
const pPerform = (path: string, info: any): Promise<{}> => {
return new Promise(((resolve, reject) => {
postInfo(path, info, reject, resolve);
}));
};
export {
sPerform,
cPerform,
pPerform
};
| import { DataType, Http } from '@ephox/jax';
import Promise from '@ephox/wrap-promise-polyfill';
import { Chain } from '../api/Chain';
import { Step } from '../api/Step';
const postInfo = (path: string, info: any, die: (err: any) => void, next: (v: {}) => void): void => {
Http.post({
url: path,
body: {
type: DataType.JSON,
data: info
},
responseType: DataType.JSON
}).get((res) => {
res.fold((e) => die(JSON.stringify(e)), next);
});
};
const sPerform = <T> (path: string, info: any): Step<T, T> =>
Step.async<T>((next, die) => {
postInfo(path, info, die, next);
});
const cPerform = <T> (path: string): Chain<T, T> =>
Chain.async((info, next, die) => {
postInfo(path, info, die, next);
});
const pPerform = (path: string, info: any): Promise<{}> => {
return new Promise(((resolve, reject) => {
postInfo(path, info, reject, resolve);
}));
};
export {
sPerform,
cPerform,
pPerform
};
| Fix failure messages for agar selenium actions | TINY-7039: Fix failure messages for agar selenium actions
| TypeScript | mit | TeamupCom/tinymce,TeamupCom/tinymce,tinymce/tinymce,tinymce/tinymce,tinymce/tinymce | ---
+++
@@ -12,7 +12,7 @@
},
responseType: DataType.JSON
}).get((res) => {
- res.fold(die, next);
+ res.fold((e) => die(JSON.stringify(e)), next);
});
};
|
b10f481960f2270d1d02af466ec20bdf55144d43 | src/custom-error.ts | src/custom-error.ts | import { fixProto, fixStack } from './utils'
/**
* Extendable Error
*/
export class CustomError extends Error {
constructor(message?: string) {
super(message)
// fix the extended error prototype chain
// because typescript __extends implementation can't
// see https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
fixProto(this, new.target.prototype)
// try to remove contructor from stack trace
fixStack(this)
}
}
| import { fixProto, fixStack } from './utils'
/**
* Allows to easily extend a base class to create custom applicative errors.
*
* example:
* ```
* class HttpError extends CustomError {
* public constructor(
* public code: number,
* message?: string,
* ) {
* super(message)
* }
* }
*
* new HttpError(404, 'Not found')
* ```
*/
export class CustomError extends Error {
constructor(message?: string) {
super(message)
// fix the extended error prototype chain
// because typescript __extends implementation can't
// see https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
fixProto(this, new.target.prototype)
// try to remove contructor from stack trace
fixStack(this)
}
}
| Add class example usage comment | docs: Add class example usage comment
| TypeScript | mit | adriengibrat/ts-custom-error | ---
+++
@@ -1,7 +1,21 @@
import { fixProto, fixStack } from './utils'
/**
- * Extendable Error
+ * Allows to easily extend a base class to create custom applicative errors.
+ *
+ * example:
+ * ```
+ * class HttpError extends CustomError {
+ * public constructor(
+ * public code: number,
+ * message?: string,
+ * ) {
+ * super(message)
+ * }
+ * }
+ *
+ * new HttpError(404, 'Not found')
+ * ```
*/
export class CustomError extends Error {
constructor(message?: string) { |
909700754434a36e767e67662a2b351e607b2e94 | types/index.ts | types/index.ts | export type CookieAttributes = object & {
path?: string
domain?: string
expires?: number | Date
sameSite?: 'strict' | 'Strict' | 'lax' | 'Lax' | 'none' | 'None'
secure?: boolean
[property: string]: any
}
export type CookieAttributesConfig = object & {
readonly path?: string
readonly domain?: string
readonly expires?: number | Date
readonly sameSite?: 'strict' | 'Strict' | 'lax' | 'Lax' | 'none' | 'None'
readonly secure?: boolean
readonly [property: string]: any
}
export type ReadConverter = (value: string, name?: string) => any
export type WriteConverter = (value: any, name?: string) => string
export type CookieConverter = object & {
read: ReadConverter
write: WriteConverter
}
export type CookieConverterConfig = object & {
readonly read: ReadConverter
readonly write: WriteConverter
}
type CookiesConfig = object & {
readonly converter: CookieConverterConfig
readonly attributes: CookieAttributesConfig
}
type CookiesApi = object & {
set: (
name: string,
value: any,
attributes?: CookieAttributes
) => string | undefined
get: (
name?: string | undefined | null
) => string | undefined | (object & { [property: string]: any })
remove: (name: string, attributes?: CookieAttributes) => void
withAttributes: (attributes: CookieAttributes) => Cookies
withConverter: (converter: {
write?: WriteConverter
read?: ReadConverter
}) => Cookies
}
export type Cookies = CookiesConfig & CookiesApi
| type ReadOnlyConfig<T> = {
readonly [Property in keyof T]: T[Property]
}
export type CookieAttributes = object & {
path?: string
domain?: string
expires?: number | Date
sameSite?: 'strict' | 'Strict' | 'lax' | 'Lax' | 'none' | 'None'
secure?: boolean
[property: string]: any
}
export type CookieAttributesConfig = ReadOnlyConfig<CookieAttributes>
export type ReadConverter = (value: string, name?: string) => any
export type WriteConverter = (value: any, name?: string) => string
export type CookieConverter = object & {
read: ReadConverter
write: WriteConverter
}
export type CookieConverterConfig = ReadOnlyConfig<CookieConverter>
type CookiesConfig = object & {
readonly converter: CookieConverterConfig
readonly attributes: CookieAttributesConfig
}
type CookiesApi = object & {
set: (
name: string,
value: any,
attributes?: CookieAttributes
) => string | undefined
get: (
name?: string | undefined | null
) => string | undefined | (object & { [property: string]: any })
remove: (name: string, attributes?: CookieAttributes) => void
withAttributes: (attributes: CookieAttributes) => Cookies
withConverter: (converter: {
write?: WriteConverter
read?: ReadConverter
}) => Cookies
}
export type Cookies = CookiesConfig & CookiesApi
| Use mapped types to avoid duplication | Use mapped types to avoid duplication
| TypeScript | mit | carhartl/js-cookie,carhartl/js-cookie | ---
+++
@@ -1,3 +1,7 @@
+type ReadOnlyConfig<T> = {
+ readonly [Property in keyof T]: T[Property]
+}
+
export type CookieAttributes = object & {
path?: string
domain?: string
@@ -7,14 +11,7 @@
[property: string]: any
}
-export type CookieAttributesConfig = object & {
- readonly path?: string
- readonly domain?: string
- readonly expires?: number | Date
- readonly sameSite?: 'strict' | 'Strict' | 'lax' | 'Lax' | 'none' | 'None'
- readonly secure?: boolean
- readonly [property: string]: any
-}
+export type CookieAttributesConfig = ReadOnlyConfig<CookieAttributes>
export type ReadConverter = (value: string, name?: string) => any
@@ -25,10 +22,7 @@
write: WriteConverter
}
-export type CookieConverterConfig = object & {
- readonly read: ReadConverter
- readonly write: WriteConverter
-}
+export type CookieConverterConfig = ReadOnlyConfig<CookieConverter>
type CookiesConfig = object & {
readonly converter: CookieConverterConfig |
bb768a56fd450006e0c6f3fd3b028c42faad90dc | packages/@orbit/core/src/main.ts | packages/@orbit/core/src/main.ts | import { assert } from './assert';
import { deprecate } from './deprecate';
import { uuid } from '@orbit/utils';
declare const self: any;
declare const global: any;
export interface OrbitGlobal {
globals: any;
assert: (description: string, test: boolean) => void | never;
deprecate: (message: string, test?: boolean | (() => boolean)) => void;
uuid: () => string;
}
// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
// instead of `window` for `WebWorker` support.
//
// Source: https://github.com/jashkenas/underscore/blob/master/underscore.js#L11-L17
// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2017 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
const globals =
(typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global) ||
{};
export const Orbit: OrbitGlobal = {
globals,
assert,
deprecate,
uuid
};
| import { assert } from './assert';
import { deprecate } from './deprecate';
import { uuid } from '@orbit/utils';
declare const self: any;
declare const global: any;
export interface OrbitGlobal {
globals: any;
assert: (description: string, test: boolean) => void | never;
deprecate: (message: string, test?: boolean | (() => boolean)) => void;
uuid: () => string;
debug: boolean;
}
// Establish the root object, `window` (`self`) in the browser, `global`
// on the server, or `this` in some virtual machines. We use `self`
// instead of `window` for `WebWorker` support.
//
// Source: https://github.com/jashkenas/underscore/blob/master/underscore.js#L11-L17
// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2017 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
const globals =
(typeof self == 'object' && self.self === self && self) ||
(typeof global == 'object' && global) ||
{};
export const Orbit: OrbitGlobal = {
globals,
assert,
debug: true,
deprecate,
uuid
};
| Add debug setting to `Orbit` global | Add debug setting to `Orbit` global
`Orbit.debug` is `true` by default to improve awareness of deprecations and other debugging safeguards.
| TypeScript | mit | orbitjs/orbit.js,orbitjs/orbit.js | ---
+++
@@ -10,6 +10,7 @@
assert: (description: string, test: boolean) => void | never;
deprecate: (message: string, test?: boolean | (() => boolean)) => void;
uuid: () => string;
+ debug: boolean;
}
// Establish the root object, `window` (`self`) in the browser, `global`
@@ -29,6 +30,7 @@
export const Orbit: OrbitGlobal = {
globals,
assert,
+ debug: true,
deprecate,
uuid
}; |
04a3c6256318e577b8bc72fa810608bceef4a9b4 | src/Components/v2/RouteTabs.tsx | src/Components/v2/RouteTabs.tsx | import {
color,
Sans,
sharedTabsStyles,
space,
TabsContainer,
} from "@artsy/palette"
import { Link, LinkProps } from "found"
import React from "react"
import styled from "styled-components"
export const RouteTabs = styled(TabsContainer)`
a {
${sharedTabsStyles.tabContainer};
:not(:last-child) {
margin-right: ${space(3)}px;
}
color: ${color("black30")};
text-decoration: none;
&.active {
color: ${color("black100")};
${sharedTabsStyles.activeTabContainer};
}
}
`
export const RouteTab: React.FC<LinkProps> = ({ children, ...props }) => {
return (
<Link {...props} activeClassName="active">
<Sans size="3t" weight="medium">
{children}
</Sans>
</Link>
)
}
RouteTabs.displayName = "RouteTabs"
RouteTab.displayName = "RouteTab"
| import {
color,
Sans,
sharedTabsStyles,
space,
TabsContainer,
} from "@artsy/palette"
import { Link, LinkProps } from "found"
import React from "react"
import styled from "styled-components"
export const RouteTabs = styled(TabsContainer)`
a {
${sharedTabsStyles.tabContainer};
:not(:last-child) {
margin-right: ${space(3)}px;
}
color: ${color("black60")};
text-decoration: none;
&.active {
color: ${color("black100")};
${sharedTabsStyles.activeTabContainer};
}
}
`
export const RouteTab: React.FC<LinkProps> = ({ children, ...props }) => {
return (
<Link {...props} activeClassName="active">
<Sans size="3t" weight="medium">
{children}
</Sans>
</Link>
)
}
RouteTabs.displayName = "RouteTabs"
RouteTab.displayName = "RouteTab"
| Tweak color of non-active state | [RouteTab] Tweak color of non-active state
| TypeScript | mit | xtina-starr/reaction,xtina-starr/reaction,xtina-starr/reaction,artsy/reaction,artsy/reaction,artsy/reaction,artsy/reaction-force,xtina-starr/reaction,artsy/reaction-force | ---
+++
@@ -16,7 +16,7 @@
:not(:last-child) {
margin-right: ${space(3)}px;
}
- color: ${color("black30")};
+ color: ${color("black60")};
text-decoration: none;
&.active { |
33e00468c0dc7b886baf58ba341d2d50a3393aa0 | client/imports/discourse/sso.component.ts | client/imports/discourse/sso.component.ts | import { Component, NgZone } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { MdSnackBar } from '@angular/material';
import { Meteor } from 'meteor/meteor';
import { MeteorObservable } from 'meteor-rxjs';
import template from './sso.html';
@Component({
selector: 'discourse-sso',
template
})
export class DiscourseSSOComponent {
step: string;
constructor(private ngZone: NgZone,
private route: ActivatedRoute,
private snackBar: MdSnackBar) { }
ngOnInit() {
this.step = Meteor.userId() ? 'authorize' : 'login';
if (Meteor.userId()) {
this.allow();
}
}
allow() {
let currentRoute = this.route.snapshot;
MeteorObservable.call("discourse.sso",
currentRoute.queryParams['sso'],
currentRoute.queryParams['sig']).
subscribe((result) => {
this.ngZone.run(() => {
this.step = 'redirect';
});
window.location.href = result['redirectToUri'];
}, (error) => {
this.ngZone.run(() => {
this.snackBar.open(error.reason, null, { duration: 5000 });
});
});
}
onCancel() {
window.history.back;
}
}
| import { Component, NgZone } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { MdSnackBar } from '@angular/material';
import { Meteor } from 'meteor/meteor';
import { MeteorObservable } from 'meteor-rxjs';
import template from './sso.html';
@Component({
selector: 'discourse-sso',
template
})
export class DiscourseSSOComponent {
step: string;
constructor(private ngZone: NgZone,
private route: ActivatedRoute,
private snackBar: MdSnackBar) { }
ngOnInit() {
this.step = Meteor.userId() ? 'authorize' : 'login';
if (Meteor.userId()) {
this.allow();
}
}
allow() {
let currentRoute = this.route.snapshot;
MeteorObservable.call("discourse.sso",
currentRoute.queryParams['sso'],
currentRoute.queryParams['sig']).
subscribe((result) => {
this.ngZone.run(() => {
this.step = 'redirect';
});
if (Meteor.isCordova) {
window.open(result['redirectToUri'], "_blank");
} else {
window.location.href = result['redirectToUri'];
}
}, (error) => {
this.ngZone.run(() => {
this.snackBar.open(error.reason, null, { duration: 5000 });
});
});
}
onCancel() {
window.history.back;
}
}
| Return to browser after disourse sso | Return to browser after disourse sso
| TypeScript | agpl-3.0 | singularities/songs-pot,singularities/songs-pot,singularities/song-pot,singularities/song-pot,singularities/songs-pot,singularities/song-pot | ---
+++
@@ -38,7 +38,11 @@
this.step = 'redirect';
});
- window.location.href = result['redirectToUri'];
+ if (Meteor.isCordova) {
+ window.open(result['redirectToUri'], "_blank");
+ } else {
+ window.location.href = result['redirectToUri'];
+ }
}, (error) => {
|
6de4a07f0f363f8fea2e891125e64a98793c3670 | core/modules/breadcrumbs/helpers/index.ts | core/modules/breadcrumbs/helpers/index.ts | import { formatCategoryLink } from '@vue-storefront/core/modules/url/helpers'
// Duplicate of breadCrumbRoutes, to repalce it soon.
/** Parse category path for product/category */
export function parseCategoryPath (categoryPath) {
let routesArray = []
for (let category of categoryPath) {
routesArray.push({
name: category.name,
route_link: formatCategoryLink(category)
})
}
return routesArray
}
| import { formatCategoryLink } from '@vue-storefront/core/modules/url/helpers'
// Duplicate of breadCrumbRoutes, to repalce it soon.
/** Parse category path for product/category */
export function parseCategoryPath (categoryPath) {
let routesArray = []
for (let category of categoryPath) {
if (category.url_path == undefined) continue;
routesArray.push({
name: category.name,
route_link: formatCategoryLink(category)
})
}
return routesArray
}
| Remove categories with unknown `url_path` from breadcrumbs | Remove categories with unknown `url_path` from breadcrumbs
In already 4 instances of Vue Storefront 1 with Magento 1, I've encountered the following issue: When categories are loaded into the breadcrumbs, they include the Magento Root Category (often with a name like **Default Category**). But because this Root Category serves a special purpose, the URL path is always empty. This fix simply checks whether the URL path is `undefined` and if so, it skips that category. Because the breadcrumbs are supposed to only contain categories with the URL path set. | TypeScript | mit | DivanteLtd/vue-storefront,DivanteLtd/vue-storefront,pkarw/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront,pkarw/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront | ---
+++
@@ -5,6 +5,7 @@
export function parseCategoryPath (categoryPath) {
let routesArray = []
for (let category of categoryPath) {
+ if (category.url_path == undefined) continue;
routesArray.push({
name: category.name,
route_link: formatCategoryLink(category) |
eb1add1b107b40bcd43f1cde43ba38b446f44966 | src/form/utils.ts | src/form/utils.ts | import { DateTime } from 'luxon';
import { PeriodOption } from '@waldur/form/types';
export const reactSelectMenuPortaling = (): any => ({
menuPortalTarget: document.body,
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
menuPosition: 'fixed',
menuPlacement: 'bottom',
});
export const datePickerOverlayContainerInDialogs = () => ({
calendarPlacement: 'bottom',
calendarContainer: document.getElementsByClassName('modal-dialog')[0],
});
export const makeLastTwelveMonthsFilterPeriods = (): PeriodOption[] => {
let date = DateTime.now().startOf('month');
const choices = [];
for (let i = 0; i < 12; i++) {
const month = date.month;
const year = date.year;
const label = date.toFormat('MMMM, YYYY');
choices.push({
label,
value: { year, month, current: i === 0 },
});
date = date.minus({ months: 1 });
}
return choices;
};
| import { DateTime } from 'luxon';
import { PeriodOption } from '@waldur/form/types';
export const reactSelectMenuPortaling = (): any => ({
menuPortalTarget: document.body,
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
menuPosition: 'fixed',
menuPlacement: 'bottom',
});
export const datePickerOverlayContainerInDialogs = () => ({
calendarPlacement: 'bottom',
calendarContainer: document.getElementsByClassName('modal-dialog')[0],
});
export const makeLastTwelveMonthsFilterPeriods = (): PeriodOption[] => {
let date = DateTime.now().startOf('month');
const choices = [];
for (let i = 0; i < 12; i++) {
const month = date.month;
const year = date.year;
const label = date.toFormat('MMMM, yyyy');
choices.push({
label,
value: { year, month, current: i === 0 },
});
date = date.minus({ months: 1 });
}
return choices;
};
| Fix year formatting in accounting period selector. | Fix year formatting in accounting period selector.
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | ---
+++
@@ -20,7 +20,7 @@
for (let i = 0; i < 12; i++) {
const month = date.month;
const year = date.year;
- const label = date.toFormat('MMMM, YYYY');
+ const label = date.toFormat('MMMM, yyyy');
choices.push({
label,
value: { year, month, current: i === 0 }, |
0c8e3f88495d39167adaa2fd69ebdca2bf97e1f6 | server/services/database/database.service.ts | server/services/database/database.service.ts | import { Service } from 'ts-express-decorators';
import { IDatabaseConnector } from './database.connector';
import { SQLiteConnector } from './sqlite.connector';
import { populationQueries } from './population-queries';
@Service()
export class DatabaseService {
private databaseConnector: IDatabaseConnector;
constructor() {
let db = new SQLiteConnector('./countable-database.sqlite', true);
populationQueries.forEach(function (query) {
db.executeQuery(query, []);
});
this.databaseConnector = db;
}
public executeQuery(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(query, params);
}
}
| import { Service } from 'ts-express-decorators';
import { IDatabaseConnector } from './database.connector';
import { SQLiteConnector } from './sqlite.connector';
import { populationQueries } from './population-queries';
@Service()
export class DatabaseService {
private databaseConnector: IDatabaseConnector;
constructor() {
let db = new SQLiteConnector('./countable-database.sqlite', true);
populationQueries.forEach(function (query) {
db.executeQuery(query, []);
});
this.databaseConnector = db;
}
public executeQuery(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(query, ...params);
}
}
| Fix type bug with ellipsis param | Fix type bug with ellipsis param
| TypeScript | mit | DavidLevayer/countable,DavidLevayer/countable,DavidLevayer/countable | ---
+++
@@ -18,6 +18,6 @@
}
public executeQuery(query: string, ...params: any[]): Promise<any[]> {
- return this.databaseConnector.executeQuery(query, params);
+ return this.databaseConnector.executeQuery(query, ...params);
}
} |
a8d34dbeefe2d158505e250978fc5ad2922ca7cb | test/shared/global/test_data.ts | test/shared/global/test_data.ts |
import * as chance from 'chance';
export interface IUserData {
email: string;
password: string;
searchBarInput: string;
accountName: string;
accountNumber: string;
}
export class UserData {
static data = (): IUserData => {
let _chance = new chance();
const data = {
email: 'sudakshay@gmail.com',
password: 'Password1',
searchBarInput: 'ANZ',
accountName: 'Akshay ANZ' + _chance.integer({ min: 1, max: 100 }),
accountNumber: _chance.string({
pool: '123456789',
length: 8
})
};
return data;
}
}
|
import * as chance from 'chance';
export interface IUserData {
email: string;
password: string;
searchBarInput: string;
accountName: string;
accountNumber: string;
}
export class UserData {
static data = (): IUserData => {
let _chance = new chance();
const data = {
email: 'sudakshay@gmail.com',
password: 'Password1',
searchBarInput: 'ANZ',
accountName: 'Akshay ANZ' + _chance.integer({ min: 1, max: 1000 }),
accountNumber: _chance.string({
pool: '123456789',
length: 8
})
};
return data;
}
}
| Increase the randomness to avoid collision | Increase the randomness to avoid collision
| TypeScript | mit | aksud/acceptance-test,aksud/acceptance-test | ---
+++
@@ -18,7 +18,7 @@
email: 'sudakshay@gmail.com',
password: 'Password1',
searchBarInput: 'ANZ',
- accountName: 'Akshay ANZ' + _chance.integer({ min: 1, max: 100 }),
+ accountName: 'Akshay ANZ' + _chance.integer({ min: 1, max: 1000 }),
accountNumber: _chance.string({
pool: '123456789',
length: 8 |
46facc301c6987045de9bc5e07c55087d27f583f | app/lib/common-libs/exit-codes.ts | app/lib/common-libs/exit-codes.ts | export enum ExitCodes {
OK = 0,
UNHANDLED_ERROR = 1,
UNCAUGHT_EXCEPTION = 2,
DUNITER_NOT_RUNNING = 2,
SIGINT = 3,
SYNC_FAIL = 50,
FORCE_CLOSE_AFTER_ERROR = 100,
MINDEX_WRITING_ERROR = 500,
}
| export enum ExitCodes {
OK = 0,
UNHANDLED_ERROR = 1,
UNCAUGHT_EXCEPTION = 2,
SIGINT = 3,
DUNITER_NOT_RUNNING = 4,
SYNC_FAIL = 50,
FORCE_CLOSE_AFTER_ERROR = 100,
MINDEX_WRITING_ERROR = 500,
}
| Exit codes: return 4 when Duniter is not running | [fix] Exit codes: return 4 when Duniter is not running
| TypeScript | agpl-3.0 | duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter | ---
+++
@@ -2,8 +2,8 @@
OK = 0,
UNHANDLED_ERROR = 1,
UNCAUGHT_EXCEPTION = 2,
- DUNITER_NOT_RUNNING = 2,
SIGINT = 3,
+ DUNITER_NOT_RUNNING = 4,
SYNC_FAIL = 50,
FORCE_CLOSE_AFTER_ERROR = 100,
MINDEX_WRITING_ERROR = 500, |
9d5f785bb4b8121af186e9e82135ebc79b8f5a19 | app/queries/movies.ts | app/queries/movies.ts | import { Queries } from 'marty'
import MoviesConstants from '../constants/movies'
import { yts } from '../utils/request'
class MoviesQueries extends Queries {
getPage (from: number, limit: number) {
var page = Math.floor((from + limit) / limit)
this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)
return yts(`/v2/list_movies.json?sort_by=peers&limit=${limit}&page=${page}`)
.then((res) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE, page, res.body))
.catch((err) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_FAILED, page, err))
}
}
export default MoviesQueries
| import { Queries } from 'marty'
import MoviesConstants from '../constants/movies'
import { yts } from '../utils/request'
class MoviesQueries extends Queries {
getPage (from: number, limit: number) {
var page = Math.ceil((from + limit) / limit)
this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)
return yts(`/v2/list_movies.json?sort_by=peers&limit=${limit}&page=${page}`)
.then((res) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE, page, res.body))
.catch((err) => this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_FAILED, page, err))
}
}
export default MoviesQueries
| Make movie page queries start on 1 correctly | Make movie page queries start on 1 correctly | TypeScript | mit | blakeembrey/back-row,blakeembrey/back-row,blakeembrey/back-row | ---
+++
@@ -5,7 +5,7 @@
class MoviesQueries extends Queries {
getPage (from: number, limit: number) {
- var page = Math.floor((from + limit) / limit)
+ var page = Math.ceil((from + limit) / limit)
this.dispatch(MoviesConstants.RECIEVE_YTS_PAGE_STARTING, page)
|
37b9049486fadb348c18f8c74af64622cae10d11 | src/Writer/WriterConfig.ts | src/Writer/WriterConfig.ts | interface I18nArgs {
idDelimiter?: string,
terms?: I18nTerms,
}
interface I18nTerms {
footnote?: string,
footnoteReference?: string
}
export interface WriterConfigArgs {
documentId?: string,
i18n?: I18nArgs
}
export class WriterConfig {
private config: WriterConfigArgs
constructor(args: WriterConfigArgs) {
args = args || { }
const i18n = args.i18n || { }
const i18nTerms = i18n.terms || { }
this.config = {
documentId: args.documentId || '',
i18n: {
idDelimiter: i18n.idDelimiter || '-',
terms: {
footnote: i18nTerms.footnote || 'footnote',
footnoteReference: i18nTerms.footnoteReference || 'footnote-reference',
}
}
}
}
private getId(...parts: string[]): string {
return (
[this.config.documentId]
.concat(parts)
.filter(part => !!part)
.join(this.config.i18n.idDelimiter)
)
}
getFootnoteId(ordinal: number): string {
return this.getId(this.config.i18n.terms.footnote, ordinal.toString())
}
} | export interface WriterConfigArgs {
documentId?: string,
i18n?: {
idDelimiter?: string,
terms?: {
footnote?: string,
footnoteReference?: string
},
}
}
export class WriterConfig {
private config: WriterConfigArgs
constructor(args: WriterConfigArgs) {
args = args || {}
const i18n = args.i18n || {}
const i18nTerms = i18n.terms || {}
this.config = {
documentId: args.documentId || '',
i18n: {
idDelimiter: i18n.idDelimiter || '-',
terms: {
footnote: i18nTerms.footnote || 'footnote',
footnoteReference: i18nTerms.footnoteReference || 'footnote-reference',
}
}
}
}
private getId(...parts: string[]): string {
return (
[this.config.documentId]
.concat(parts)
.filter(part => !!part)
.join(this.config.i18n.idDelimiter)
)
}
getFootnoteId(ordinal: number): string {
return this.getId(this.config.i18n.terms.footnote, ordinal.toString())
}
} | Remove unnecessary I18n interface declarations | Remove unnecessary I18n interface declarations
| TypeScript | mit | start/up,start/up | ---
+++
@@ -1,32 +1,30 @@
-interface I18nArgs {
- idDelimiter?: string,
- terms?: I18nTerms,
-}
-
-interface I18nTerms {
- footnote?: string,
- footnoteReference?: string
-}
-
export interface WriterConfigArgs {
documentId?: string,
- i18n?: I18nArgs
+
+ i18n?: {
+ idDelimiter?: string,
+
+ terms?: {
+ footnote?: string,
+ footnoteReference?: string
+ },
+ }
}
export class WriterConfig {
private config: WriterConfigArgs
constructor(args: WriterConfigArgs) {
- args = args || { }
- const i18n = args.i18n || { }
- const i18nTerms = i18n.terms || { }
-
+ args = args || {}
+ const i18n = args.i18n || {}
+ const i18nTerms = i18n.terms || {}
+
this.config = {
documentId: args.documentId || '',
-
+
i18n: {
idDelimiter: i18n.idDelimiter || '-',
-
+
terms: {
footnote: i18nTerms.footnote || 'footnote',
footnoteReference: i18nTerms.footnoteReference || 'footnote-reference', |
a69594b682b6628c6c7e6f5aca45194cf395c4ed | src/api/applications/validate.ts | src/api/applications/validate.ts | export type Body = {
repository: string
name: string
key: string
label: string
dockerfile: string
}
export default function validate(body: Body) {
const errors = Object.keys(body)
.reduce((list, key) => {
const value = body[key]
if (typeof value !== 'string') {
list.push(`${key} is invalid`)
}
return list
}, [])
const repo = body.repository || ''
const name = body.name || ''
const label = body.label || ''
if (!repo.length) {
errors.push('Invalid repository name')
}
if (!name.length) {
errors.push('Invalid application name')
}
if (!label.length) {
errors.push('Invalid application label')
}
return errors
}
| export type Body = {
repository: string
name: string
key: string
label: string
dockerfile: string
}
export default function validate(body: Body) {
const errors = Object.keys(body)
.reduce((list, key) => {
if (key === 'id') { return list }
const value = body[key]
if (typeof value !== 'string') {
list.push(`${key} is invalid`)
}
return list
}, [])
const repo = body.repository || ''
const name = body.name || ''
const label = body.label || ''
if (!repo.length) {
errors.push('Invalid repository name')
}
if (!name.length) {
errors.push('Invalid application name')
}
if (!label.length) {
errors.push('Invalid application label')
}
return errors
}
| Fix application request body validation | Fix application request body validation
| TypeScript | mit | the-concierge/concierge,the-concierge/concierge,the-concierge/concierge | ---
+++
@@ -9,6 +9,8 @@
export default function validate(body: Body) {
const errors = Object.keys(body)
.reduce((list, key) => {
+ if (key === 'id') { return list }
+
const value = body[key]
if (typeof value !== 'string') {
list.push(`${key} is invalid`) |
e98ab195f8c77a6dafb1225ff4ec4cb76e5cbf0f | src/components/Article/index.tsx | src/components/Article/index.tsx | import * as React from 'react';
const Markdown = require('react-markdown');
require('github-markdown-css/github-markdown.css');
const ArticleComponent = require('./styles').ArticleComponent;
interface IProps extends React.Props<Button> {
content: string;
};
class Button extends React.Component<IProps, any> {
public render() {
return (
<ArticleComponent className="markdown-body">
<Markdown source={this.props.content} />
</ArticleComponent>
);
}
}
export default Button;
| import * as React from 'react';
const Markdown = require('react-markdown');
require('github-markdown-css/github-markdown.css');
const ArticleComponent = require('./styles').ArticleComponent;
interface IProps extends React.Props<Button> {
content: string;
};
class Article extends React.Component<IProps, any> {
public render() {
return (
<ArticleComponent className="markdown-body">
<Markdown source={this.props.content} />
</ArticleComponent>
);
}
}
export default Article;
| Fix name of article component | Fix name of article component | TypeScript | mit | scalable-react/scalable-react-typescript-boilerplate,scalable-react/scalable-react-typescript-boilerplate,scalable-react/scalable-react-typescript-boilerplate | ---
+++
@@ -7,7 +7,7 @@
content: string;
};
-class Button extends React.Component<IProps, any> {
+class Article extends React.Component<IProps, any> {
public render() {
return (
<ArticleComponent className="markdown-body">
@@ -17,4 +17,4 @@
}
}
-export default Button;
+export default Article; |
8b6ea17e8eeedf1a68fded2ad353b3615bac8cd4 | frontend/src/app/components/hotel-overview/hotels.component.ts | frontend/src/app/components/hotel-overview/hotels.component.ts | import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {HotelService} from './../../shared/hotel.service.ts';
import {Hotel} from '../../model/backend-typings';
@Component({
selector: 'hotels',
directives: [],
providers: [HotelService],
template: require('./hotels.component.html')
})
export class HotelsComponent {
hotels: Observable<Hotel[]>;
constructor(private hotelService: HotelService) {
this.hotels = this.hotelService.getHotelsAuthenticated();
}
}
| import {Component} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {HotelService} from './../../shared/hotel.service.ts';
import {Hotel} from '../../model/backend-typings';
@Component({
selector: 'hotels',
directives: [],
providers: [HotelService],
template: require('./hotels.component.html')
})
export class HotelsComponent {
hotels: Observable<Hotel[]>;
constructor(private hotelService: HotelService) {
this.hotels = this.hotelService.getHotels();
}
}
| Use dummy data - as db access is not working for prod. | Use dummy data - as db access is not working for prod.
| TypeScript | mit | joachimprinzbach/ng2-camp,joachimprinzbach/ng2-camp,joachimprinzbach/ng2-camp,joachimprinzbach/ng2-camp | ---
+++
@@ -13,6 +13,6 @@
hotels: Observable<Hotel[]>;
constructor(private hotelService: HotelService) {
- this.hotels = this.hotelService.getHotelsAuthenticated();
+ this.hotels = this.hotelService.getHotels();
}
} |
fbc2ccceb44629a021e1d80228a83c75c2ef6ef4 | src/definitions/Handler.ts | src/definitions/Handler.ts | import * as Frames from "../definitions/FrameDirectory";
import {Attributes, RequestContext} from "./SkillContext";
export class Frame {
constructor(id: string, entry: ReturnsResponseContext, unhandled: ReturnsFrame, FrameMap: ActionMap) {
this.id = id;
this.entry = entry;
this.actions = FrameMap;
this.unhandled = unhandled;
Frames[id] = this;
}
id: string;
entry: ReturnsResponseContext;
unhandled: ReturnsFrame;
actions: ActionMap;
}
export class ResponseContext {
constructor(model: ResponseModel) {
this.model = model;
}
model: ResponseModel;
}
export class ResponseModel {
speech: string;
reprompt: string;
}
export interface ReturnsResponseContext {
(Attributes: Attributes, Context?: RequestContext): ResponseContext | Promise<ResponseContext>;
}
export interface ActionMap {
[key: string]: ReturnsFrame | undefined;
}
export interface ReturnsFrame {
(Attributes: Attributes, Context?: RequestContext): Frame | Promise<Frame>;
} | import * as Frames from "../definitions/FrameDirectory";
import {Attributes, RequestContext} from "./SkillContext";
export class Frame {
constructor(id: string, entry: ReturnsResponseContext, unhandled: ReturnsFrame, FrameMap: ActionMap) {
this.id = id;
this.entry = entry;
this.actions = FrameMap;
this.unhandled = unhandled;
Frames[id] = this;
}
id: string;
entry: ReturnsResponseContext;
unhandled: ReturnsFrame;
actions: ActionMap;
}
export class ResponseContext {
constructor(model: ResponseModel) {
this.model = model;
}
model: ResponseModel;
}
export class ResponseModel {
speech: string;
reprompt?: string;
}
export interface ReturnsResponseContext {
(Attributes: Attributes, Context?: RequestContext): ResponseContext | Promise<ResponseContext>;
}
export interface ActionMap {
[key: string]: ReturnsFrame | undefined;
}
export interface ReturnsFrame {
(Attributes: Attributes, Context?: RequestContext): Frame | Promise<Frame>;
} | Make reprompt optional in model. | Make reprompt optional in model.
| TypeScript | agpl-3.0 | deegles/cookietime,deegles/cookietime | ---
+++
@@ -30,7 +30,7 @@
export class ResponseModel {
speech: string;
- reprompt: string;
+ reprompt?: string;
}
export interface ReturnsResponseContext { |
86da417b7cc8c342e2a49ff92c457dccd405cf2f | src/utils/general-utils.ts | src/utils/general-utils.ts | import * as toBuffer from 'blob-to-buffer'
// @ts-ignore: no type definitions
import * as domtoimage from 'dom-to-image'
import { remote, shell } from 'electron'
import * as fs from 'fs'
export function saveImage(fileName: string): Promise<string> {
return domtoimage.toBlob(document.body).then((blob: Blob) => {
toBuffer(blob, (__: any, buffer: Buffer) => {
fs.writeFile(fileName, buffer)
})
})
}
export function openLinksInExternalBrowser(): void {
const links = document.querySelectorAll('a[href]')
for (const link of links) {
const url = link.getAttribute('href')
if (url!.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url!)
})
}
}
}
export function setFileMenuItemsEnable(enable: boolean): void {
const menu = remote.Menu.getApplicationMenu()
menu!.items[1].submenu!.items[1].enabled = enable
menu!.items[1].submenu!.items[2].enabled = enable
}
| import * as toBuffer from 'blob-to-buffer'
// @ts-ignore: no type definitions
import * as domtoimage from 'dom-to-image'
import { MenuItem, remote, shell } from 'electron'
import * as fs from 'fs'
export function saveImage(fileName: string): Promise<string> {
return domtoimage.toBlob(document.body).then((blob: Blob) => {
toBuffer(blob, (__: any, buffer: Buffer) => {
fs.writeFile(fileName, buffer)
})
})
}
export function openLinksInExternalBrowser(): void {
const links = document.querySelectorAll('a[href]')
for (const link of links) {
const url = link.getAttribute('href')
if (url!.indexOf('http') === 0) {
link.addEventListener('click', (e) => {
e.preventDefault()
shell.openExternal(url!)
})
}
}
}
export function setFileMenuItemsEnable(enable: boolean): void {
getMenuItem('Export to png...')!.enabled = enable
getMenuItem('Close')!.enabled = enable
}
function getMenuItem(label: string): MenuItem | null {
const menu = remote.Menu.getApplicationMenu()
for (const item of menu!.items) {
const menuItem = item!.submenu!.items.find((i) => i.label === label)
if (menuItem) return menuItem
}
return null
}
| Add method for finding menu items | Add method for finding menu items
| TypeScript | mit | nrlquaker/nfov,nrlquaker/nfov | ---
+++
@@ -1,7 +1,7 @@
import * as toBuffer from 'blob-to-buffer'
// @ts-ignore: no type definitions
import * as domtoimage from 'dom-to-image'
-import { remote, shell } from 'electron'
+import { MenuItem, remote, shell } from 'electron'
import * as fs from 'fs'
export function saveImage(fileName: string): Promise<string> {
@@ -26,7 +26,15 @@
}
export function setFileMenuItemsEnable(enable: boolean): void {
+ getMenuItem('Export to png...')!.enabled = enable
+ getMenuItem('Close')!.enabled = enable
+}
+
+function getMenuItem(label: string): MenuItem | null {
const menu = remote.Menu.getApplicationMenu()
- menu!.items[1].submenu!.items[1].enabled = enable
- menu!.items[1].submenu!.items[2].enabled = enable
+ for (const item of menu!.items) {
+ const menuItem = item!.submenu!.items.find((i) => i.label === label)
+ if (menuItem) return menuItem
+ }
+ return null
} |
e26b8308323916faf9fbab05942a41354cb15428 | src/footures.ts | src/footures.ts | import { getFootures } from './core';
const ALL_FEATURES: Array<string> = [];
function isEnabled(feature: string) {
const specifier: object = getFootures();
if (ALL_FEATURES.indexOf(feature) === -1) {
// Not registered yet,
ALL_FEATURES.push(feature);
}
return !!specifier[feature];
}
/**
* Register features. Allows the admin UI to be generated with checkboxes.
*
* @param {array} features An array of features spread out like a variadic function.
*/
function register(...features) {
const specifier: object = getFootures();
features.forEach((feature) => {
if (ALL_FEATURES.indexOf(feature) === -1) {
ALL_FEATURES.push(feature);
}
});
}
function getAllFootures() {
return ALL_FEATURES;
}
// footures.isEnabled('foo') and footures.register('foo', 'bar');
export default { register, isEnabled, getAllFootures };
export { register, isEnabled, getAllFootures };
| import { getFootures, setFootures } from './core';
class FootureSpecifier {
__all: Array<string>
}
/**
* Adds feature to an internal list. Could be used to show UI.
* @param feature Mark feature as having been used.
*/
function footureUsed(feature: string) {
const specifier: FootureSpecifier = getFootures();
if (!specifier.hasOwnProperty('__all')) {
specifier.__all = [];
}
if (specifier.__all.indexOf(feature) === -1) {
specifier.__all.push(feature);
setFootures(specifier);
}
}
function isEnabled(feature: string) {
const specifier: FootureSpecifier = getFootures();
footureUsed(feature);
return !!specifier[feature];
}
/**
* Register features. Allows the admin UI to be generated with checkboxes.
*
* @param {array} features An array of features spread out like a variadic function.
*/
function register(...features): void {
const specifier: object = getFootures();
features.forEach(footureUsed);
}
function getAllFootures(): Array<String> {
const specifier: FootureSpecifier = getFootures();
return specifier.__all;
}
// footures.isEnabled('foo') and footures.register('foo', 'bar');
export default { register, isEnabled, getAllFootures };
export { register, isEnabled, getAllFootures };
| Use localStorage for *all* footure declarations | Use localStorage for *all* footure declarations
| TypeScript | mit | TypesetIO/footures,TypesetIO/footures | ---
+++
@@ -1,15 +1,31 @@
-import { getFootures } from './core';
+import { getFootures, setFootures } from './core';
-const ALL_FEATURES: Array<string> = [];
+class FootureSpecifier {
+ __all: Array<string>
+}
+
+/**
+ * Adds feature to an internal list. Could be used to show UI.
+ * @param feature Mark feature as having been used.
+ */
+function footureUsed(feature: string) {
+ const specifier: FootureSpecifier = getFootures();
+
+ if (!specifier.hasOwnProperty('__all')) {
+ specifier.__all = [];
+ }
+
+ if (specifier.__all.indexOf(feature) === -1) {
+ specifier.__all.push(feature);
+
+ setFootures(specifier);
+ }
+}
function isEnabled(feature: string) {
- const specifier: object = getFootures();
+ const specifier: FootureSpecifier = getFootures();
- if (ALL_FEATURES.indexOf(feature) === -1) {
- // Not registered yet,
- ALL_FEATURES.push(feature);
- }
-
+ footureUsed(feature);
return !!specifier[feature];
}
@@ -18,18 +34,15 @@
*
* @param {array} features An array of features spread out like a variadic function.
*/
-function register(...features) {
+function register(...features): void {
const specifier: object = getFootures();
- features.forEach((feature) => {
- if (ALL_FEATURES.indexOf(feature) === -1) {
- ALL_FEATURES.push(feature);
- }
- });
+ features.forEach(footureUsed);
}
-function getAllFootures() {
- return ALL_FEATURES;
+function getAllFootures(): Array<String> {
+ const specifier: FootureSpecifier = getFootures();
+ return specifier.__all;
}
// footures.isEnabled('foo') and footures.register('foo', 'bar'); |
d2fee0dd76447068131dc6dc75e4732f5e6b28cd | src/components/App/index.tsx | src/components/App/index.tsx | import * as React from 'react';
import styled from 'styled-components';
import Background from '../Background';
import Envelope from '../Envelope';
import Letter from '../Letter';
import AppProvider from './AppProvider';
const Content = styled.div`
margin: 20px;
@media (min-width: 500px) {
float: right;
width: 400px;
}
`;
const App = () => {
return (
<AppProvider>
<Background />
<Content>
<Envelope />
<Letter />
</Content>
</AppProvider>
);
};
export default App;
| import * as React from 'react';
import styled from 'styled-components';
import Background from '../Background';
import Envelope from '../Envelope';
import Letter from '../Letter';
import AppProvider from './AppProvider';
const Content = styled.div`
margin: 20px;
@media (min-width: 550px) {
float: right;
width: 400px;
}
@media (min-width: 1800px) {
margin-right: 15%;
}
`;
const App = () => {
return (
<AppProvider>
<Background />
<Content>
<Envelope />
<Letter />
</Content>
</AppProvider>
);
};
export default App;
| Move letter in on bigger medias | Move letter in on bigger medias
| TypeScript | mit | mrodalgaard/Personal-Page,mrodalgaard/Personal-Page,mrodalgaard/Personal-Page | ---
+++
@@ -8,9 +8,13 @@
const Content = styled.div`
margin: 20px;
- @media (min-width: 500px) {
+ @media (min-width: 550px) {
float: right;
width: 400px;
+ }
+
+ @media (min-width: 1800px) {
+ margin-right: 15%;
}
`;
|
c871e3f40fb6e8b6dd22c8c08b258790e40b074c | test/service-module/misconfigured-client.test.ts | test/service-module/misconfigured-client.test.ts | import { assert } from 'chai'
import feathersVuex from '../../src/index'
import feathers from '@feathersjs/client'
import auth from '@feathersjs/authentication-client'
const feathersClient = feathers().configure(auth())
describe('Service Module - Bad Client Setup', () => {
it('throws an error when no client transport plugin is registered', () => {
const { makeServicePlugin, BaseModel } = feathersVuex(feathersClient, {
serverAlias: 'misconfigured'
})
class MisconfiguredTask extends BaseModel {
public static test: boolean = true
}
try {
makeServicePlugin({
Model: MisconfiguredTask,
service: feathersClient.service('misconfigured-todos')
})
} catch (error) {
assert(
error.message.includes(
'No service was provided. If you passed one in, check that you have configured a transport plugin on the Feathers Client. Make sure you use the client version of the transport`.'
),
'got an error with a misconfigured client'
)
}
})
})
| import { assert } from 'chai'
import feathersVuex from '../../src/index'
import feathers from '@feathersjs/client'
import auth from '@feathersjs/authentication-client'
const feathersClient = feathers().configure(auth())
describe('Service Module - Bad Client Setup', () => {
it('throws an error when no client transport plugin is registered', () => {
const { makeServicePlugin, BaseModel } = feathersVuex(feathersClient, {
serverAlias: 'misconfigured'
})
class MisconfiguredTask extends BaseModel {
public static test: boolean = true
}
try {
makeServicePlugin({
Model: MisconfiguredTask,
service: feathersClient.service('misconfigured-todos')
})
} catch (error) {
assert(
error.message.includes(
'No service was provided. If you passed one in, check that you have configured a transport plugin on the Feathers Client. Make sure you use the client version of the transport.'
),
'got an error with a misconfigured client'
)
}
})
})
| Remove extra character from error | Remove extra character from error
| TypeScript | mit | feathers-plus/feathers-vuex,feathers-plus/feathers-vuex | ---
+++
@@ -22,7 +22,7 @@
} catch (error) {
assert(
error.message.includes(
- 'No service was provided. If you passed one in, check that you have configured a transport plugin on the Feathers Client. Make sure you use the client version of the transport`.'
+ 'No service was provided. If you passed one in, check that you have configured a transport plugin on the Feathers Client. Make sure you use the client version of the transport.'
),
'got an error with a misconfigured client'
) |
056886f0a49f68d271f3bd9963daa81c525fa3ba | lib/base/env.ts | lib/base/env.ts | /// <reference path="../../typings/DefinitelyTyped/node/node.d.ts" />
// env.ts provides functions to query the host Javascript
// environment
// This module has no dependencies to facilitate easier re-use across
// different JS environments
/** Returns true if running in the main browser
* environment with DOM access.
*/
export function isBrowser() {
return typeof window != 'undefined';
}
/** Returns true if running from within NodeJS
* (or a compatible environment)
*/
export function isNodeJS() {
return process && process.version;
}
/** Returns true if running from a Web Worker context
* in a browser (or a compatible environment)
*/
export function isWebWorker() {
return typeof importScripts != 'undefined';
}
/** Returns true if running as a page script
* in a Firefox Jetpack add-on
*/
export function isFirefoxAddon() {
return isBrowser() && window.location.protocol == 'resource:';
}
/** Returns true if running as a content or
* background script in a Google Chrome extension
*/
export function isChromeExtension() {
return isBrowser() &&
typeof chrome !== 'undefined' &&
typeof chrome.extension !== 'undefined';
}
| /// <reference path="../../typings/DefinitelyTyped/chrome/chrome.d.ts" />
/// <reference path="../../typings/DefinitelyTyped/node/node.d.ts" />
// env.ts provides functions to query the host Javascript
// environment
// This module has no dependencies to facilitate easier re-use across
// different JS environments
/** Returns true if running in the main browser
* environment with DOM access.
*/
export function isBrowser() {
return typeof window != 'undefined';
}
/** Returns true if running from within NodeJS
* (or a compatible environment)
*/
export function isNodeJS() {
return process && process.version;
}
/** Returns true if running from a Web Worker context
* in a browser (or a compatible environment)
*/
export function isWebWorker() {
return typeof importScripts != 'undefined';
}
/** Returns true if running as a page script
* in a Firefox Jetpack add-on
*/
export function isFirefoxAddon() {
return isBrowser() && window.location.protocol == 'resource:';
}
/** Returns true if running as a content or
* background script in a Google Chrome extension
*/
export function isChromeExtension() {
return isBrowser() &&
typeof chrome !== 'undefined' &&
typeof chrome.extension !== 'undefined';
}
| Add missing chrome definitions import | Add missing chrome definitions import
| TypeScript | bsd-3-clause | robertknight/passcards,robertknight/passcards,robertknight/passcards,robertknight/passcards | ---
+++
@@ -1,3 +1,4 @@
+/// <reference path="../../typings/DefinitelyTyped/chrome/chrome.d.ts" />
/// <reference path="../../typings/DefinitelyTyped/node/node.d.ts" />
// env.ts provides functions to query the host Javascript |
232a00acecf14fe3aa98980f8c781534a0d02b19 | javascript/src/TokenExceptions.ts | javascript/src/TokenExceptions.ts | import IToken from './IToken'
import { GherkinException } from './Errors'
export class UnexpectedTokenException extends GherkinException {
public static create<TokenType>(token: IToken<TokenType>, expectedTokenTypes: string[]) {
const message = `expected: ${expectedTokenTypes.join(
', '
)}, got '${token.getTokenValue().trim()}'`
const location = tokenLocation(token)
return this._create(message, location)
}
}
export class UnexpectedEOFException extends GherkinException {
public static create<TokenType>(token: IToken<TokenType>, expectedTokenTypes: string[]) {
const message = `unexpected end of file, expected: ${expectedTokenTypes.join(', ')}`
const location = tokenLocation(token)
return this._create(message, location)
}
}
function tokenLocation<TokenType>(token: IToken<TokenType>) {
return token.location && token.location.line && token.line && token.line.indent !== undefined
? {
line: token.location.line,
column: token.line.indent + 1,
}
: token.location
}
| import IToken from './IToken'
import { GherkinException } from './Errors'
export class UnexpectedTokenException extends GherkinException {
public static create<TokenType>(token: IToken<TokenType>, expectedTokenTypes: string[]) {
const message = `expected: ${expectedTokenTypes.join(', ')}, got '${token
.getTokenValue()
.trim()}'`
const location = tokenLocation(token)
return this._create(message, location)
}
}
export class UnexpectedEOFException extends GherkinException {
public static create<TokenType>(token: IToken<TokenType>, expectedTokenTypes: string[]) {
const message = `unexpected end of file, expected: ${expectedTokenTypes.join(', ')}`
const location = tokenLocation(token)
return this._create(message, location)
}
}
function tokenLocation<TokenType>(token: IToken<TokenType>) {
return token.location && token.location.line && token.line && token.line.indent !== undefined
? {
line: token.location.line,
column: token.line.indent + 1,
}
: token.location
}
| Downgrade hast-util-sanitize to 3.0.2 to avoid ESM errors | Downgrade hast-util-sanitize to 3.0.2 to avoid ESM errors
| TypeScript | mit | cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin,cucumber/gherkin | ---
+++
@@ -3,9 +3,9 @@
export class UnexpectedTokenException extends GherkinException {
public static create<TokenType>(token: IToken<TokenType>, expectedTokenTypes: string[]) {
- const message = `expected: ${expectedTokenTypes.join(
- ', '
- )}, got '${token.getTokenValue().trim()}'`
+ const message = `expected: ${expectedTokenTypes.join(', ')}, got '${token
+ .getTokenValue()
+ .trim()}'`
const location = tokenLocation(token)
|
4772da40625c0239770d1f5db5563c9e3ca9f8f4 | src/app/classes/activity.class.ts | src/app/classes/activity.class.ts | export class Activity {
id: string;
name: string;
shortDescription: string;
description: string;
} | import { Injectable } from '@angular/core';
@Injectable()
export class Activity {
id: string;
name: string;
shortDescription: string;
description: string;
constructor(
id: string,
name: string,
shortDescription: string,
description: string,
) { }
} | Add Injectable decorator to Activity | Add Injectable decorator to Activity
| TypeScript | mit | benformosa/squashtrainerapp,benformosa/squashtrainerapp,benformosa/squashtrainerapp | ---
+++
@@ -1,6 +1,16 @@
+import { Injectable } from '@angular/core';
+
+@Injectable()
export class Activity {
id: string;
name: string;
shortDescription: string;
description: string;
+
+ constructor(
+ id: string,
+ name: string,
+ shortDescription: string,
+ description: string,
+ ) { }
} |
568c08c6344ea1467d9febd931e729b85843c9ab | Dialog.d.ts | Dialog.d.ts | import * as React from 'react'
export interface DialogProps extends React.DOMAttributes {
actions?: React.ReactElement<any> | React.ReactElement<any>[];
actionsContainerClassName?: string;
actionsContainerStyle?: React.CSSProperties;
autoDetectWindowHeight?: boolean;
autoScrollBodyContent?: boolean;
bodyClassName?: string;
bodyStyle?: React.CSSProperties;
className?: string;
contentClassName?: string;
contentStyle?: React.CSSProperties;
modal?: boolean;
onRequestClose?: (buttonClicked: boolean) => void;
open: boolean;
overlayClassName?: string;
overlayStyle?: React.CSSProperties;
repositionOnUpdate?: boolean;
style?: React.CSSProperties;
title?: React.ReactNode;
titleClassName?: string;
titleStyle?: React.CSSProperties;
}
export default class Dialog extends React.Component<DialogProps, {}> {
}
| import * as React from 'react'
export interface DialogProps {
actions?: React.ReactElement<any> | React.ReactElement<any>[];
actionsContainerClassName?: string;
actionsContainerStyle?: React.CSSProperties;
autoDetectWindowHeight?: boolean;
autoScrollBodyContent?: boolean;
bodyClassName?: string;
bodyStyle?: React.CSSProperties;
className?: string;
contentClassName?: string;
contentStyle?: React.CSSProperties;
modal?: boolean;
onRequestClose?: (buttonClicked: boolean) => void;
open: boolean;
overlayClassName?: string;
overlayStyle?: React.CSSProperties;
repositionOnUpdate?: boolean;
style?: React.CSSProperties;
title?: React.ReactNode;
titleClassName?: string;
titleStyle?: React.CSSProperties;
}
export default class Dialog extends React.Component<DialogProps, {}> {
}
| Remove DOM attributes from prop interface | Remove DOM attributes from prop interface
| TypeScript | mit | mattiamanzati/typings-material-ui,mattiamanzati/typings-material-ui | ---
+++
@@ -1,6 +1,6 @@
import * as React from 'react'
-export interface DialogProps extends React.DOMAttributes {
+export interface DialogProps {
actions?: React.ReactElement<any> | React.ReactElement<any>[];
actionsContainerClassName?: string;
actionsContainerStyle?: React.CSSProperties; |
ffc616163340248c91dbddc0f5ece3acdc136421 | colorbrewer/colorbrewer-tests.ts | colorbrewer/colorbrewer-tests.ts | /// <reference path="./colorbrewer.d.ts" />
const accent3: string[] = colorbrewer.Accent[3];
const accent4: string[] = colorbrewer.Accent[4];
const accent5: string[] = colorbrewer.Accent[5];
const accent6: string[] = colorbrewer.Accent[6];
const accent7: string[] = colorbrewer.Accent[7];
const accent8: string[] = colorbrewer.Accent[8];
| /// <reference path="./colorbrewer.d.ts" />
var accent3: string[] = colorbrewer.Accent[3];
var accent4: string[] = colorbrewer.Accent[4];
var accent5: string[] = colorbrewer.Accent[5];
var accent6: string[] = colorbrewer.Accent[6];
var accent7: string[] = colorbrewer.Accent[7];
var accent8: string[] = colorbrewer.Accent[8];
| Fix tests. 'const' not available | Fix tests. 'const' not available
| TypeScript | mit | nitintutlani/DefinitelyTyped,Zenorbi/DefinitelyTyped,spearhead-ea/DefinitelyTyped,florentpoujol/DefinitelyTyped,jasonswearingen/DefinitelyTyped,zalamtech/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,hesselink/DefinitelyTyped,RedSeal-co/DefinitelyTyped,abbasmhd/DefinitelyTyped,optical/DefinitelyTyped,paulmorphy/DefinitelyTyped,RX14/DefinitelyTyped,gregoryagu/DefinitelyTyped,rerezz/DefinitelyTyped,danfma/DefinitelyTyped,behzad888/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,rschmukler/DefinitelyTyped,Carreau/DefinitelyTyped,grahammendick/DefinitelyTyped,pocke/DefinitelyTyped,algorithme/DefinitelyTyped,bennett000/DefinitelyTyped,olemp/DefinitelyTyped,magny/DefinitelyTyped,jiaz/DefinitelyTyped,pafflique/DefinitelyTyped,PopSugar/DefinitelyTyped,zuzusik/DefinitelyTyped,use-strict/DefinitelyTyped,richardTowers/DefinitelyTyped,smrq/DefinitelyTyped,aldo-roman/DefinitelyTyped,takenet/DefinitelyTyped,georgemarshall/DefinitelyTyped,moonpyk/DefinitelyTyped,muenchdo/DefinitelyTyped,jimthedev/DefinitelyTyped,newclear/DefinitelyTyped,davidsidlinger/DefinitelyTyped,Seltzer/DefinitelyTyped,bennett000/DefinitelyTyped,dwango-js/DefinitelyTyped,nobuoka/DefinitelyTyped,pocesar/DefinitelyTyped,flyfishMT/DefinitelyTyped,mcliment/DefinitelyTyped,eekboom/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,scsouthw/DefinitelyTyped,jsaelhof/DefinitelyTyped,biomassives/DefinitelyTyped,yuit/DefinitelyTyped,Zzzen/DefinitelyTyped,mjjames/DefinitelyTyped,mjjames/DefinitelyTyped,glenndierckx/DefinitelyTyped,greglo/DefinitelyTyped,chrismbarr/DefinitelyTyped,martinduparc/DefinitelyTyped,bruennijs/DefinitelyTyped,UzEE/DefinitelyTyped,Litee/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,Chris380/DefinitelyTyped,takfjt/DefinitelyTyped,bkristensen/DefinitelyTyped,dsebastien/DefinitelyTyped,kuon/DefinitelyTyped,alexdresko/DefinitelyTyped,KonaTeam/DefinitelyTyped,martinduparc/DefinitelyTyped,benishouga/DefinitelyTyped,jtlan/DefinitelyTyped,superduper/DefinitelyTyped,unknownloner/DefinitelyTyped,dydek/DefinitelyTyped,egeland/DefinitelyTyped,haskellcamargo/DefinitelyTyped,xStrom/DefinitelyTyped,QuatroCode/DefinitelyTyped,greglockwood/DefinitelyTyped,gildorwang/DefinitelyTyped,dmoonfire/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,yuit/DefinitelyTyped,goaty92/DefinitelyTyped,xswordsx/DefinitelyTyped,subjectix/DefinitelyTyped,amanmahajan7/DefinitelyTyped,sclausen/DefinitelyTyped,psnider/DefinitelyTyped,mattanja/DefinitelyTyped,drinchev/DefinitelyTyped,gandjustas/DefinitelyTyped,eugenpodaru/DefinitelyTyped,hellopao/DefinitelyTyped,dydek/DefinitelyTyped,sledorze/DefinitelyTyped,icereed/DefinitelyTyped,theyelllowdart/DefinitelyTyped,brentonhouse/DefinitelyTyped,syuilo/DefinitelyTyped,stacktracejs/DefinitelyTyped,adamcarr/DefinitelyTyped,mrk21/DefinitelyTyped,subash-a/DefinitelyTyped,furny/DefinitelyTyped,musakarakas/DefinitelyTyped,nmalaguti/DefinitelyTyped,onecentlin/DefinitelyTyped,aqua89/DefinitelyTyped,ryan10132/DefinitelyTyped,aroder/DefinitelyTyped,AgentME/DefinitelyTyped,glenndierckx/DefinitelyTyped,Lorisu/DefinitelyTyped,cvrajeesh/DefinitelyTyped,trystanclarke/DefinitelyTyped,lekaha/DefinitelyTyped,progre/DefinitelyTyped,wbuchwalter/DefinitelyTyped,rolandzwaga/DefinitelyTyped,jaysoo/DefinitelyTyped,DenEwout/DefinitelyTyped,isman-usoh/DefinitelyTyped,danfma/DefinitelyTyped,dariajung/DefinitelyTyped,schmuli/DefinitelyTyped,alvarorahul/DefinitelyTyped,tjoskar/DefinitelyTyped,blink1073/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,timjk/DefinitelyTyped,rschmukler/DefinitelyTyped,adammartin1981/DefinitelyTyped,nycdotnet/DefinitelyTyped,esperco/DefinitelyTyped,olivierlemasle/DefinitelyTyped,schmuli/DefinitelyTyped,Riron/DefinitelyTyped,dmoonfire/DefinitelyTyped,brettle/DefinitelyTyped,digitalpixies/DefinitelyTyped,timramone/DefinitelyTyped,chbrown/DefinitelyTyped,martinduparc/DefinitelyTyped,arusakov/DefinitelyTyped,stanislavHamara/DefinitelyTyped,sandersky/DefinitelyTyped,evandrewry/DefinitelyTyped,chrootsu/DefinitelyTyped,lucyhe/DefinitelyTyped,Ptival/DefinitelyTyped,davidpricedev/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,bjfletcher/DefinitelyTyped,onecentlin/DefinitelyTyped,Karabur/DefinitelyTyped,arcticwaters/DefinitelyTyped,HPFOD/DefinitelyTyped,schmuli/DefinitelyTyped,lbesson/DefinitelyTyped,gcastre/DefinitelyTyped,shahata/DefinitelyTyped,stylelab-io/DefinitelyTyped,bdoss/DefinitelyTyped,MarlonFan/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,quantumman/DefinitelyTyped,igorraush/DefinitelyTyped,vpineda1996/DefinitelyTyped,nfriend/DefinitelyTyped,benishouga/DefinitelyTyped,jraymakers/DefinitelyTyped,jesseschalken/DefinitelyTyped,pocesar/DefinitelyTyped,frogcjn/DefinitelyTyped,damianog/DefinitelyTyped,hx0day/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,teves-castro/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,jimthedev/DefinitelyTyped,mshmelev/DefinitelyTyped,abner/DefinitelyTyped,behzad888/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,ml-workshare/DefinitelyTyped,chrootsu/DefinitelyTyped,DeadAlready/DefinitelyTyped,YousefED/DefinitelyTyped,the41/DefinitelyTyped,samwgoldman/DefinitelyTyped,mvarblow/DefinitelyTyped,bdoss/DefinitelyTyped,gorcz/DefinitelyTyped,mattanja/DefinitelyTyped,gyohk/DefinitelyTyped,cherrydev/DefinitelyTyped,dumbmatter/DefinitelyTyped,Dominator008/DefinitelyTyped,OfficeDev/DefinitelyTyped,whoeverest/DefinitelyTyped,raijinsetsu/DefinitelyTyped,masonkmeyer/DefinitelyTyped,Trapulo/DefinitelyTyped,tan9/DefinitelyTyped,mareek/DefinitelyTyped,rcchen/DefinitelyTyped,stacktracejs/DefinitelyTyped,almstrand/DefinitelyTyped,AgentME/DefinitelyTyped,mareek/DefinitelyTyped,gcastre/DefinitelyTyped,wcomartin/DefinitelyTyped,laball/DefinitelyTyped,dsebastien/DefinitelyTyped,abbasmhd/DefinitelyTyped,Saneyan/DefinitelyTyped,laco0416/DefinitelyTyped,egeland/DefinitelyTyped,ajtowf/DefinitelyTyped,TheBay0r/DefinitelyTyped,LordJZ/DefinitelyTyped,HPFOD/DefinitelyTyped,hellopao/DefinitelyTyped,GodsBreath/DefinitelyTyped,DustinWehr/DefinitelyTyped,jacqt/DefinitelyTyped,xStrom/DefinitelyTyped,georgemarshall/DefinitelyTyped,Garciat/DefinitelyTyped,Syati/DefinitelyTyped,vagarenko/DefinitelyTyped,isman-usoh/DefinitelyTyped,M-Zuber/DefinitelyTyped,ciriarte/DefinitelyTyped,smrq/DefinitelyTyped,dreampulse/DefinitelyTyped,fnipo/DefinitelyTyped,scriby/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,mattblang/DefinitelyTyped,jimthedev/DefinitelyTyped,zhiyiting/DefinitelyTyped,omidkrad/DefinitelyTyped,felipe3dfx/DefinitelyTyped,arma-gast/DefinitelyTyped,fredgalvao/DefinitelyTyped,arma-gast/DefinitelyTyped,sixinli/DefinitelyTyped,Karabur/DefinitelyTyped,zensh/DefinitelyTyped,QuatroCode/DefinitelyTyped,EnableSoftware/DefinitelyTyped,GregOnNet/DefinitelyTyped,chadoliver/DefinitelyTyped,forumone/DefinitelyTyped,Ptival/DefinitelyTyped,nodeframe/DefinitelyTyped,esperco/DefinitelyTyped,bardt/DefinitelyTyped,Zorgatone/DefinitelyTyped,abner/DefinitelyTyped,Minishlink/DefinitelyTyped,reppners/DefinitelyTyped,greglo/DefinitelyTyped,opichals/DefinitelyTyped,tomtarrot/DefinitelyTyped,alvarorahul/DefinitelyTyped,shlomiassaf/DefinitelyTyped,Penryn/DefinitelyTyped,ayanoin/DefinitelyTyped,dflor003/DefinitelyTyped,JaminFarr/DefinitelyTyped,vagarenko/DefinitelyTyped,hor-crux/DefinitelyTyped,florentpoujol/DefinitelyTyped,scriby/DefinitelyTyped,applesaucers/lodash-invokeMap,robertbaker/DefinitelyTyped,OpenMaths/DefinitelyTyped,innerverse/DefinitelyTyped,rushi216/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,Dominator008/DefinitelyTyped,tinganho/DefinitelyTyped,nainslie/DefinitelyTyped,zuzusik/DefinitelyTyped,scatcher/DefinitelyTyped,nycdotnet/DefinitelyTyped,magny/DefinitelyTyped,aindlq/DefinitelyTyped,optical/DefinitelyTyped,erosb/DefinitelyTyped,kanreisa/DefinitelyTyped,Penryn/DefinitelyTyped,bluong/DefinitelyTyped,MugeSo/DefinitelyTyped,Gmulti/DefinitelyTyped,nakakura/DefinitelyTyped,AgentME/DefinitelyTyped,mwain/DefinitelyTyped,teves-castro/DefinitelyTyped,shovon/DefinitelyTyped,EnableSoftware/DefinitelyTyped,drinchev/DefinitelyTyped,mszczepaniak/DefinitelyTyped,zuzusik/DefinitelyTyped,kalloc/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,arusakov/DefinitelyTyped,robert-voica/DefinitelyTyped,ErykB2000/DefinitelyTyped,nmalaguti/DefinitelyTyped,micurs/DefinitelyTyped,johan-gorter/DefinitelyTyped,nojaf/DefinitelyTyped,wilfrem/DefinitelyTyped,nseckinoral/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,emanuelhp/DefinitelyTyped,alexdresko/DefinitelyTyped,ashwinr/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,tdmckinn/DefinitelyTyped,chrismbarr/DefinitelyTyped,axelcostaspena/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,alainsahli/DefinitelyTyped,Almouro/DefinitelyTyped,benishouga/DefinitelyTyped,psnider/DefinitelyTyped,rockclimber90/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,RX14/DefinitelyTyped,jraymakers/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,aciccarello/DefinitelyTyped,Litee/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,sledorze/DefinitelyTyped,syuilo/DefinitelyTyped,nobuoka/DefinitelyTyped,rolandzwaga/DefinitelyTyped,robl499/DefinitelyTyped,chrilith/DefinitelyTyped,Bobjoy/DefinitelyTyped,borisyankov/DefinitelyTyped,OpenMaths/DefinitelyTyped,bencoveney/DefinitelyTyped,Pro/DefinitelyTyped,minodisk/DefinitelyTyped,elisee/DefinitelyTyped,applesaucers/lodash-invokeMap,kmeurer/DefinitelyTyped,amanmahajan7/DefinitelyTyped,minodisk/DefinitelyTyped,mcrawshaw/DefinitelyTyped,pwelter34/DefinitelyTyped,trystanclarke/DefinitelyTyped,mhegazy/DefinitelyTyped,paxibay/DefinitelyTyped,mweststrate/DefinitelyTyped,igorsechyn/DefinitelyTyped,YousefED/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,CSharpFan/DefinitelyTyped,jeffbcross/DefinitelyTyped,donnut/DefinitelyTyped,bpowers/DefinitelyTyped,Zzzen/DefinitelyTyped,arusakov/DefinitelyTyped,Ridermansb/DefinitelyTyped,damianog/DefinitelyTyped,lbguilherme/DefinitelyTyped,mendix/DefinitelyTyped,dragouf/DefinitelyTyped,benliddicott/DefinitelyTyped,lightswitch05/DefinitelyTyped,zuohaocheng/DefinitelyTyped,aciccarello/DefinitelyTyped,tscho/DefinitelyTyped,takenet/DefinitelyTyped,tan9/DefinitelyTyped,giggio/DefinitelyTyped,stephenjelfs/DefinitelyTyped,daptiv/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,newclear/DefinitelyTyped,philippstucki/DefinitelyTyped,wilfrem/DefinitelyTyped,acepoblete/DefinitelyTyped,Pro/DefinitelyTyped,manekovskiy/DefinitelyTyped,deeleman/DefinitelyTyped,abmohan/DefinitelyTyped,Jwsonic/DefinitelyTyped,gandjustas/DefinitelyTyped,ecramer89/DefinitelyTyped,nainslie/DefinitelyTyped,ashwinr/DefinitelyTyped,IAPark/DefinitelyTyped,jasonswearingen/DefinitelyTyped,PascalSenn/DefinitelyTyped,Nemo157/DefinitelyTyped,herrmanno/DefinitelyTyped,TildaLabs/DefinitelyTyped,billccn/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,Kuniwak/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,hatz48/DefinitelyTyped,subash-a/DefinitelyTyped,pwelter34/DefinitelyTyped,rcchen/DefinitelyTyped,ajtowf/DefinitelyTyped,one-pieces/DefinitelyTyped,brainded/DefinitelyTyped,NCARalph/DefinitelyTyped,UzEE/DefinitelyTyped,gdi2290/DefinitelyTyped,fearthecowboy/DefinitelyTyped,sclausen/DefinitelyTyped,markogresak/DefinitelyTyped,MidnightDesign/DefinitelyTyped,tarruda/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,Mek7/DefinitelyTyped,musically-ut/DefinitelyTyped,mhegazy/DefinitelyTyped,Syati/DefinitelyTyped,vincentw56/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,teddyward/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,drillbits/DefinitelyTyped,WritingPanda/DefinitelyTyped,hellopao/DefinitelyTyped,pocesar/DefinitelyTyped,basp/DefinitelyTyped,pkhayundi/DefinitelyTyped,hafenr/DefinitelyTyped,bilou84/DefinitelyTyped,georgemarshall/DefinitelyTyped,donnut/DefinitelyTyped,Dashlane/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,psnider/DefinitelyTyped,nitintutlani/DefinitelyTyped,tboyce/DefinitelyTyped,DeluxZ/DefinitelyTyped,michalczukm/DefinitelyTyped,angelobelchior8/DefinitelyTyped,nakakura/DefinitelyTyped,lseguin42/DefinitelyTyped,emanuelhp/DefinitelyTyped,chocolatechipui/DefinitelyTyped,maxlang/DefinitelyTyped,jeremyhayes/DefinitelyTyped,gyohk/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,jsaelhof/DefinitelyTyped,mshmelev/DefinitelyTyped,frogcjn/DefinitelyTyped,Zorgatone/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,ducin/DefinitelyTyped,corps/DefinitelyTyped,nelsonmorais/DefinitelyTyped,musicist288/DefinitelyTyped,borisyankov/DefinitelyTyped,syntax42/DefinitelyTyped,munxar/DefinitelyTyped,Dashlane/DefinitelyTyped,olemp/DefinitelyTyped,fredgalvao/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,jbrantly/DefinitelyTyped,mcrawshaw/DefinitelyTyped,aciccarello/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,duongphuhiep/DefinitelyTyped,stephenjelfs/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,shlomiassaf/DefinitelyTyped,alextkachman/DefinitelyTyped,HereSinceres/DefinitelyTyped,elisee/DefinitelyTyped,maglar0/DefinitelyTyped,nabeix/DefinitelyTyped,reppners/DefinitelyTyped,raijinsetsu/DefinitelyTyped,xica/DefinitelyTyped,gedaiu/DefinitelyTyped,vsavkin/DefinitelyTyped,progre/DefinitelyTyped,tigerxy/DefinitelyTyped,philippstucki/DefinitelyTyped,flyfishMT/DefinitelyTyped,dpsthree/DefinitelyTyped,Fraegle/DefinitelyTyped,hatz48/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,vasek17/DefinitelyTyped,paulmorphy/DefinitelyTyped,leoromanovsky/DefinitelyTyped,Seikho/DefinitelyTyped,arcticwaters/DefinitelyTyped,uestcNaldo/DefinitelyTyped,use-strict/DefinitelyTyped,davidpricedev/DefinitelyTyped,MugeSo/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,Deathspike/DefinitelyTyped,hiraash/DefinitelyTyped,wkrueger/DefinitelyTyped,Pipe-shen/DefinitelyTyped,johan-gorter/DefinitelyTyped,mattblang/DefinitelyTyped,alextkachman/DefinitelyTyped,Shiak1/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,amir-arad/DefinitelyTyped | ---
+++
@@ -1,8 +1,8 @@
/// <reference path="./colorbrewer.d.ts" />
-const accent3: string[] = colorbrewer.Accent[3];
-const accent4: string[] = colorbrewer.Accent[4];
-const accent5: string[] = colorbrewer.Accent[5];
-const accent6: string[] = colorbrewer.Accent[6];
-const accent7: string[] = colorbrewer.Accent[7];
-const accent8: string[] = colorbrewer.Accent[8];
+var accent3: string[] = colorbrewer.Accent[3];
+var accent4: string[] = colorbrewer.Accent[4];
+var accent5: string[] = colorbrewer.Accent[5];
+var accent6: string[] = colorbrewer.Accent[6];
+var accent7: string[] = colorbrewer.Accent[7];
+var accent8: string[] = colorbrewer.Accent[8]; |
edf2bd560299c4033cf2e3ff19f75fd0e082655b | types/react-input-mask/react-input-mask-tests.tsx | types/react-input-mask/react-input-mask-tests.tsx | import ReactInputMask from 'react-input-mask';
import * as React from 'react';
<div>
<ReactInputMask mask="+4\9 99 999 99" maskChar={null} />
<ReactInputMask mask="+7 (999) 999-99-99" />
<ReactInputMask mask="99-99-9999" defaultValue= "13-00-2017" />
<ReactInputMask mask="99/99/9999" placeholder= "Enter birthdate" />
<ReactInputMask mask="+7 (999) 999-99-99" />
</div>;
| import ReactInputMask from 'react-input-mask';
import * as React from 'react';
let ref: HTMLInputElement | null = null;
<div>
<ReactInputMask mask="+4\9 99 999 99" maskChar={null} />
<ReactInputMask mask="+7 (999) 999-99-99" />
<ReactInputMask mask="99-99-9999" defaultValue= "13-00-2017" />
<ReactInputMask mask="99/99/9999" placeholder= "Enter birthdate" />
<ReactInputMask mask="+7 (999) 999-99-99" />
<ReactInputMask mask="+7 (999) 999-99-99" inputRef={(node) => ref = node} />
</div>;
| Add test for inputRef prop | Add test for inputRef prop
| TypeScript | mit | georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,magny/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,rolandzwaga/DefinitelyTyped,mcliment/DefinitelyTyped,AgentME/DefinitelyTyped,dsebastien/DefinitelyTyped,one-pieces/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,markogresak/DefinitelyTyped,rolandzwaga/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped | ---
+++
@@ -1,5 +1,7 @@
import ReactInputMask from 'react-input-mask';
import * as React from 'react';
+
+let ref: HTMLInputElement | null = null;
<div>
<ReactInputMask mask="+4\9 99 999 99" maskChar={null} />
@@ -7,4 +9,5 @@
<ReactInputMask mask="99-99-9999" defaultValue= "13-00-2017" />
<ReactInputMask mask="99/99/9999" placeholder= "Enter birthdate" />
<ReactInputMask mask="+7 (999) 999-99-99" />
+ <ReactInputMask mask="+7 (999) 999-99-99" inputRef={(node) => ref = node} />
</div>; |
c98bfb1f2567c04a52586bf423c707c4f61ab777 | app/scripts/components/table-react/TableHeader.tsx | app/scripts/components/table-react/TableHeader.tsx | import * as React from 'react';
import './TableHeader.scss';
import { Column, Sorting } from './types';
interface Props {
columns: Column[];
onSortClick?: (orderField: string, currentSorting: Sorting) => any;
currentSorting?: Sorting;
}
const TableHeader = ({ columns, onSortClick, currentSorting }: Props) => (
<thead>
<tr>
{columns.map((column, index) => (
<th key={index} className={column.orderField ? column.className += ' sorting-column' : column.className}
onClick={column.orderField && (() => onSortClick(column.orderField, currentSorting))}>
{column.title}
{(column.orderField && (currentSorting && column.orderField !== currentSorting.field)) && <i className="fa fa-sort m-l-xs"/>}
{(currentSorting && column.orderField === currentSorting.field) && <i className={`fa fa-sort-${currentSorting.mode} m-l-xs`}/>}
</th>
))}
</tr>
</thead>
);
export default TableHeader;
| import * as classNames from 'classnames';
import * as React from 'react';
import './TableHeader.scss';
import { Column, Sorting } from './types';
interface Props {
columns: Column[];
onSortClick?: (orderField: string, currentSorting: Sorting) => any;
currentSorting?: Sorting;
}
const TableHeader = ({ columns, onSortClick, currentSorting }: Props) => (
<thead>
<tr>
{columns.map((column, index) => (
<th key={index} className={classNames(column.className, column.orderField && 'sorting-column')}
onClick={column.orderField && (() => onSortClick(column.orderField, currentSorting))}>
{column.title}
{(column.orderField && (currentSorting && column.orderField !== currentSorting.field)) && <i className="fa fa-sort m-l-xs"/>}
{(currentSorting && column.orderField === currentSorting.field) && <i className={`fa fa-sort-${currentSorting.mode} m-l-xs`}/>}
</th>
))}
</tr>
</thead>
);
export default TableHeader;
| Fix column class for React table: avoid table options modification. | Fix column class for React table: avoid table options modification.
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | ---
+++
@@ -1,3 +1,4 @@
+import * as classNames from 'classnames';
import * as React from 'react';
import './TableHeader.scss';
@@ -14,7 +15,7 @@
<thead>
<tr>
{columns.map((column, index) => (
- <th key={index} className={column.orderField ? column.className += ' sorting-column' : column.className}
+ <th key={index} className={classNames(column.className, column.orderField && 'sorting-column')}
onClick={column.orderField && (() => onSortClick(column.orderField, currentSorting))}>
{column.title}
{(column.orderField && (currentSorting && column.orderField !== currentSorting.field)) && <i className="fa fa-sort m-l-xs"/>} |
8c97a06d4faf943d28c6f061af61ec9f6cd0342c | react-relay/react-relay-tests.tsx | react-relay/react-relay-tests.tsx | import * as React from "react"
import * as Relay from "react-relay"
interface Props {
text: string
userId: string
}
interface Response {
}
export default class AddTweetMutation extends Relay.Mutation<Props, Response> {
getMutation () {
return Relay.QL`mutation{addTweet}`
}
getFatQuery () {
return Relay.QL`
fragment on AddTweetPayload {
tweetEdge
user
}
`
}
getConfigs () {
return [{
type: "RANGE_ADD",
parentName: "user",
parentID: this.props.userId,
connectionName: "tweets",
edgeName: "tweetEdge",
rangeBehaviors: {
"": "append",
},
}]
}
getVariables () {
return this.props
}
}
interface ArtworkProps {
artwork: {
title: string
}
}
class Artwork extends React.Component<ArtworkProps, null> {
render() {
return <p>{this.props.artwork.title}</p>
}
}
const ArtworkContainer = Relay.createContainer(Artwork, {
fragments: {
artwork: () => Relay.QL`
fragment on Artwork {
title
}
`
}
})
class StubbedArtwork extends React.Component<null, null> {
render() {
return <ArtworkContainer artwork={{ title: "CHAMPAGNE FORMICA FLAG" }} />
}
}
| import * as React from "react"
import * as Relay from "react-relay"
interface Props {
text: string
userId: string
}
interface Response {
}
export default class AddTweetMutation extends Relay.Mutation<Props, Response> {
getMutation () {
return Relay.QL`mutation{addTweet}`
}
getFatQuery () {
return Relay.QL`
fragment on AddTweetPayload {
tweetEdge
user
}
`
}
getConfigs () {
return [{
type: "RANGE_ADD",
parentName: "user",
parentID: this.props.userId,
connectionName: "tweets",
edgeName: "tweetEdge",
rangeBehaviors: {
"": "append",
},
}]
}
getVariables () {
return this.props
}
}
interface ArtworkProps {
artwork: {
title: string
},
relay: Relay.RelayProp,
}
class Artwork extends React.Component<ArtworkProps, null> {
render() {
return (
<a href={`/artworks/${this.props.relay.variables.artworkID}`}>
{this.props.artwork.title}
</a>
)
}
}
const ArtworkContainer = Relay.createContainer(Artwork, {
fragments: {
artwork: () => Relay.QL`
fragment on Artwork {
title
}
`
}
})
class StubbedArtwork extends React.Component<null, null> {
render() {
const props = {
artwork: { title: "CHAMPAGNE FORMICA FLAG" },
relay: {
variables: {
artworkID: "champagne-formica-flag",
},
setVariables: () => {},
}
}
return <ArtworkContainer {...props} />
}
}
| Expand example to show use of `RelayProp`. | [react-relay] Expand example to show use of `RelayProp`.
| TypeScript | mit | benishouga/DefinitelyTyped,minodisk/DefinitelyTyped,AgentME/DefinitelyTyped,rolandzwaga/DefinitelyTyped,abbasmhd/DefinitelyTyped,aciccarello/DefinitelyTyped,magny/DefinitelyTyped,progre/DefinitelyTyped,alexdresko/DefinitelyTyped,isman-usoh/DefinitelyTyped,chrootsu/DefinitelyTyped,georgemarshall/DefinitelyTyped,georgemarshall/DefinitelyTyped,mcrawshaw/DefinitelyTyped,nycdotnet/DefinitelyTyped,AgentME/DefinitelyTyped,abbasmhd/DefinitelyTyped,smrq/DefinitelyTyped,zuzusik/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,markogresak/DefinitelyTyped,QuatroCode/DefinitelyTyped,ashwinr/DefinitelyTyped,one-pieces/DefinitelyTyped,amir-arad/DefinitelyTyped,jimthedev/DefinitelyTyped,arusakov/DefinitelyTyped,zuzusik/DefinitelyTyped,jimthedev/DefinitelyTyped,QuatroCode/DefinitelyTyped,benishouga/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,chrootsu/DefinitelyTyped,arusakov/DefinitelyTyped,alexdresko/DefinitelyTyped,zuzusik/DefinitelyTyped,YousefED/DefinitelyTyped,benliddicott/DefinitelyTyped,rolandzwaga/DefinitelyTyped,aciccarello/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped,jimthedev/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,dsebastien/DefinitelyTyped,johan-gorter/DefinitelyTyped,nycdotnet/DefinitelyTyped,arusakov/DefinitelyTyped,AgentME/DefinitelyTyped,ashwinr/DefinitelyTyped,johan-gorter/DefinitelyTyped,benishouga/DefinitelyTyped,georgemarshall/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,minodisk/DefinitelyTyped,YousefED/DefinitelyTyped,isman-usoh/DefinitelyTyped,mcliment/DefinitelyTyped,dsebastien/DefinitelyTyped,mcrawshaw/DefinitelyTyped,AgentME/DefinitelyTyped,aciccarello/DefinitelyTyped,smrq/DefinitelyTyped,progre/DefinitelyTyped | ---
+++
@@ -45,12 +45,17 @@
interface ArtworkProps {
artwork: {
title: string
- }
+ },
+ relay: Relay.RelayProp,
}
class Artwork extends React.Component<ArtworkProps, null> {
render() {
- return <p>{this.props.artwork.title}</p>
+ return (
+ <a href={`/artworks/${this.props.relay.variables.artworkID}`}>
+ {this.props.artwork.title}
+ </a>
+ )
}
}
@@ -66,6 +71,15 @@
class StubbedArtwork extends React.Component<null, null> {
render() {
- return <ArtworkContainer artwork={{ title: "CHAMPAGNE FORMICA FLAG" }} />
+ const props = {
+ artwork: { title: "CHAMPAGNE FORMICA FLAG" },
+ relay: {
+ variables: {
+ artworkID: "champagne-formica-flag",
+ },
+ setVariables: () => {},
+ }
+ }
+ return <ArtworkContainer {...props} />
}
} |
9e24e84c0eb26d97c3fc897e9c5ad013754ba885 | front/components/shell/index.tsx | front/components/shell/index.tsx | import * as React from 'react';
import Header from '../header/index';
import Sidebar from '../sidebar/index';
import Content from '../content/index';
import * as menus from './navigation';
import Body from './body';
type ConciergeParams = {
params: {
category: string;
item?: string;
},
}
const Concierge = ({ params }: ConciergeParams) => (
<div style={styles}>
<Header items={menus.getTopLevel()} />
<Body>
<Sidebar root={menus.getItem(params.category).href} options={menus.getOptions(params.category)} />
<Content>
{menus.getContent(params.category, params.item)}
</Content>
</Body>
</div>
);
export default Concierge;
const styles: React.CSSProperties = {
fontFamily: 'Helvetica',
display: 'flex',
flexFlow: 'column',
height: '100vh'
} | import * as React from 'react';
import Header from '../header/index';
import Sidebar from '../sidebar/index';
import Content from '../content/index';
import * as menus from './navigation';
import Body from './body';
import mergeToClass from '../merge-style';
type ConciergeParams = {
styles?: {};
params: {
category: string;
item?: string;
},
}
const Concierge = ({ params, styles = {} }: ConciergeParams) => (
<div className={mergeToClass(conciergeStyles, styles)}>
<Header items={menus.getTopLevel()} />
<Body>
<Sidebar params={menus.getOptions(params.category)} />
<Content>
{menus.getContent(params.category, params.item)}
</Content>
</Body>
</div>
);
export default Concierge;
const conciergeStyles: React.CSSProperties = {
fontFamily: 'Helvetica',
display: 'flex',
flexFlow: 'column',
height: '100vh'
} | Allow optional style params to Concierge block | Allow optional style params to Concierge block
| TypeScript | mit | the-concierge/concierge,paypac/node-concierge,the-concierge/concierge,paypac/node-concierge,the-concierge/concierge,paypac/node-concierge,paypac/node-concierge | ---
+++
@@ -4,18 +4,21 @@
import Content from '../content/index';
import * as menus from './navigation';
import Body from './body';
+import mergeToClass from '../merge-style';
type ConciergeParams = {
+ styles?: {};
params: {
category: string;
item?: string;
},
}
-const Concierge = ({ params }: ConciergeParams) => (
- <div style={styles}>
+
+const Concierge = ({ params, styles = {} }: ConciergeParams) => (
+ <div className={mergeToClass(conciergeStyles, styles)}>
<Header items={menus.getTopLevel()} />
<Body>
- <Sidebar root={menus.getItem(params.category).href} options={menus.getOptions(params.category)} />
+ <Sidebar params={menus.getOptions(params.category)} />
<Content>
{menus.getContent(params.category, params.item)}
</Content>
@@ -25,7 +28,7 @@
export default Concierge;
-const styles: React.CSSProperties = {
+const conciergeStyles: React.CSSProperties = {
fontFamily: 'Helvetica',
display: 'flex',
flexFlow: 'column', |
c8d6605a568dc13c8331315e2efaaa5954743e84 | modules/sugar/src/test/ts/browser/ShadowDomTest.ts | modules/sugar/src/test/ts/browser/ShadowDomTest.ts | import { Assert, UnitTest } from '@ephox/bedrock-client';
import Element from 'ephox/sugar/api/node/Element';
import * as Body from 'ephox/sugar/api/node/Body';
import * as Insert from 'ephox/sugar/api/dom/Insert';
import { Element as DomElement, ShadowRoot } from '@ephox/dom-globals';
import * as SelectorFind from 'ephox/sugar/api/search/SelectorFind';
const mkShadow = (): Element<ShadowRoot> => {
const body = Body.body();
const e = Element.fromHtml<DomElement>('<div />');
Insert.append(body, e);
const shadow: ShadowRoot = e.dom().attachShadow({ mode: 'open' });
return Element.fromDom(shadow);
};
UnitTest.test('ShadowDom - SelectorFind.descendant', () => {
const ss = mkShadow();
const inner = Element.fromHtml('<div><p>hello<span id="frog">iamthefrog</span></p></div>');
Insert.append(ss, inner);
const frog: Element<DomElement> = SelectorFind.descendant(ss, '#frog').getOrDie('Element not found');
Assert.eq('textcontent', 'iamthefrog', frog.dom().textContent);
});
| import { Assert, UnitTest } from '@ephox/bedrock-client';
import Element from 'ephox/sugar/api/node/Element';
import * as Body from 'ephox/sugar/api/node/Body';
import * as Insert from 'ephox/sugar/api/dom/Insert';
import { Element as DomElement, ShadowRoot } from '@ephox/dom-globals';
import * as SelectorFind from 'ephox/sugar/api/search/SelectorFind';
const shadowDomTest = (name: string, fn: () => void) => {
if (DomElement.prototype.hasOwnProperty('attachShadow')) {
UnitTest.test(name, fn);
}
};
const mkShadow = (): Element<ShadowRoot> => {
const body = Body.body();
const e = Element.fromHtml<DomElement>('<div />');
Insert.append(body, e);
const shadow: ShadowRoot = e.dom().attachShadow({ mode: 'open' });
return Element.fromDom(shadow);
};
shadowDomTest('ShadowDom - SelectorFind.descendant', () => {
const ss = mkShadow();
const inner = Element.fromHtml('<div><p>hello<span id="frog">iamthefrog</span></p></div>');
Insert.append(ss, inner);
const frog: Element<DomElement> = SelectorFind.descendant(ss, '#frog').getOrDie('Element not found');
Assert.eq('textcontent', 'iamthefrog', frog.dom().textContent);
});
| Use feature detection to avoid running shadow dom tests on browsers that don't support it. | Use feature detection to avoid running shadow dom tests on browsers that don't support it.
| TypeScript | lgpl-2.1 | FernCreek/tinymce,FernCreek/tinymce,tinymce/tinymce,tinymce/tinymce,TeamupCom/tinymce,FernCreek/tinymce,TeamupCom/tinymce,tinymce/tinymce | ---
+++
@@ -4,6 +4,12 @@
import * as Insert from 'ephox/sugar/api/dom/Insert';
import { Element as DomElement, ShadowRoot } from '@ephox/dom-globals';
import * as SelectorFind from 'ephox/sugar/api/search/SelectorFind';
+
+const shadowDomTest = (name: string, fn: () => void) => {
+ if (DomElement.prototype.hasOwnProperty('attachShadow')) {
+ UnitTest.test(name, fn);
+ }
+};
const mkShadow = (): Element<ShadowRoot> => {
const body = Body.body();
@@ -14,7 +20,7 @@
return Element.fromDom(shadow);
};
-UnitTest.test('ShadowDom - SelectorFind.descendant', () => {
+shadowDomTest('ShadowDom - SelectorFind.descendant', () => {
const ss = mkShadow();
const inner = Element.fromHtml('<div><p>hello<span id="frog">iamthefrog</span></p></div>');
Insert.append(ss, inner); |
d32d7550f7ca539b080411bce3280a7096c5c6f6 | src/decorators/module.ts | src/decorators/module.ts | import {IModuleMetadata} from "../interfaces/imodule";
import {inArray, isArray, isClass} from "../core";
import {Metadata} from "../injector/metadata";
import {Router} from "../router/router";
import {Logger} from "../logger/logger";
/**
* Module decorator
* @decorator
* @function
* @name Module
*
* @param {IModuleMetadata} config
* @returns {function(any): any}
*
* @description
* Define module in your application
*
* @example
* import {Module, Router} from "typeix";
*
* \@Module({
* providers:[Logger, Router]
* })
* class Application{
* constructor(router: Router) {
*
* }
* }
*/
export let Module = (config: IModuleMetadata) => (Class) => {
if (!isClass(Class)) {
throw new TypeError(`@Module is allowed only on class`);
}
if (!isArray(config.providers)) {
config.providers = [];
}
if (!isArray(config.exports)) {
config.exports = [];
}
if (inArray(config.providers, Logger) && !inArray(config.exports, Logger)) {
config.exports.unshift(Logger);
}
if (inArray(config.providers, Router) && !inArray(config.exports, Router)) {
config.exports.unshift(Router);
}
config.providers = config.providers.map(ProviderClass => Metadata.verifyProvider(ProviderClass));
Metadata.setComponentConfig(Class, config);
return Class;
};
| import {IModuleMetadata} from "../interfaces/imodule";
import {isArray, isClass} from "../core";
import {Metadata} from "../injector/metadata";
import {Router} from "../router/router";
import {Logger} from "../logger/logger";
/**
* Module decorator
* @decorator
* @function
* @name Module
*
* @param {IModuleMetadata} config
* @returns {function(any): any}
*
* @description
* Define module in your application
*
* @example
* import {Module, Router} from "typeix";
*
* \@Module({
* providers:[Logger, Router]
* })
* class Application{
* constructor(router: Router) {
*
* }
* }
*/
export let Module = (config: IModuleMetadata) => (Class) => {
if (!isClass(Class)) {
throw new TypeError(`@Module is allowed only on class`);
}
if (!isArray(config.providers)) {
config.providers = [];
}
if (!isArray(config.exports)) {
config.exports = [];
}
if (Metadata.inProviders(config.providers, Logger) && !Metadata.inProviders(config.exports, Logger)) {
config.exports.unshift(Logger);
}
if (Metadata.inProviders(config.providers, Router) && !Metadata.inProviders(config.exports, Router)) {
config.exports.unshift(Router);
}
config.providers = config.providers.map(ProviderClass => Metadata.verifyProvider(ProviderClass));
Metadata.setComponentConfig(Class, config);
return Class;
};
| Switch from inArray to inProviders | Switch from inArray to inProviders
| TypeScript | mit | igorzg/typeix | ---
+++
@@ -1,5 +1,5 @@
import {IModuleMetadata} from "../interfaces/imodule";
-import {inArray, isArray, isClass} from "../core";
+import {isArray, isClass} from "../core";
import {Metadata} from "../injector/metadata";
import {Router} from "../router/router";
import {Logger} from "../logger/logger";
@@ -39,10 +39,10 @@
if (!isArray(config.exports)) {
config.exports = [];
}
- if (inArray(config.providers, Logger) && !inArray(config.exports, Logger)) {
+ if (Metadata.inProviders(config.providers, Logger) && !Metadata.inProviders(config.exports, Logger)) {
config.exports.unshift(Logger);
}
- if (inArray(config.providers, Router) && !inArray(config.exports, Router)) {
+ if (Metadata.inProviders(config.providers, Router) && !Metadata.inProviders(config.exports, Router)) {
config.exports.unshift(Router);
}
config.providers = config.providers.map(ProviderClass => Metadata.verifyProvider(ProviderClass)); |
d55ce9ec8fe3de264a60580c2bad42906e7fc43b | src/page-analysis/background/content-extraction/extract-fav-icon.ts | src/page-analysis/background/content-extraction/extract-fav-icon.ts | import responseToDataUrl from 'response-to-data-url'
/**
* @param {Document} doc DOM to attempt to find favicon URL from.
* @returns {string?} URL pointing to the document's favicon or null.
*/
function getFavIconURLFromDOM(doc) {
const favEl = doc.querySelector('link[rel*="icon"]')
return favEl && favEl.href
}
/**
* @param {string} favIconUrl URL pointing to a favicon.
* @returns {string?} Favicon encoded as data URL.
*/
async function getFavIcon(favIconUrl) {
if (!favIconUrl) {
return
}
try {
const response = await fetch(favIconUrl)
if (response.status >= 400 && response.status < 600) {
throw new Error(`Bad response from server: ${response.status}`)
}
const dataUrl = await responseToDataUrl(response)
return dataUrl
} catch (err) {
return undefined // carry on without fav-icon
}
}
/**
* @param {Document} doc DOM to attempt to extract favicon from.
* @returns {string?} Favicon encoded as data URL.
*/
const extractFavIcon = (doc = document) => getFavIcon(getFavIconURLFromDOM(doc))
export default extractFavIcon
| import responseToDataUrl from 'response-to-data-url'
/**
* @param url
* @param {Document} doc DOM to attempt to find favicon URL from.
* @returns {string?} URL pointing to the document's favicon or null.
*/
function getFavIconURLFromDOM(url, doc) {
const favEl = doc.querySelector('link[rel*="icon"]')
const urlPage = new URL(url)
if (favEl?.href) {
const urlFavIcon = new URL(favEl.href)
if (urlFavIcon.protocol.startsWith('chrome-extension')) {
return favEl.href.replace(urlFavIcon.origin, urlPage.origin)
} else {
return favEl.href
}
} else {
return `${urlPage.origin}/favicon.ico`
}
}
/**
* @param {string} favIconUrl URL pointing to a favicon.
* @returns {string?} Favicon encoded as data URL.
*/
async function getFavIcon(favIconUrl) {
if (!favIconUrl) {
return
}
const response = await fetch(favIconUrl)
if (response.status >= 400 && response.status < 600) {
throw new Error(`Bad response from server: ${response.status}`)
}
const dataUrl = await responseToDataUrl(response)
return dataUrl
}
/**
* @param {Document} doc DOM to attempt to extract favicon from.
* @returns {string?} Favicon encoded as data URL.
*/
const extractFavIcon = (url, doc = document) => {
try {
return getFavIcon(getFavIconURLFromDOM(url, doc))
} catch (err) {
return undefined // carry on without fav-icon
}
}
export default extractFavIcon
| Fix 3 issues with fetching favicons | Fix 3 issues with fetching favicons
| TypeScript | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | ---
+++
@@ -1,12 +1,23 @@
import responseToDataUrl from 'response-to-data-url'
/**
+ * @param url
* @param {Document} doc DOM to attempt to find favicon URL from.
* @returns {string?} URL pointing to the document's favicon or null.
*/
-function getFavIconURLFromDOM(doc) {
+function getFavIconURLFromDOM(url, doc) {
const favEl = doc.querySelector('link[rel*="icon"]')
- return favEl && favEl.href
+ const urlPage = new URL(url)
+ if (favEl?.href) {
+ const urlFavIcon = new URL(favEl.href)
+ if (urlFavIcon.protocol.startsWith('chrome-extension')) {
+ return favEl.href.replace(urlFavIcon.origin, urlPage.origin)
+ } else {
+ return favEl.href
+ }
+ } else {
+ return `${urlPage.origin}/favicon.ico`
+ }
}
/**
@@ -18,23 +29,25 @@
return
}
- try {
- const response = await fetch(favIconUrl)
+ const response = await fetch(favIconUrl)
- if (response.status >= 400 && response.status < 600) {
- throw new Error(`Bad response from server: ${response.status}`)
- }
+ if (response.status >= 400 && response.status < 600) {
+ throw new Error(`Bad response from server: ${response.status}`)
+ }
- const dataUrl = await responseToDataUrl(response)
- return dataUrl
- } catch (err) {
- return undefined // carry on without fav-icon
- }
+ const dataUrl = await responseToDataUrl(response)
+ return dataUrl
}
/**
* @param {Document} doc DOM to attempt to extract favicon from.
* @returns {string?} Favicon encoded as data URL.
*/
-const extractFavIcon = (doc = document) => getFavIcon(getFavIconURLFromDOM(doc))
+const extractFavIcon = (url, doc = document) => {
+ try {
+ return getFavIcon(getFavIconURLFromDOM(url, doc))
+ } catch (err) {
+ return undefined // carry on without fav-icon
+ }
+}
export default extractFavIcon |
22c8897dac003ecb22ee02cd2ebfdc952e1948b0 | packages/status-code/src/index.tsx | packages/status-code/src/index.tsx | import * as React from 'react';
import {Route} from 'react-router-dom';
export interface StatusCodeProps {
code: number;
children?: React.ReactNode;
}
export default function Status({children, code}: StatusCodeProps) {
return (
<Route
render={({staticContext}) => {
// there is no `staticContext` on the client, so
// we need to guard against that here
if (staticContext) staticContext.status = code;
return children;
}}
/>
);
}
module.exports = Status;
module.exports.default = Status;
| import * as React from 'react';
import {Route} from 'react-router-dom';
export interface StatusCodeProps {
code: number;
children?: React.ReactNode;
}
export default function Status({children, code}: StatusCodeProps) {
return (
<Route
render={({staticContext}) => {
// there is no `staticContext` on the client, so
// we need to guard against that here
if (staticContext) {
(staticContext as any).status = code;
staticContext.statusCode = code;
}
return children;
}}
/>
);
}
module.exports = Status;
module.exports.default = Status;
| Fix type error in status code | Fix type error in status code
| TypeScript | mit | mopedjs/moped,mopedjs/moped,mopedjs/moped | ---
+++
@@ -12,7 +12,10 @@
render={({staticContext}) => {
// there is no `staticContext` on the client, so
// we need to guard against that here
- if (staticContext) staticContext.status = code;
+ if (staticContext) {
+ (staticContext as any).status = code;
+ staticContext.statusCode = code;
+ }
return children;
}}
/> |
121ab3e24e47c464f50aa9995c57d5eabe846e70 | src/reducers.ts | src/reducers.ts | import { RootState } from './types';
import { combineReducers } from 'redux';
import { reducer as toastr } from 'react-redux-toastr';
import { default as tab } from './reducers/tab';
import { default as search } from './reducers/search';
import { default as queue } from './reducers/queue';
import { default as requesters } from './reducers/requesters';
import { default as searchOptions } from './reducers/searchOptions';
import { default as searchFormActive } from './reducers/searchFormActive';
import { default as sortingOption } from './reducers/sortingOption';
export const rootReducer = combineReducers<RootState>({
tab,
queue,
search,
toastr,
requesters,
searchOptions,
searchFormActive,
sortingOption
});
| import { RootState } from './types';
import { combineReducers } from 'redux';
import { reducer as toastr } from 'react-redux-toastr';
import { default as tab } from './reducers/tab';
import { default as search } from './reducers/search';
import { default as queue } from './reducers/queue';
import { default as requesters } from './reducers/requesters';
import { default as searchOptions } from './reducers/searchOptions';
import { default as searchFormActive } from './reducers/searchFormActive';
import { default as sortingOption } from './reducers/sortingOption';
import { default as hitBlocklist } from './reducers/hitBlocklist';
export const rootReducer = combineReducers<RootState>({
tab,
queue,
search,
toastr,
requesters,
hitBlocklist,
searchOptions,
searchFormActive,
sortingOption,
});
| Add hitblocklist to root reducer. | Add hitblocklist to root reducer.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -9,6 +9,7 @@
import { default as searchOptions } from './reducers/searchOptions';
import { default as searchFormActive } from './reducers/searchFormActive';
import { default as sortingOption } from './reducers/sortingOption';
+import { default as hitBlocklist } from './reducers/hitBlocklist';
export const rootReducer = combineReducers<RootState>({
tab,
@@ -16,7 +17,8 @@
search,
toastr,
requesters,
+ hitBlocklist,
searchOptions,
searchFormActive,
- sortingOption
+ sortingOption,
}); |
f55d93436e06248fe66f3a3b1b07ee7579bce30f | test/extension.test.ts | test/extension.test.ts | import * as assert from 'assert';
import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';
import * as myext from '../src/main';
suite("Complex Command Tests", () => {
const fileUnformatted = path.join(
path.resolve(__dirname, '..', '..', 'test'),
'sample_std_seg_delimiter_unformatted.edi');
const fileFormatted = path.join(
path.resolve(__dirname, '..', '..', 'test'),
'sample_std_seg_delimiter_formatted.edi');
let txtFormatted = '';
suiteSetup(() => {
txtFormatted = fs.readFileSync(fileFormatted).toString();
});
test("Format unformatted EDIFACT file", (done) => {
vscode
.workspace
.openTextDocument(fileUnformatted)
.then((textDocument) => {
return vscode.window.showTextDocument(textDocument);
}).then((textEditor) => {
return vscode.commands.executeCommand('editor.action.format');
}).then(() => {
const txtEditor = vscode.window.activeTextEditor.document.getText();
assert.equal(
txtEditor,
txtFormatted,
'Editor text does not match preformatted EDIFACT file');
done();
}, done);
});
}); | import * as assert from 'assert';
import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';
import * as myext from '../src/main';
suite("Complex Command Tests", () => {
const fileUnformatted = path.join(
path.resolve(__dirname, '..', '..', 'test'),
'sample_std_seg_delimiter_unformatted.edi');
const fileFormatted = path.join(
path.resolve(__dirname, '..', '..', 'test'),
'sample_std_seg_delimiter_formatted.edi');
let txtFormatted = '';
suiteSetup(() => {
txtFormatted = fs.readFileSync(fileFormatted).toString();
});
test("Format unformatted EDIFACT file", (done) => {
vscode
.workspace
.openTextDocument(fileUnformatted)
.then((textDocument) => {
return vscode.window.showTextDocument(textDocument);
}).then((textEditor) => {
return vscode.commands.executeCommand('editor.action.formatDocument');
}).then(() => {
const txtEditor = vscode.window.activeTextEditor.document.getText();
assert.equal(
txtEditor,
txtFormatted,
'Editor text does not match preformatted EDIFACT file');
done();
}, done);
});
}); | Use new command to format document | Use new command to format document
| TypeScript | mit | DAXaholic/vscode-edifact | ---
+++
@@ -24,7 +24,7 @@
.then((textDocument) => {
return vscode.window.showTextDocument(textDocument);
}).then((textEditor) => {
- return vscode.commands.executeCommand('editor.action.format');
+ return vscode.commands.executeCommand('editor.action.formatDocument');
}).then(() => {
const txtEditor = vscode.window.activeTextEditor.document.getText();
assert.equal( |
44060903c1c2f36ce7ad98929310173e844c4ec2 | 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);
setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
}
@HostListener('dragend') onDragEnd() {
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);
this.draggedElement.mouseAction('dragStart', ev);
setTimeout(() => this.treeDraggedElement.set(this.draggedElement), 30);
}
@HostListener('dragend') onDragEnd() {
this.draggedElement.mouseAction('dragEnd');
this.treeDraggedElement.set(null);
}
}
| Fix dragStart, dragEnd mouse actions | Fix dragStart, dragEnd mouse actions
dragStart is called with (tree, node, $event)
dragEnd is called with (tree, node)
drag and dragOver is not implemented.
| TypeScript | mit | Alexey3/angular-tree-component,sm-allen/angular-tree-component,Alexey3/angular-tree-component,500tech/angular2-tree-component,Alexey3/angular-tree-component,500tech/angular2-tree-component,sm-allen/angular-tree-component,sm-allen/angular-tree-component,500tech/angular2-tree-component | ---
+++
@@ -22,10 +22,15 @@
@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);
}
} |
0745a20cd2f0106c959eb70c5891402e96c49594 | vscode-extensions/vscode-manifest-yaml/lib/Main.ts | vscode-extensions/vscode-manifest-yaml/lib/Main.ts | 'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as VSCode from 'vscode';
import * as commons from 'commons-vscode';
import * as Path from 'path';
import * as FS from 'fs';
import * as Net from 'net';
import * as ChildProcess from 'child_process';
import {LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
import {TextDocument, OutputChannel} from 'vscode';
var log_output : OutputChannel = null;
function log(msg : string) {
if (log_output) {
log_output.append(msg +"\n");
}
}
function error(msg : string) {
if (log_output) {
log_output.append("ERR: "+msg+"\n");
}
}
/** Called when extension is activated */
export function activate(context: VSCode.ExtensionContext) {
let options : commons.ActivatorOptions = {
DEBUG : false,
CONNECT_TO_LS: true,
extensionId: 'vscode-manifest-yaml',
fatJarFile: 'jars/language-server.jar',
jvmHeap: '64m',
clientOptions: {
documentSelector: ["manifest-yaml"]
}
};
commons.activate(options, context);
}
| 'use strict';
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as VSCode from 'vscode';
import * as commons from 'commons-vscode';
import * as Path from 'path';
import * as FS from 'fs';
import * as Net from 'net';
import * as ChildProcess from 'child_process';
import {LanguageClient, LanguageClientOptions, SettingMonitor, ServerOptions, StreamInfo} from 'vscode-languageclient';
import {TextDocument, OutputChannel} from 'vscode';
var log_output : OutputChannel = null;
function log(msg : string) {
if (log_output) {
log_output.append(msg +"\n");
}
}
function error(msg : string) {
if (log_output) {
log_output.append("ERR: "+msg+"\n");
}
}
/** Called when extension is activated */
export function activate(context: VSCode.ExtensionContext) {
let options : commons.ActivatorOptions = {
DEBUG : false,
CONNECT_TO_LS: false,
extensionId: 'vscode-manifest-yaml',
fatJarFile: 'jars/language-server.jar',
jvmHeap: '64m',
clientOptions: {
documentSelector: ["manifest-yaml"]
}
};
commons.activate(options, context);
}
| Fix packagin issue cf-manfiest editor | Fix packagin issue cf-manfiest editor | TypeScript | epl-1.0 | spring-projects/sts4,spring-projects/sts4,spring-projects/sts4,spring-projects/sts4,spring-projects/sts4,spring-projects/sts4 | ---
+++
@@ -29,7 +29,7 @@
export function activate(context: VSCode.ExtensionContext) {
let options : commons.ActivatorOptions = {
DEBUG : false,
- CONNECT_TO_LS: true,
+ CONNECT_TO_LS: false,
extensionId: 'vscode-manifest-yaml',
fatJarFile: 'jars/language-server.jar',
jvmHeap: '64m', |
0994b0211fb56ed0706b276fcf0327d13708e272 | src/compiler/syntax/syntaxNode.ts | src/compiler/syntax/syntaxNode.ts | ///<reference path='references.ts' />
module TypeScript {
export class SyntaxNode implements ISyntaxNodeOrToken {
public parent: ISyntaxElement;
private __kind: SyntaxKind;
constructor(public data: number) {
}
public kind(): SyntaxKind {
return this.__kind;
}
}
} | ///<reference path='references.ts' />
module TypeScript {
export class SyntaxNode implements ISyntaxNodeOrToken {
public parent: ISyntaxElement;
private __kind: SyntaxKind;
public data: number;
constructor(data: number) {
if (data) {
this.data = data;
}
}
public kind(): SyntaxKind {
return this.__kind;
}
}
} | Save a fair amount of space while compiling by not storing data in nodes unnecessarily. | Save a fair amount of space while compiling by not storing data in nodes unnecessarily.
| TypeScript | apache-2.0 | fdecampredon/jsx-typescript-old-version,fdecampredon/jsx-typescript-old-version,fdecampredon/jsx-typescript-old-version | ---
+++
@@ -4,8 +4,12 @@
export class SyntaxNode implements ISyntaxNodeOrToken {
public parent: ISyntaxElement;
private __kind: SyntaxKind;
+ public data: number;
- constructor(public data: number) {
+ constructor(data: number) {
+ if (data) {
+ this.data = data;
+ }
}
public kind(): SyntaxKind { |
45ff3bd70994458132d1fc02013e5376bf75451b | ui/test/config.spec.ts | ui/test/config.spec.ts | "use strict";
import chai from "chai";
import {Config} from "../src/app/config";
import {RouterConfigurationStub} from "./stubs";
describe("Config test suite", () => {
it("should initialize correctly", () => {
let routerConfiguration = new RouterConfigurationStub();
let sut = new Config();
sut.configureRouter(routerConfiguration);
chai.expect(routerConfiguration.title).to.equals("Hello Worl1d");
chai.expect(routerConfiguration.map.calledOnce).to.equals(true);
});
});
| "use strict";
import chai from "chai";
import {Config} from "../src/app/config";
import {RouterConfigurationStub} from "./stubs";
describe("Config test suite", () => {
it("should initialize correctly", () => {
let routerConfiguration = new RouterConfigurationStub();
let sut = new Config();
sut.configureRouter(routerConfiguration);
chai.expect(routerConfiguration.title).to.equals("Hello World");
chai.expect(routerConfiguration.map.calledOnce).to.equals(true);
});
});
| Revert "Test if CI fails on a broken unit test." | Revert "Test if CI fails on a broken unit test."
This reverts commit 8e7b26f32212461b96bbd7a29b4c113110c8baaa.
| TypeScript | mit | jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr,jp7677/hellocoreclr | ---
+++
@@ -12,7 +12,7 @@
sut.configureRouter(routerConfiguration);
- chai.expect(routerConfiguration.title).to.equals("Hello Worl1d");
+ chai.expect(routerConfiguration.title).to.equals("Hello World");
chai.expect(routerConfiguration.map.calledOnce).to.equals(true);
});
|
d245b55646b799a712b010304ef88923a27a64d8 | packages/react-input-feedback/src/index.ts | packages/react-input-feedback/src/index.ts | import {
Component,
ComponentElement,
ComponentType,
createElement as r,
Fragment,
ReactElement,
ReactPortal,
SFCElement,
} from 'react'
import { FieldRenderProps } from 'react-final-form'
import SequentialId, { ISequentialIdProps } from 'react-sequential-id'
export interface InputComponents {
error?: ComponentType<any>
input?: ComponentType<any>
}
export interface ComponentsProp {
components?: InputComponents
}
export type InputProps = ComponentsProp & FieldRenderProps
export {
Component,
ComponentElement,
ISequentialIdProps,
ReactElement,
ReactPortal,
SFCElement,
}
export default function InputFeedback({
components: c = {},
input,
meta = { error: null, touched: false },
...props
}: InputProps) {
const components = {
error: 'span',
input: 'input',
...c,
}
const { error, touched } = meta
const showError = touched && !!error
return r(SequentialId, {}, (errorId: string) =>
r(
Fragment,
{},
r(components.input, {
'aria-describedby': showError ? errorId : null,
'aria-invalid': showError,
...props,
...input,
}),
showError && r(components.error, { id: errorId }, error),
),
)
}
| import {
Component,
ComponentElement,
createElement as r,
Fragment,
ReactElement,
ReactPortal,
SFCElement,
} from 'react'
import { FieldRenderProps } from 'react-final-form'
import SequentialId, { ISequentialIdProps } from 'react-sequential-id'
export type InputProps = FieldRenderProps
export {
Component,
ComponentElement,
ISequentialIdProps,
ReactElement,
ReactPortal,
SFCElement,
}
export default function InputFeedback({
input,
meta = { error: null, touched: false },
...props
}: InputProps) {
const { error, touched } = meta
const showError = touched && !!error
return r(SequentialId, {}, (errorId: string) =>
r(
Fragment,
{},
r('input', {
'aria-describedby': showError ? errorId : null,
'aria-invalid': showError,
...props,
...input,
}),
showError && r('span', { id: errorId }, error),
),
)
}
| Remove support for custom components | Remove support for custom components
| TypeScript | mit | thirdhand/components,thirdhand/components | ---
+++
@@ -1,7 +1,6 @@
import {
Component,
ComponentElement,
- ComponentType,
createElement as r,
Fragment,
ReactElement,
@@ -11,16 +10,7 @@
import { FieldRenderProps } from 'react-final-form'
import SequentialId, { ISequentialIdProps } from 'react-sequential-id'
-export interface InputComponents {
- error?: ComponentType<any>
- input?: ComponentType<any>
-}
-
-export interface ComponentsProp {
- components?: InputComponents
-}
-
-export type InputProps = ComponentsProp & FieldRenderProps
+export type InputProps = FieldRenderProps
export {
Component,
@@ -32,29 +22,23 @@
}
export default function InputFeedback({
- components: c = {},
input,
meta = { error: null, touched: false },
...props
}: InputProps) {
- const components = {
- error: 'span',
- input: 'input',
- ...c,
- }
const { error, touched } = meta
const showError = touched && !!error
return r(SequentialId, {}, (errorId: string) =>
r(
Fragment,
{},
- r(components.input, {
+ r('input', {
'aria-describedby': showError ? errorId : null,
'aria-invalid': showError,
...props,
...input,
}),
- showError && r(components.error, { id: errorId }, error),
+ showError && r('span', { id: errorId }, error),
),
)
} |
a1f24fe55673903c228506bb08643037b6dc645c | app/src/ui/delete-branch/index.tsx | app/src/ui/delete-branch/index.tsx | import * as React from 'react'
import { Dispatcher } from '../../lib/dispatcher'
import { Repository } from '../../models/repository'
import { Branch } from '../../models/branch'
interface IDeleteBranchProps {
readonly dispatcher: Dispatcher
readonly repository: Repository
readonly branch: Branch
}
export class DeleteBranch extends React.Component<IDeleteBranchProps, void> {
public render() {
return (
<form className='panel' onSubmit={this.cancel}>
<div>Delete branch "{this.props.branch.name}"?</div>
<div>This cannot be undone.</div>
<button type='submit'>Cancel</button>
<button onClick={this.deleteBranch}>Delete</button>
</form>
)
}
private cancel = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
this.props.dispatcher.closePopup()
}
private deleteBranch = () => {
this.props.dispatcher.deleteBranch(this.props.repository, this.props.branch)
this.props.dispatcher.closePopup()
}
}
| import * as React from 'react'
import { Dispatcher } from '../../lib/dispatcher'
import { Repository } from '../../models/repository'
import { Branch } from '../../models/branch'
import { Form } from '../lib/form'
import { Button } from '../lib/button'
interface IDeleteBranchProps {
readonly dispatcher: Dispatcher
readonly repository: Repository
readonly branch: Branch
}
export class DeleteBranch extends React.Component<IDeleteBranchProps, void> {
public render() {
return (
<Form onSubmit={this.cancel}>
<div>Delete branch "{this.props.branch.name}"?</div>
<div>This cannot be undone.</div>
<Button type='submit'>Cancel</Button>
<Button onClick={this.deleteBranch}>Delete</Button>
</Form>
)
}
private cancel = () => {
this.props.dispatcher.closePopup()
}
private deleteBranch = () => {
this.props.dispatcher.deleteBranch(this.props.repository, this.props.branch)
this.props.dispatcher.closePopup()
}
}
| Convert Delete Branch to Form | Convert Delete Branch to Form
| TypeScript | mit | hjobrien/desktop,gengjiawen/desktop,desktop/desktop,artivilla/desktop,shiftkey/desktop,say25/desktop,desktop/desktop,j-f1/forked-desktop,gengjiawen/desktop,gengjiawen/desktop,artivilla/desktop,kactus-io/kactus,BugTesterTest/desktops,artivilla/desktop,shiftkey/desktop,desktop/desktop,j-f1/forked-desktop,BugTesterTest/desktops,j-f1/forked-desktop,BugTesterTest/desktops,j-f1/forked-desktop,hjobrien/desktop,shiftkey/desktop,say25/desktop,gengjiawen/desktop,say25/desktop,shiftkey/desktop,BugTesterTest/desktops,desktop/desktop,hjobrien/desktop,hjobrien/desktop,kactus-io/kactus,kactus-io/kactus,kactus-io/kactus,artivilla/desktop,say25/desktop | ---
+++
@@ -3,6 +3,8 @@
import { Dispatcher } from '../../lib/dispatcher'
import { Repository } from '../../models/repository'
import { Branch } from '../../models/branch'
+import { Form } from '../lib/form'
+import { Button } from '../lib/button'
interface IDeleteBranchProps {
readonly dispatcher: Dispatcher
@@ -13,19 +15,17 @@
export class DeleteBranch extends React.Component<IDeleteBranchProps, void> {
public render() {
return (
- <form className='panel' onSubmit={this.cancel}>
+ <Form onSubmit={this.cancel}>
<div>Delete branch "{this.props.branch.name}"?</div>
<div>This cannot be undone.</div>
- <button type='submit'>Cancel</button>
- <button onClick={this.deleteBranch}>Delete</button>
- </form>
+ <Button type='submit'>Cancel</Button>
+ <Button onClick={this.deleteBranch}>Delete</Button>
+ </Form>
)
}
- private cancel = (event: React.FormEvent<HTMLFormElement>) => {
- event.preventDefault()
-
+ private cancel = () => {
this.props.dispatcher.closePopup()
}
|
65014a8eb4d49182e125896b1afbcef42223eb01 | src/Test/Ast/RevisionDeletion.ts | src/Test/Ast/RevisionDeletion.ts | import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode'
import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode'
describe('Text surrounded by 2 tildes', () => {
it('is put inside a revision deletion node', () => {
expect(Up.toAst('I like ~~certain types of~~ pizza')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionDeletionNode([
new PlainTextNode('certain types of')
]),
new PlainTextNode(' pizza')
]))
})
})
describe('A revision deletion', () => {
it('is evaluated for other conventions', () => {
expect(Up.toAst('I like ~~certain *types* of~~ pizza')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionDeletionNode([
new PlainTextNode('certain '),
new EmphasisNode([
new PlainTextNode('types')
]),
new PlainTextNode(' of')
]),
new PlainTextNode(' pizza')
]))
})
})
| import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode'
import { RevisionDeletionNode } from '../../SyntaxNodes/RevisionDeletionNode'
describe('Text surrounded by 2 tildes', () => {
it('is put inside a revision deletion node', () => {
expect(Up.toAst('I like ~~certain types of~~ pizza')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionDeletionNode([
new PlainTextNode('certain types of')
]),
new PlainTextNode(' pizza')
]))
})
})
describe('A revision deletion', () => {
it('is evaluated for other conventions', () => {
expect(Up.toAst('I like ~~certain *types* of~~ pizza')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionDeletionNode([
new PlainTextNode('certain '),
new EmphasisNode([
new PlainTextNode('types')
]),
new PlainTextNode(' of')
]),
new PlainTextNode(' pizza')
]))
})
})
describe('An empty revision deletion', () => {
it('produces no syntax nodes', () => {
expect(Up.toAst('I have nothing to remove: ~~~~')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I have nothing to remove: ')
])
)
})
})
| Add passing revision insertion test | Add passing revision insertion test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -36,3 +36,15 @@
]))
})
})
+
+
+describe('An empty revision deletion', () => {
+ it('produces no syntax nodes', () => {
+ expect(Up.toAst('I have nothing to remove: ~~~~')).to.be.eql(
+ insideDocumentAndParagraph([
+ new PlainTextNode('I have nothing to remove: ')
+ ])
+ )
+ })
+})
+ |
0926af7acc130170feef43d5f6d39c68e479a033 | server/models/video/video-views.ts | server/models/video/video-views.ts | import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table } from 'sequelize-typescript'
import { VideoModel } from './video'
import * as Sequelize from 'sequelize'
@Table({
tableName: 'videoView',
indexes: [
{
fields: [ 'videoId' ]
}
]
})
export class VideoViewModel extends Model<VideoViewModel> {
@CreatedAt
createdAt: Date
@AllowNull(false)
@Column(Sequelize.DATE)
startDate: Date
@AllowNull(false)
@Column(Sequelize.DATE)
endDate: Date
@AllowNull(false)
@Column
views: number
@ForeignKey(() => VideoModel)
@Column
videoId: number
@BelongsTo(() => VideoModel, {
foreignKey: {
allowNull: false
},
onDelete: 'CASCADE'
})
Video: VideoModel
}
| import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, Model, Table } from 'sequelize-typescript'
import { VideoModel } from './video'
import * as Sequelize from 'sequelize'
@Table({
tableName: 'videoView',
indexes: [
{
fields: [ 'videoId' ]
},
{
fields: [ 'startDate' ]
}
]
})
export class VideoViewModel extends Model<VideoViewModel> {
@CreatedAt
createdAt: Date
@AllowNull(false)
@Column(Sequelize.DATE)
startDate: Date
@AllowNull(false)
@Column(Sequelize.DATE)
endDate: Date
@AllowNull(false)
@Column
views: number
@ForeignKey(() => VideoModel)
@Column
videoId: number
@BelongsTo(() => VideoModel, {
foreignKey: {
allowNull: false
},
onDelete: 'CASCADE'
})
Video: VideoModel
}
| Add index to startDate in video view table | Add index to startDate in video view table
| TypeScript | agpl-3.0 | Green-Star/PeerTube,Chocobozzz/PeerTube,Green-Star/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Green-Star/PeerTube,Green-Star/PeerTube | ---
+++
@@ -7,6 +7,9 @@
indexes: [
{
fields: [ 'videoId' ]
+ },
+ {
+ fields: [ 'startDate' ]
}
]
}) |
8c3ccc0ecd5cf80950d4660ed8918c74af1d9068 | src/helpers/RelativeConverter.ts | src/helpers/RelativeConverter.ts | export class RelativeConverter {
convert(input: number[]): number[] {
const copy: number[] = input.slice(0);
let previousValue = copy.shift();
return copy.map(function (value) {
let result;
if (previousValue != null && value != null) {
result = value - previousValue;
} else {
result = 0;
}
previousValue = value;
return result;
});
}
}
| export class RelativeConverter {
convert(input: number[]): number[] {
const copy: number[] = [...input];
let previousValue = copy.shift();
return copy.map(function (value) {
let result;
if (previousValue != null && value != null) {
const diff = value - previousValue;
// This is a bad workaround for moving house:
// The meter return absolute values, so there's a big difference
// between the old and new meter.
// (only visible in the year view, since that's the only
// view that has old and new measurements in the same view)
//
// A downside is that this hides one month of data.
if (diff < -4400) {
result = 0;
} else {
result = diff;
}
} else {
result = 0;
}
previousValue = value;
return result;
});
}
}
| Add workaround for the move to a new house. | Add workaround for the move to a new house.
| TypeScript | mit | lmeijvogel/meter-reader-react,lmeijvogel/meter-reader-react | ---
+++
@@ -1,21 +1,34 @@
export class RelativeConverter {
- convert(input: number[]): number[] {
- const copy: number[] = input.slice(0);
+ convert(input: number[]): number[] {
+ const copy: number[] = [...input];
- let previousValue = copy.shift();
+ let previousValue = copy.shift();
- return copy.map(function (value) {
- let result;
+ return copy.map(function (value) {
+ let result;
- if (previousValue != null && value != null) {
- result = value - previousValue;
- } else {
- result = 0;
- }
+ if (previousValue != null && value != null) {
+ const diff = value - previousValue;
- previousValue = value;
+ // This is a bad workaround for moving house:
+ // The meter return absolute values, so there's a big difference
+ // between the old and new meter.
+ // (only visible in the year view, since that's the only
+ // view that has old and new measurements in the same view)
+ //
+ // A downside is that this hides one month of data.
+ if (diff < -4400) {
+ result = 0;
+ } else {
+ result = diff;
+ }
+ } else {
+ result = 0;
+ }
- return result;
- });
- }
+ previousValue = value;
+
+ return result;
+ });
+ }
} |
18aae5d407a8889313a41183253fefbc3f32b6a6 | src/dialog/dialog-default-behavior.ts | src/dialog/dialog-default-behavior.ts | /*
MIT License
Copyright (c) 2017 Temainfo Sistemas
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.
*/
import { KeyEvent } from '../core/enums/key-events';
export class DialogDefaultBehavior {
public buttonAction;
constructor() {}
onKeyDown( $event: KeyboardEvent ) {
$event.stopPropagation();
switch ( $event.keyCode ) {
case KeyEvent.TAB:
$event.preventDefault();
break;
case KeyEvent.ESCAPE:
this.buttonAction.dispatchCallback();
break;
}
}
}
| /*
MIT License
Copyright (c) 2017 Temainfo Sistemas
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.
*/
import { KeyEvent } from '../core/enums/key-events';
export class DialogDefaultBehavior {
public buttonAction;
constructor() {}
onKeyDown( $event: KeyboardEvent ) {
$event.stopPropagation();
switch ( $event.keyCode ) {
case KeyEvent.TAB:
$event.preventDefault();
break;
}
}
}
| Remove statement not used anymore, now handle by modal. | refactor(dialog): Remove statement not used anymore, now handle by modal.
| TypeScript | mit | TemainfoSistemas/truly-ui,TemainfoSistemas/truly-ui,TemainfoSistemas/truly-ui | ---
+++
@@ -34,9 +34,6 @@
case KeyEvent.TAB:
$event.preventDefault();
break;
- case KeyEvent.ESCAPE:
- this.buttonAction.dispatchCallback();
- break;
}
}
} |
4ce1d5ac4412525ac66e166087168a71e9be0e1e | Source/SiteCommon/Web/pagesgallery/getting-started.ts | Source/SiteCommon/Web/pagesgallery/getting-started.ts | import { ViewModelBase } from '../services/viewmodelbase';
export class Gettingstarted extends ViewModelBase {
architectureDiagram: string = '';
downloadLink: string = '';
isDownload: boolean = false;
list1: string[] = [];
list2: string[] = [];
list1Title: string = 'To set up this solution template you will need:';
list2Title: string = 'Features of this architecture';
showPrivacy: boolean = true;
subtitle: string = '';
templateName: string = '';
constructor() {
super();
}
async OnLoaded() {
if (this.isDownload) {
let response = await this.MS.HttpService.executeAsync('Microsoft-GetMsiDownloadLink', {});
this.downloadLink = response.Body.value;
}
}
} | import { ViewModelBase } from '../services/viewmodelbase';
export class Gettingstarted extends ViewModelBase {
architectureDiagram: string = '';
downloadLink: string = '';
isDownload: boolean = false;
list1: string[] = [];
list2: string[] = [];
list1Title: string = 'To set up this solution template you will need:';
list2Title: string = 'Features of this architecture:';
showPrivacy: boolean = true;
subtitle: string = '';
templateName: string = '';
constructor() {
super();
}
async OnLoaded() {
if (this.isDownload) {
let response = await this.MS.HttpService.executeAsync('Microsoft-GetMsiDownloadLink', {});
this.downloadLink = response.Body.value;
}
}
} | Add in a missing semicolon | Add in a missing semicolon
| TypeScript | mit | MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps,MattFarm/BusinessPlatformApps | ---
+++
@@ -7,7 +7,7 @@
list1: string[] = [];
list2: string[] = [];
list1Title: string = 'To set up this solution template you will need:';
- list2Title: string = 'Features of this architecture';
+ list2Title: string = 'Features of this architecture:';
showPrivacy: boolean = true;
subtitle: string = '';
templateName: string = ''; |
404bbbe5d9c3c4a55fd956077a048983fd766d4e | client/components/Modal/PageCreateModal.stories.tsx | client/components/Modal/PageCreateModal.stories.tsx | import React from 'react'
import { storiesOf } from '@storybook/react'
import PageCreateModal from './PageCreateModal'
import Crowi from 'client/util/Crowi'
import i18n from '../../i18n'
i18n()
const crowi = {
user: {
name: 'storybook',
},
} as Crowi
storiesOf('Modal/PageCreateModal', module).add('Default', () => <PageCreateModal crowi={crowi} />)
| import React from 'react'
import PageCreateModal from './PageCreateModal'
import Crowi from '../../util/Crowi'
import i18n from '../../i18n'
i18n()
const crowi = {
user: {
name: 'storybook',
},
} as Crowi
export default { title: 'Modal/PageCreateModal' }
export const Default = () => <PageCreateModal crowi={crowi} />
| Rewrite PageCreateModal story with CSF | Rewrite PageCreateModal story with CSF
| TypeScript | mit | crowi/crowi,crowi/crowi,crowi/crowi | ---
+++
@@ -1,7 +1,6 @@
import React from 'react'
-import { storiesOf } from '@storybook/react'
import PageCreateModal from './PageCreateModal'
-import Crowi from 'client/util/Crowi'
+import Crowi from '../../util/Crowi'
import i18n from '../../i18n'
i18n()
@@ -12,4 +11,6 @@
},
} as Crowi
-storiesOf('Modal/PageCreateModal', module).add('Default', () => <PageCreateModal crowi={crowi} />)
+export default { title: 'Modal/PageCreateModal' }
+
+export const Default = () => <PageCreateModal crowi={crowi} /> |
5099667cb12a4889ca391bc60f6a7e9b68ac90a8 | front/components/sidebar/index.tsx | front/components/sidebar/index.tsx | import * as React from 'react';
import Anchor from '../anchor';
export default ({options}: {options: Array<{ text: string, href: string }>}) => (
<div style={styles}>
{options.map(({text, href}) => <p><Anchor text={text} href={href} /></p>)}
</div>
)
const styles: React.CSSProperties = {
padding: 10,
minWidth: 200,
float: 'left',
backgroundColor: '#303030',
color: '#fff'
} | import * as React from 'react';
import Anchor from '../anchor';
export default ({options}: {options: Array<{ text: string, href: string }>}) => (
<div style={styles}>
{options.map(({text, href}, key) => <p key={key}><Anchor text={text} href={href} /></p>)}
</div>
)
const styles: React.CSSProperties = {
padding: 10,
minWidth: 200,
float: 'left',
backgroundColor: '#303030',
color: '#fff'
} | Add key to sidebar menu map | Add key to sidebar menu map
| TypeScript | mit | paypac/node-concierge,paypac/node-concierge,the-concierge/concierge,the-concierge/concierge,paypac/node-concierge,the-concierge/concierge,paypac/node-concierge | ---
+++
@@ -3,7 +3,7 @@
export default ({options}: {options: Array<{ text: string, href: string }>}) => (
<div style={styles}>
- {options.map(({text, href}) => <p><Anchor text={text} href={href} /></p>)}
+ {options.map(({text, href}, key) => <p key={key}><Anchor text={text} href={href} /></p>)}
</div>
)
|
4c35fda0453877fcf6f9b05dddfef0d593da0d20 | types.ts | types.ts | export declare const Module: {
register(moduleName: string, moduleProperties: object): void;
};
export declare const Log: {
info(message?: any, ...optionalParams: any[]): void,
log(message?: any, ...optionalParams: any[]): void,
error(message?: any, ...optionalParams: any[]): void,
warn(message?: any, ...optionalParams: any[]): void,
group(groupTitle?: string, ...optionalParams: any[]): void,
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void,
groupEnd(): void,
time(timerName?: string): void,
timeEnd(timerName?: string): void,
timeStamp(timerName?: string): void,
}; | type ModuleProperties = {
defaults?: object,
start?(): void,
getHeader?(): string,
getTemplate?(): string,
getTemplateData?(): object,
notificationReceived?(notification: string, payload: any, sender: object): void,
socketNotificationReceived?(notification: string, payload: any): void,
suspend?(): void,
resume?(): void,
getDom?(): HTMLElement,
getStyles?(): string[],
[key: string]: any,
};
export declare const Module: {
register(moduleName: string, moduleProperties: ModuleProperties): void;
};
export declare const Log: {
info(message?: any, ...optionalParams: any[]): void,
log(message?: any, ...optionalParams: any[]): void,
error(message?: any, ...optionalParams: any[]): void,
warn(message?: any, ...optionalParams: any[]): void,
group(groupTitle?: string, ...optionalParams: any[]): void,
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void,
groupEnd(): void,
time(timerName?: string): void,
timeEnd(timerName?: string): void,
timeStamp(timerName?: string): void,
}; | Add most used module properties | Add most used module properties
| TypeScript | mit | heyheyhexi/MagicMirror,berlincount/MagicMirror,heyheyhexi/MagicMirror,roramirez/MagicMirror,n8many/MagicMirror,MichMich/MagicMirror,MichMich/MagicMirror,roramirez/MagicMirror,Tyvonne/MagicMirror,heyheyhexi/MagicMirror,MichMich/MagicMirror,berlincount/MagicMirror,thobach/MagicMirror,n8many/MagicMirror,Tyvonne/MagicMirror,n8many/MagicMirror,Tyvonne/MagicMirror,thobach/MagicMirror,berlincount/MagicMirror,heyheyhexi/MagicMirror,marc-86/MagicMirror,morozgrafix/MagicMirror,morozgrafix/MagicMirror,marc-86/MagicMirror,n8many/MagicMirror,morozgrafix/MagicMirror,thobach/MagicMirror,roramirez/MagicMirror,MichMich/MagicMirror,marc-86/MagicMirror,n8many/MagicMirror,berlincount/MagicMirror,marc-86/MagicMirror,roramirez/MagicMirror,morozgrafix/MagicMirror,Tyvonne/MagicMirror,thobach/MagicMirror | ---
+++
@@ -1,5 +1,20 @@
+type ModuleProperties = {
+ defaults?: object,
+ start?(): void,
+ getHeader?(): string,
+ getTemplate?(): string,
+ getTemplateData?(): object,
+ notificationReceived?(notification: string, payload: any, sender: object): void,
+ socketNotificationReceived?(notification: string, payload: any): void,
+ suspend?(): void,
+ resume?(): void,
+ getDom?(): HTMLElement,
+ getStyles?(): string[],
+ [key: string]: any,
+};
+
export declare const Module: {
- register(moduleName: string, moduleProperties: object): void;
+ register(moduleName: string, moduleProperties: ModuleProperties): void;
};
export declare const Log: { |
ed6fa1b8dbd4e217d16f052fa4e343153849e49e | wegas-app/src/main/webapp/wegas-react-form/src/HOC/callbackDebounce.tsx | wegas-app/src/main/webapp/wegas-react-form/src/HOC/callbackDebounce.tsx | import React from 'react';
import debounce from 'lodash-es/debounce';
interface IDebouncedProps {
[key: string]: any;
}
function deb(wait: number) {
return (key: string) =>
function debounced<P>(Comp: React.ComponentClass<P>) {
class Debounced<F extends Function> extends React.Component<P> {
method: F & _.Cancelable;
constructor(props: P & IDebouncedProps) {
super(props);
this.method = debounce<F>(props[key] as F, wait);
}
componentWillUnmount() {
this.method.cancel();
}
render() {
const newProps = Object.assign({}, this.props, {
[key]: this.method
});
return <Comp {...newProps} />;
}
}
return Debounced;
};
}
export default deb(600);
| import React from 'react';
import debounce from 'lodash-es/debounce';
interface IDebouncedProps {
[key: string]: any;
}
function deb(wait: number) {
return (key: string) =>
function debounced<P>(Comp: React.ComponentType<P>) {
class Debounced<F extends () => void> extends React.Component<P> {
method: F & _.Cancelable;
constructor(props: P & IDebouncedProps) {
super(props);
this.method = debounce<F>(props[key] as F, wait);
}
componentWillUnmount() {
this.method.flush();
}
componentWillReceiveProps(nextProps: P) {
if (nextProps[key] !== this.props[key]) {
this.method.flush();
this.method = debounce<F>(nextProps[key] as F, wait);
}
}
render() {
// tslint:disable-next-line:prefer-object-spread
const newProps = Object.assign({}, this.props, {
[key]: this.method,
});
return <Comp {...newProps} />;
}
}
return Debounced;
};
}
export default deb(600);
| Update callback on props change. | Update callback on props change.
| TypeScript | mit | Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas,Heigvd/Wegas | ---
+++
@@ -5,19 +5,26 @@
}
function deb(wait: number) {
return (key: string) =>
- function debounced<P>(Comp: React.ComponentClass<P>) {
- class Debounced<F extends Function> extends React.Component<P> {
+ function debounced<P>(Comp: React.ComponentType<P>) {
+ class Debounced<F extends () => void> extends React.Component<P> {
method: F & _.Cancelable;
constructor(props: P & IDebouncedProps) {
super(props);
this.method = debounce<F>(props[key] as F, wait);
}
componentWillUnmount() {
- this.method.cancel();
+ this.method.flush();
+ }
+ componentWillReceiveProps(nextProps: P) {
+ if (nextProps[key] !== this.props[key]) {
+ this.method.flush();
+ this.method = debounce<F>(nextProps[key] as F, wait);
+ }
}
render() {
+ // tslint:disable-next-line:prefer-object-spread
const newProps = Object.assign({}, this.props, {
- [key]: this.method
+ [key]: this.method,
});
return <Comp {...newProps} />;
}
@@ -25,5 +32,4 @@
return Debounced;
};
}
-
export default deb(600); |
57f55f7381d7d900931927288885b6a78e5f69b7 | config/Scripts/Selection-hidden.ts | config/Scripts/Selection-hidden.ts | 'use strict';
import {arrayEquivalent, keysAndValues, isNot, undefinedOrEmpty} from 'tsfun';
import {pureName} from 'idai-components-2';
const fs = require('fs');
const projectName: string = 'WES';
const selection = JSON.parse(fs.readFileSync(projectName === '' ? 'Selection-Default.json' : 'Selection-' + projectName + '.json'));
const hidden = JSON.parse(fs.readFileSync(projectName === '' ? 'Hidden.json' : 'Hidden-' + projectName + '.json'));
keysAndValues(hidden).forEach(([hiddenTypeName, hiddenValues]) => {
// find in selection
keysAndValues(selection).forEach(([selectionTypeName, selectionType]) => {
const selectionTypePureName = pureName(selectionTypeName);
if (selectionTypePureName === hiddenTypeName) {
if (isNot(undefinedOrEmpty)(selectionType['hidden'])) {
console.error('hidden already exists, ', hiddenTypeName)
} else {
selectionType['hidden'] = hiddenValues;
}
}
});
});
fs.writeFileSync(projectName === '' ? 'Selection-Default.json' : 'Selection-' + projectName + '.json', JSON.stringify(selection, null, 2)); | 'use strict';
import {arrayEquivalent, keysAndValues, isNot, undefinedOrEmpty} from 'tsfun';
const fs = require('fs');
const projectName: string = 'WES';
const selection = JSON.parse(fs.readFileSync(projectName === '' ? 'Selection-Default.json' : 'Selection-' + projectName + '.json'));
const hidden = JSON.parse(fs.readFileSync(projectName === '' ? 'Hidden.json' : 'Hidden-' + projectName + '.json'));
keysAndValues(hidden).forEach(([hiddenTypeName, hiddenValues]) => {
// find in selection
keysAndValues(selection).forEach(([selectionTypeName, selectionType]) => {
// const selectionTypePureName = pureName(selectionTypeName);
// if (selectionTypePureName === hiddenTypeName) {
//
// if (isNot(undefinedOrEmpty)(selectionType['hidden'])) {
// console.error('hidden already exists, ', hiddenTypeName)
// } else {
// selectionType['hidden'] = hiddenValues;
// }
// }
});
});
fs.writeFileSync(projectName === '' ? 'Selection-Default.json' : 'Selection-' + projectName + '.json', JSON.stringify(selection, null, 2)); | Remove use of missing function in script | Remove use of missing function in script
| TypeScript | apache-2.0 | codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client | ---
+++
@@ -1,7 +1,6 @@
'use strict';
import {arrayEquivalent, keysAndValues, isNot, undefinedOrEmpty} from 'tsfun';
-import {pureName} from 'idai-components-2';
const fs = require('fs');
@@ -19,15 +18,15 @@
// find in selection
keysAndValues(selection).forEach(([selectionTypeName, selectionType]) => {
- const selectionTypePureName = pureName(selectionTypeName);
- if (selectionTypePureName === hiddenTypeName) {
-
- if (isNot(undefinedOrEmpty)(selectionType['hidden'])) {
- console.error('hidden already exists, ', hiddenTypeName)
- } else {
- selectionType['hidden'] = hiddenValues;
- }
- }
+ // const selectionTypePureName = pureName(selectionTypeName);
+ // if (selectionTypePureName === hiddenTypeName) {
+ //
+ // if (isNot(undefinedOrEmpty)(selectionType['hidden'])) {
+ // console.error('hidden already exists, ', hiddenTypeName)
+ // } else {
+ // selectionType['hidden'] = hiddenValues;
+ // }
+ // }
});
});
|
ce684ec1d39144b5247a81ea3d74fd02f07061a8 | src/client/socket.ts | src/client/socket.ts | import { baseUrl, callId, userId } from './window'
import { SocketEvent, TypedEmitter } from '../shared'
import { SocketClient } from './ws'
export type ClientSocket = TypedEmitter<SocketEvent>
const wsUrl = location.origin.replace(/^http/, 'ws') +
baseUrl + '/ws-server/' + callId + '/' + userId
export default new SocketClient<SocketEvent>(wsUrl)
| import { baseUrl, callId, userId } from './window'
import { SocketEvent, TypedEmitter } from '../shared'
import { SocketClient } from './ws'
export type ClientSocket = TypedEmitter<SocketEvent>
const wsUrl = location.origin.replace(/^http/, 'ws') +
baseUrl + '/ws/' + callId + '/' + userId
export default new SocketClient<SocketEvent>(wsUrl)
| Use a single /ws url | Use a single /ws url
| TypeScript | mit | jeremija/peer-calls,jeremija/peer-calls,jeremija/peer-calls | ---
+++
@@ -4,6 +4,6 @@
export type ClientSocket = TypedEmitter<SocketEvent>
const wsUrl = location.origin.replace(/^http/, 'ws') +
- baseUrl + '/ws-server/' + callId + '/' + userId
+ baseUrl + '/ws/' + callId + '/' + userId
export default new SocketClient<SocketEvent>(wsUrl) |
4453da7cb1db8b53a66a7324fa69dc4e3fd82f3c | src/main/load-url.ts | src/main/load-url.ts | import { join } from "path"
import { format } from "url"
export const loadURL = (
window: Electron.BrowserWindow,
appPath: string,
showStorybook: boolean = false,
): void => {
if (showStorybook) {
window.loadURL("http://localhost:6006")
} else {
window.loadURL(
format({
pathname: join(appPath, "out/index.html"),
protocol: "file:",
slashes: true,
}),
)
}
}
| import { join } from "path"
import { format } from "url"
export const loadURL = (
window: Electron.BrowserWindow,
appPath: string,
showStorybook = false,
): void => {
if (showStorybook) {
window.loadURL("http://localhost:6006")
} else {
window.loadURL(
format({
pathname: join(appPath, "out/index.html"),
protocol: "file:",
slashes: true,
}),
)
}
}
| Remove unneded boolean type annotation | Remove unneded boolean type annotation
| TypeScript | agpl-3.0 | briandk/transcriptase,briandk/transcriptase | ---
+++
@@ -4,7 +4,7 @@
export const loadURL = (
window: Electron.BrowserWindow,
appPath: string,
- showStorybook: boolean = false,
+ showStorybook = false,
): void => {
if (showStorybook) {
window.loadURL("http://localhost:6006") |
36c61d36a4c248165d76c01905ed90f585879245 | src/controllers/homeController.ts | src/controllers/homeController.ts | import { Request, Response } from 'express';
import type { IBoard } from '../types/trello';
import { TrelloService } from '../services/trelloService';
export function index(_: Request, res: Response): Response {
return res.send(':)');
}
export async function healthCheck(_: Request, res: Response): Promise<Response> {
try {
const trello = new TrelloService();
const boards = await trello.listBoards();
return res.json({
ok: true,
boards: boards.map((board: IBoard) => board.name),
});
} catch (ex) {
return res.status(500).json({
ok: false,
err: {
code: ex.code,
message: ex.message,
stack: ex.stack,
},
});
}
}
| import { Request, Response } from 'express';
import type { IBoard } from '../types/trello';
import { TrelloService } from '../services/trelloService';
export function index(_: Request, res: Response): Response {
return res.send(`:)<br />${process.env.GIT_REV || ''}`);
}
export async function healthCheck(_: Request, res: Response): Promise<Response> {
try {
const trello = new TrelloService();
const boards = await trello.listBoards();
return res.json({
ok: true,
boards: boards.map((board: IBoard) => board.name),
});
} catch (ex) {
return res.status(500).json({
ok: false,
err: {
code: ex.code,
message: ex.message,
stack: ex.stack,
},
});
}
}
| Include git hash for index view | Include git hash for index view
| TypeScript | bsd-3-clause | mpirik/github-trello-card-events,mpirik/github-trello-card-events,mpirik/github-trello-card-events | ---
+++
@@ -3,7 +3,7 @@
import { TrelloService } from '../services/trelloService';
export function index(_: Request, res: Response): Response {
- return res.send(':)');
+ return res.send(`:)<br />${process.env.GIT_REV || ''}`);
}
export async function healthCheck(_: Request, res: Response): Promise<Response> { |
3be93671f79ae923ab424ac15dfdafeae488ada5 | subscribe/index.d.ts | subscribe/index.d.ts | import { Component, Context } from 'react'
import { Channel } from '../use-subscription'
interface Subscriber<Props> {
(props: Props): Channel[]
}
interface Wrapper {
(component: Component): Component
}
type SubscribeOptions = {
/**
* Context with the store.
*/
context?: Context<object>
/**
* Change default `isSubscribing` property.
*/
subscribingProp?: string
}
/**
* Decorator to add subscribe action on component mount and unsubscribe
* on unmount.
*
* ```js
* import subscribe from '@logux/redux'
* class User extends React.Component { … }
* export default subscribe(({ id }) => `user/${ id }`)(User)
* ```
*
* ```js
* import subscribe from '@logux/redux'
* class User extends React.Component { … }
* const SubscribeUser = subscribe(props => {
* return { channel: `user/${ props.id }`, fields: ['name'] }
* })(User)
* ```
*
* @param subscriber Callback to return subscribe action properties according
* to component props.
* @param opts Options.
*
* @return Class wrapper.
*/
export function subscribe<Props = object>(
subscriber: Subscriber<Props>,
opts?: SubscribeOptions
): Wrapper
| import { Component, Context as ReduxContext } from 'react'
import { Channel } from '../use-subscription'
interface Subscriber<Props> {
(props: Props): Channel[]
}
interface Wrapper {
(component: Component): Component
}
type SubscribeOptions = {
/**
* Context with the store.
*/
context?: ReduxContext<object>
/**
* Change default `isSubscribing` property.
*/
subscribingProp?: string
}
/**
* Decorator to add subscribe action on component mount and unsubscribe
* on unmount.
*
* ```js
* import subscribe from '@logux/redux'
* class User extends React.Component { … }
* export default subscribe(({ id }) => `user/${ id }`)(User)
* ```
*
* ```js
* import subscribe from '@logux/redux'
* class User extends React.Component { … }
* const SubscribeUser = subscribe(props => {
* return { channel: `user/${ props.id }`, fields: ['name'] }
* })(User)
* ```
*
* @param subscriber Callback to return subscribe action properties according
* to component props.
* @param opts Options.
*
* @return Class wrapper.
*/
export function subscribe<Props = object>(
subscriber: Subscriber<Props>,
opts?: SubscribeOptions
): Wrapper
| Fix name conflict with server Context type | Fix name conflict with server Context type
| TypeScript | mit | logux/logux-redux | ---
+++
@@ -1,4 +1,4 @@
-import { Component, Context } from 'react'
+import { Component, Context as ReduxContext } from 'react'
import { Channel } from '../use-subscription'
@@ -14,7 +14,7 @@
/**
* Context with the store.
*/
- context?: Context<object>
+ context?: ReduxContext<object>
/**
* Change default `isSubscribing` property. |
34a166426530275adb7f7c98a5e82404ce9f07b3 | src/services/consentRepository.ts | src/services/consentRepository.ts | export module ConsentRepository {
let cookieConsentPromiseResolve: any;
const cookieConsentPromise = new Promise<void>(((resolve, reject) => {
cookieConsentPromiseResolve = resolve;
}));
export function getCookieConsent() : Promise<void> {
return cookieConsentPromise;
}
export function consentToUsingCookies() {
cookieConsentPromiseResolve();
}
export function alreadyConsentedToUsingCookies(): boolean {
return false;
}
if (alreadyConsentedToUsingCookies()) {
consentToUsingCookies();
}
} | export module ConsentRepository {
const consentedCookieStorageKey = 'consented-cookies';
let cookieConsentPromiseResolve: any;
const cookieConsentPromise = new Promise<void>(((resolve, reject) => {
cookieConsentPromiseResolve = resolve;
}));
export function getCookieConsent() : Promise<void> {
return cookieConsentPromise;
}
export function consentToUsingCookies() {
localStorage.setItem(consentedCookieStorageKey, 'true');
cookieConsentPromiseResolve();
}
export function alreadyConsentedToUsingCookies(): boolean {
return localStorage.getItem(consentedCookieStorageKey) == 'true';
}
if (alreadyConsentedToUsingCookies()) {
consentToUsingCookies();
}
} | Store cookie consent in local storage | Store cookie consent in local storage
| TypeScript | mit | danij/Forum.WebClient,danij/Forum.WebClient,danij/Forum.WebClient,danij/Forum.WebClient | ---
+++
@@ -1,5 +1,6 @@
export module ConsentRepository {
+ const consentedCookieStorageKey = 'consented-cookies';
let cookieConsentPromiseResolve: any;
const cookieConsentPromise = new Promise<void>(((resolve, reject) => {
@@ -14,12 +15,13 @@
export function consentToUsingCookies() {
+ localStorage.setItem(consentedCookieStorageKey, 'true');
cookieConsentPromiseResolve();
}
export function alreadyConsentedToUsingCookies(): boolean {
- return false;
+ return localStorage.getItem(consentedCookieStorageKey) == 'true';
}
if (alreadyConsentedToUsingCookies()) { |
69bfde26bd90c646a30a1d4faee80eab22924fc7 | src/layout/BlankSpace.tsx | src/layout/BlankSpace.tsx | import * as React from "react";
import * as LiveSplit from "../livesplit";
export interface Props { state: LiveSplit.BlankSpaceComponentStateJson }
export default class BlankSpace extends React.Component<Props> {
public render() {
return (
<div
className="blank-space"
style={{
height: this.props.state.height,
}}
/>
);
}
}
| import * as React from "react";
import * as LiveSplit from "../livesplit";
import { gradientToCss } from "../util/ColorUtil";
export interface Props { state: LiveSplit.BlankSpaceComponentStateJson }
export default class BlankSpace extends React.Component<Props> {
public render() {
return (
<div
className="blank-space"
style={{
height: this.props.state.height,
background: gradientToCss(this.props.state.background),
}}
/>
);
}
}
| Fix Blank Space Component Background | Fix Blank Space Component Background
For some reason the background of the Blank Space Component was never rendered. | TypeScript | mit | CryZe/LiveSplitOne,CryZe/LiveSplitOne,CryZe/LiveSplitOne,CryZe/LiveSplitOne | ---
+++
@@ -1,5 +1,6 @@
import * as React from "react";
import * as LiveSplit from "../livesplit";
+import { gradientToCss } from "../util/ColorUtil";
export interface Props { state: LiveSplit.BlankSpaceComponentStateJson }
@@ -10,6 +11,7 @@
className="blank-space"
style={{
height: this.props.state.height,
+ background: gradientToCss(this.props.state.background),
}}
/>
); |
6498f921c31782a17d5df9596fffff10573ab10f | test/DispatchSpec.ts | test/DispatchSpec.ts | import Dispatch from '../src/Dispatcher';
import * as chai from 'chai';
const expect = chai.expect;
import * as path from 'path';
describe('Dispatch', function () {
let dispatch: Dispatch;
beforeEach(function () {
dispatch = new Dispatch();
});
it('Dispatches to Cat', function (done) {
dispatch
.dispatch('cat', ['one', 'two']
.map((f) => path.resolve(__dirname + '/fixtures/' + f)))
.then((results) => expect(results).to.be.deep.equal(['1', '2', '2', '3']))
.then(() => done())
.catch(done);
});
});
| import Dispatch, { DispatcherStandardInputStream } from '../src/Dispatcher';
import { Split } from '../src/TextOperations';
import { BasicStreamHandlerDelegate } from './BasicStreamHandler'
import * as chai from 'chai';
const expect = chai.expect;
import { stdio } from 'stdio-mock';
import * as path from 'path';
describe('Dispatch', function () {
let dispatch: Dispatch;
beforeEach(function () {
dispatch = new Dispatch();
});
it('Dispatches to Cat', function (done) {
dispatch
.dispatch('cat', ['one', 'two']
.map((f) => path.resolve(__dirname + '/fixtures/' + f)))
.then((results) => expect(results).to.be.deep.equal(['1', '2', '2', '3']))
.then(() => done())
.catch(done);
});
});
describe('DispatcherStandardInputStream', function () {
let dispatch: DispatcherStandardInputStream;
let handlerDelegate: BasicStreamHandlerDelegate;
let stdin: any;
beforeEach(function() {
handlerDelegate = new BasicStreamHandlerDelegate();
stdin = stdio().stdin;
dispatch = new DispatcherStandardInputStream(handlerDelegate, stdin);
});
it('Dispatches a basic split async operation', function (done) {
const split = new Split();
dispatch
.dispatch(split, [`--input-delimiter`, ` `, `--output-delimiter`, `,`])
.then(() => expect(handlerDelegate.buffer).to.deep.equal(['hello,world']))
.then(() => done())
.catch((err) => console.log(err));
stdin.write('hello world');
stdin.end();
});
});
| Add test for refactored dispatcher | Add test for refactored dispatcher
| TypeScript | mit | hershal/fp-cli-ts,hershal/fp-cli-ts | ---
+++
@@ -1,9 +1,13 @@
-import Dispatch from '../src/Dispatcher';
+import Dispatch, { DispatcherStandardInputStream } from '../src/Dispatcher';
+import { Split } from '../src/TextOperations';
+import { BasicStreamHandlerDelegate } from './BasicStreamHandler'
import * as chai from 'chai';
const expect = chai.expect;
+import { stdio } from 'stdio-mock';
import * as path from 'path';
+
describe('Dispatch', function () {
let dispatch: Dispatch;
@@ -21,3 +25,27 @@
.catch(done);
});
});
+
+
+describe('DispatcherStandardInputStream', function () {
+ let dispatch: DispatcherStandardInputStream;
+ let handlerDelegate: BasicStreamHandlerDelegate;
+ let stdin: any;
+
+ beforeEach(function() {
+ handlerDelegate = new BasicStreamHandlerDelegate();
+ stdin = stdio().stdin;
+ dispatch = new DispatcherStandardInputStream(handlerDelegate, stdin);
+ });
+
+ it('Dispatches a basic split async operation', function (done) {
+ const split = new Split();
+ dispatch
+ .dispatch(split, [`--input-delimiter`, ` `, `--output-delimiter`, `,`])
+ .then(() => expect(handlerDelegate.buffer).to.deep.equal(['hello,world']))
+ .then(() => done())
+ .catch((err) => console.log(err));
+ stdin.write('hello world');
+ stdin.end();
+ });
+}); |
6fa4979fab35c295bb31fcadb70b83367925d1c7 | app/components/classroomLessons/play/feedbackRow.tsx | app/components/classroomLessons/play/feedbackRow.tsx | import React from 'react';
export default () => <div className="feedback-row">
<p><i className="fa fa-check-circle" aria-hidden="true" />Great Work! Please wait as your teacher reviews your answer...</p>
</div>
| import React from 'react';
export default () => <div className="feedback-row">
<p><i className="fa fa-check-circle" aria-hidden="true" />Please wait as your teacher reviews your response...</p>
</div>
| Update copy for wait while teacher reviews | Update copy for wait while teacher reviews
| TypeScript | agpl-3.0 | empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core,empirical-org/Empirical-Core | ---
+++
@@ -1,5 +1,5 @@
import React from 'react';
export default () => <div className="feedback-row">
- <p><i className="fa fa-check-circle" aria-hidden="true" />Great Work! Please wait as your teacher reviews your answer...</p>
+ <p><i className="fa fa-check-circle" aria-hidden="true" />Please wait as your teacher reviews your response...</p>
</div> |
9058030303bf3a7c334c35348c8d057fde626449 | index.ts | index.ts | export class Semaphore {
private tasks: (() => void)[] = [];
count: number;
constructor(count: number) {
this.count = count;
}
private sched() {
if (this.count > 0 && this.tasks.length > 0) {
this.count--;
let next = this.tasks.shift();
if (next === undefined) {
throw "Unexpected undefined value in tasks list";
}
next();
}
}
public acquire() {
return new Promise<() => void>((res, rej) => {
var task = () => {
var released = false;
res(() => {
if (!released) {
released = true;
this.count++;
this.sched();
}
});
};
this.tasks.push(task);
process.nextTick(this.sched.bind(this));
});
}
public use<T>(f: () => Promise<T>) {
return this.acquire()
.then(release => {
return f()
.then((res) => {
release();
return res;
})
.catch((err) => {
release();
throw err;
});
});
}
}
export class Mutex extends Semaphore {
constructor() {
super(1);
}
} | export class Semaphore {
private tasks: (() => void)[] = [];
count: number;
constructor(count: number) {
this.count = count;
}
private sched() {
if (this.count > 0 && this.tasks.length > 0) {
this.count--;
let next = this.tasks.shift();
if (next === undefined) {
throw "Unexpected undefined value in tasks list";
}
next();
}
}
public acquire() {
return new Promise<() => void>((res, rej) => {
var task = () => {
var released = false;
res(() => {
if (!released) {
released = true;
this.count++;
this.sched();
}
});
};
this.tasks.push(task);
if (process && process.nextTick) {
process.nextTick(this.sched.bind(this));
} else {
setImmediate(this.sched.bind(this));
}
});
}
public use<T>(f: () => Promise<T>) {
return this.acquire()
.then(release => {
return f()
.then((res) => {
release();
return res;
})
.catch((err) => {
release();
throw err;
});
});
}
}
export class Mutex extends Semaphore {
constructor() {
super(1);
}
}
| Use setImmediate when process.nextTick is undefined | Use setImmediate when process.nextTick is undefined
| TypeScript | mit | notenoughneon/await-semaphore | ---
+++
@@ -31,7 +31,11 @@
});
};
this.tasks.push(task);
- process.nextTick(this.sched.bind(this));
+ if (process && process.nextTick) {
+ process.nextTick(this.sched.bind(this));
+ } else {
+ setImmediate(this.sched.bind(this));
+ }
});
}
|
0fd5086618a2d30b661395e3b203e611d68a793b | tests/jsonparsing.ts | tests/jsonparsing.ts | import epcis = require('../lib/epcisevents');
var assert = require('assert');
var sleep = require('sleep');
describe('Parse json string back to our EPCIS objects', function () {
this.timeout(10000);
it('basic parsing', function (done) {
var event1 = new epcis.EPCIS.EpcisEvent();
event1.type = 'DummyEvent';
var dt = new Date();
event1.eventTime = dt;
assert.strictEqual(event1.eventTime, dt, 'Assigning did not work');
var str = JSON.stringify(event1, null, 4);
// to make sure we don't have any default date set
sleep.sleep(3);
// parse it back
var event2 = new epcis.EPCIS.EpcisEvent();
event2.loadFromJson(str);
var date2 = new Date();
assert.equal(event2.type, 'DummyEvent');
var str1 = event2.eventTime.toISOString();
var str2 = dt.toISOString()
assert.equal(str1, str2);
// since Date is an object we can not directly compare them!
assert.ok(event2.eventTime.getTime() === dt.getTime());
done();
});
});
| import epcis = require('../lib/epcisevents');
var assert = require('assert');
var sleep = require('sleep');
describe('Parse json string back to our EPCIS objects', function () {
this.timeout(10000);
it('basic parsing', function (done) {
var event1 = new epcis.EPCIS.EpcisEvent();
event1.type = 'DummyEvent';
var dt = new Date();
event1.eventTime = dt;
assert.strictEqual(event1.eventTime, dt, 'Assigning did not work');
var str = JSON.stringify(event1, null, 4);
// to make sure we don't have any default date set
sleep.sleep(3);
// parse it back
var event2 = epcis.EPCIS.EpcisEvent.loadFromJson(str);
assert.equal(event2.type, 'DummyEvent');
var str1 = event2.eventTime.toISOString();
var str2 = dt.toISOString()
assert.equal(str1, str2);
// since Date is an object we can not directly compare them!
assert.ok(event2.eventTime.getTime() === dt.getTime());
done();
});
});
| Update test cases to make use of static loadFrom* functions | Update test cases to make use of static loadFrom* functions
| TypeScript | mit | matgnt/epcis-js,matgnt/epcis-js | ---
+++
@@ -17,9 +17,7 @@
sleep.sleep(3);
// parse it back
- var event2 = new epcis.EPCIS.EpcisEvent();
- event2.loadFromJson(str);
- var date2 = new Date();
+ var event2 = epcis.EPCIS.EpcisEvent.loadFromJson(str);
assert.equal(event2.type, 'DummyEvent');
var str1 = event2.eventTime.toISOString(); |
b90c12c2ea7c037bf4d56ecce7b1e1d7f392138f | game/hordetest/hud/src/components/hud/Chat/index.tsx | game/hordetest/hud/src/components/hud/Chat/index.tsx | /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import React from 'react';
import { styled } from '@csegames/linaria/react';
import { useChatPanes } from './state/panesState';
import { Pane } from './views/Pane';
const Screen = styled.div`
position: absolute;
width: 100%;
height: 100%;
pointer-events: none !important;
`;
export interface Props {
}
export function Chat(props: Props) {
const [panes] = useChatPanes();
const panesArr = Object.values(panes.panes);
return (
<Screen id='chat'>
{panesArr.map(pane => <Pane key={pane.id} pane={pane.id} />)}
</Screen>
);
}
| /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import React from 'react';
import { styled } from '@csegames/linaria/react';
import { useChatPanes } from './state/panesState';
import { Pane } from './views/Pane';
const Screen = styled.div`
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none !important;
`;
export interface Props {
}
export function Chat(props: Props) {
const [panes] = useChatPanes();
const panesArr = Object.values(panes.panes);
return (
<Screen id='chat'>
{panesArr.map(pane => <Pane key={pane.id} pane={pane.id} />)}
</Screen>
);
}
| Fix chat pushing DevUIs away | Fix chat pushing DevUIs away
| TypeScript | mpl-2.0 | csegames/Camelot-Unchained,csegames/Camelot-Unchained,csegames/Camelot-Unchained | ---
+++
@@ -11,6 +11,10 @@
const Screen = styled.div`
position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
width: 100%;
height: 100%;
pointer-events: none !important; |
93b316b3ca34dbd4145eb5d6bee26b027da8c9d0 | src/util/hammingWeight.ts | src/util/hammingWeight.ts | // Binary sideways addition
// See: http://jsperf.com/hamming-weight
const hammingWeight = (x: number): number => {
x -= ((x >> 1) & 0x55555555)
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x += (x >> 8)
x += (x >> 16)
return x & 0x7f
}
export default hammingWeight
| // Binary sideways addition
// See: http://jsperf.com/hamming-weight
const hammingWeight = (x: number): number => {
x = x - ((x >> 1) & 0x55555555)
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
x = x + (x >> 8)
x = x + (x >> 16)
return x & 0x7f
}
export default hammingWeight
| Remove shorthand operations in hamming weight util | Remove shorthand operations in hamming weight util
| TypeScript | cc0-1.0 | philpl/hachiko,philpl/hachiko | ---
+++
@@ -1,11 +1,11 @@
// Binary sideways addition
// See: http://jsperf.com/hamming-weight
const hammingWeight = (x: number): number => {
- x -= ((x >> 1) & 0x55555555)
+ x = x - ((x >> 1) & 0x55555555)
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f
- x += (x >> 8)
- x += (x >> 16)
+ x = x + (x >> 8)
+ x = x + (x >> 16)
return x & 0x7f
}
|
586c463e40486d38dbfbb4618ba082faed94adcf | backend/src/loaders/expressLoader.ts | backend/src/loaders/expressLoader.ts | import express from "express";
import cors from 'cors';
const load = async (origin: string) => {
const app = express();
app.disable('x-powered-by');
//options for cors midddleware
const options: cors.CorsOptions = {
allowedHeaders: [
'Origin',
'X-Requested-With',
'Content-Type',
'Accept',
'X-Access-Token',
],
credentials: true,
methods: 'GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE',
origin: origin,
preflightContinue: false,
};
app.use(cors(options));
app.use(express.json());
app.get('/status', (_req, res) => { res.status(200).end(); });
app.head('/status', (_req, res) => { res.status(200).end(); });
return app;
}
export { load };
| import express from "express";
import cors from 'cors';
const load = async (origin: string) => {
const app = express();
app.disable('x-powered-by');
//options for cors midddleware
const options: cors.CorsOptions = { origin };
app.use(cors(options));
app.use(express.json());
app.get('/status', (_req, res) => { res.status(200).end(); });
app.head('/status', (_req, res) => { res.status(200).end(); });
return app;
}
export { load };
| Remove unused options from backend express server | Remove unused options from backend express server
| TypeScript | mit | jasoncabot/gardenpath,jasoncabot/gardenpath,jasoncabot/gardenpath | ---
+++
@@ -5,19 +5,7 @@
const app = express();
app.disable('x-powered-by');
//options for cors midddleware
- const options: cors.CorsOptions = {
- allowedHeaders: [
- 'Origin',
- 'X-Requested-With',
- 'Content-Type',
- 'Accept',
- 'X-Access-Token',
- ],
- credentials: true,
- methods: 'GET,HEAD,OPTIONS,PUT,PATCH,POST,DELETE',
- origin: origin,
- preflightContinue: false,
- };
+ const options: cors.CorsOptions = { origin };
app.use(cors(options));
app.use(express.json());
|
fb859ac18139a66b2ff220a9dff22f5102ec5519 | app/components/Welcome/Welcome.tsx | app/components/Welcome/Welcome.tsx | import React from 'react';
import styled from '../../styles/styled-components';
import ButtonList from './ButtonList';
import RecentFileList from './RecentFileList';
const Wrapper = styled.div`
display: flex;
flex: 1;
`;
interface Props {
subtitleReady: boolean;
videoReady: boolean;
newData(): void;
}
const Welcome: React.SFC<Props> = ({ subtitleReady, videoReady, newData }) => (
<Wrapper>
<ButtonList
subtitleReady={subtitleReady}
videoReady={videoReady}
newData={newData}
/>
<RecentFileList />
</Wrapper>
);
export default Welcome;
| import React from 'react';
import styled from '../../styles/styled-components';
import ButtonList from './ButtonList';
import RecentFileList from './RecentFileList';
const Wrapper = styled.div`
display: flex;
flex: 1;
`;
interface Props {
subtitleReady: boolean;
videoReady: boolean;
newData(): void;
}
const Welcome: React.SFC<Props> = ({ subtitleReady, videoReady, newData }) => (
<Wrapper>
<ButtonList
subtitleReady={subtitleReady}
videoReady={videoReady}
newData={newData}
/>
{/* <RecentFileList /> */}
</Wrapper>
);
export default Welcome;
| Hide recent files in welcome page until develop finished | Hide recent files in welcome page until develop finished
| TypeScript | mit | drakang4/jamak,Heeryong-Kang/jamak,Heeryong-Kang/jamak,drakang4/jamak,drakang4/jamak | ---
+++
@@ -22,7 +22,7 @@
videoReady={videoReady}
newData={newData}
/>
- <RecentFileList />
+ {/* <RecentFileList /> */}
</Wrapper>
);
|
e299605ff5bccca0f7b2b06d9b6cb27840fa7470 | index.ts | index.ts | import * as React from 'react'
import { observer } from 'mobx-react'
export default function<M>(Wrapped: React.ComponentClass<M> | React.SFC<M>) {
@observer
class MobxWrapper extends React.Component<{ model: M }, void> {
render() {
return React.createElement(Wrapped, this.props.model)
}
}
return MobxWrapper as React.ComponentClass<{ model: M }>
}
| import * as React from 'react'
import { observer } from 'mobx-react'
export default function<M>(Wrapped: React.ComponentClass<M> | React.StatelessComponent<M>) {
@observer
class MobxWrapper extends React.Component<{ model: M }, void> {
render() {
return React.createElement(observer(Wrapped as any), this.props.model)
}
}
return MobxWrapper as React.ComponentClass<{ model: M }>
}
| Fix failing to observe wrapped component | Fix failing to observe wrapped component
| TypeScript | mit | pelotom/mobx-component | ---
+++
@@ -1,12 +1,12 @@
import * as React from 'react'
import { observer } from 'mobx-react'
-export default function<M>(Wrapped: React.ComponentClass<M> | React.SFC<M>) {
+export default function<M>(Wrapped: React.ComponentClass<M> | React.StatelessComponent<M>) {
@observer
class MobxWrapper extends React.Component<{ model: M }, void> {
render() {
- return React.createElement(Wrapped, this.props.model)
+ return React.createElement(observer(Wrapped as any), this.props.model)
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.