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 |
|---|---|---|---|---|---|---|---|---|---|---|
689f92b793124078239d103a2a10dd7724bf6676 | src/site/components/SiteHeader.tsx | src/site/components/SiteHeader.tsx | import * as React from 'react';
import * as config from '../../config';
interface Props {
pageType: string;
}
export default function SiteHeader({pageType}: Props) {
return (
<header className="site-header">
<h1 className="site-header__title">
<a href="/">
Game Boy hardware database
<aside>by Gekkio and contributors</aside>
</a>
</h1>
<Navigation pageType={pageType} />
</header>
)
}
const models = config.consoles.map(type => [type.toUpperCase(), type, config.consoleCfgs[type].name])
function isModel(pageType: string, code: string) {
return pageType === code || pageType === `${code}-console`
}
function Navigation({pageType}: Props) {
return (
<nav className="site-navigation">
<ul>{
models.map(([model, code, name]) => (
<li key={code} className={(isModel(pageType, code)) ? 'active' : undefined}>
<a href={`/consoles/${code}`}>
<strong>{model}</strong>
<span className="name">{name}</span>
</a>
</li>
))
}</ul>
</nav>
)
}
| import * as React from 'react';
import * as config from '../../config';
interface Props {
pageType: string;
}
export default function SiteHeader({pageType}: Props) {
return (
<header className="site-header">
<h1 className="site-header__title">
<a href="/">
Game Boy hardware database
<aside>by Gekkio and contributors</aside>
</a>
</h1>
<Navigation pageType={pageType} />
</header>
)
}
const models = config.consoles.map(type => [type.toUpperCase(), type, config.consoleCfgs[type].name]);
function isModel(pageType: string, code: string) {
return pageType === code || pageType === `${code}-console`
}
function isInCartridges(pageType: string): boolean {
return pageType === 'cartridges' || pageType === 'cartridge' || pageType === 'game' || pageType === 'mapper';
}
function Navigation({pageType}: Props) {
return (
<nav className="site-navigation">
<ul>
{
models.map(([model, code, name]) => (
<li key={code} className={(isModel(pageType, code)) ? 'active' : undefined}>
<a href={`/consoles/${code}`}>
<strong>{model}</strong>
<span className="name">{name}</span>
</a>
</li>
))
}
<li className={isInCartridges(pageType) ? 'active' : undefined}>
<a href="/cartridges">Game<br />cartridges</a>
</li>
</ul>
</nav>
)
}
| Add cartridges section to navigation | Add cartridges section to navigation
| TypeScript | mit | Gekkio/gb-hardware-db | ---
+++
@@ -20,25 +20,34 @@
)
}
-const models = config.consoles.map(type => [type.toUpperCase(), type, config.consoleCfgs[type].name])
+const models = config.consoles.map(type => [type.toUpperCase(), type, config.consoleCfgs[type].name]);
function isModel(pageType: string, code: string) {
return pageType === code || pageType === `${code}-console`
}
+function isInCartridges(pageType: string): boolean {
+ return pageType === 'cartridges' || pageType === 'cartridge' || pageType === 'game' || pageType === 'mapper';
+}
+
function Navigation({pageType}: Props) {
return (
<nav className="site-navigation">
- <ul>{
- models.map(([model, code, name]) => (
- <li key={code} className={(isModel(pageType, code)) ? 'active' : undefined}>
- <a href={`/consoles/${code}`}>
- <strong>{model}</strong>
- <span className="name">{name}</span>
- </a>
- </li>
- ))
- }</ul>
+ <ul>
+ {
+ models.map(([model, code, name]) => (
+ <li key={code} className={(isModel(pageType, code)) ? 'active' : undefined}>
+ <a href={`/consoles/${code}`}>
+ <strong>{model}</strong>
+ <span className="name">{name}</span>
+ </a>
+ </li>
+ ))
+ }
+ <li className={isInCartridges(pageType) ? 'active' : undefined}>
+ <a href="/cartridges">Game<br />cartridges</a>
+ </li>
+ </ul>
</nav>
)
} |
422be766954c4204fcac9c37b263fb1182ae55d5 | src/app/app-routing.module.ts | src/app/app-routing.module.ts | import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PageComponent } from './page/page.component';
const routes: Routes = [
{ path: '', redirectTo: '/main', pathMatch: 'full' },
{ path: 'main', component: PageComponent, data: {section: 'main'} },
{ path: 'about', component: PageComponent, data: {section: 'about'} },
{ path: 'about/:subsection', component: PageComponent, data: {section: 'about'} },
{ path: 'articles', component: PageComponent, data: {section: 'articles'} },
{ path: 'articles/:subsection', component: PageComponent, data: {section: 'articles'} },
{ path: 'gallery', component: PageComponent, data: {section: 'gallery'} },
{ path: 'gallery/:subsection', component: PageComponent, data: {section: 'gallery'} },
{ path: 'news', component: PageComponent, data: {section: 'news'} },
{ path: 'news/:subsection', component: PageComponent, data: {section: 'news'} },
{ path: 'form', component: PageComponent, data: {section: 'form'} },
{ path: '**', component: PageComponent, data: {section: '404'} }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
| import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PageComponent } from './page/page.component';
const routes: Routes = [
{ path: '', redirectTo: '/main', pathMatch: 'full' },
{ path: 'main', component: PageComponent, data: {section: 'main'} },
{ path: 'about', component: PageComponent, data: {section: 'about'} },
{ path: 'about/:subsection', component: PageComponent, data: {section: 'about'} },
{ path: 'articles', component: PageComponent, data: {section: 'articles'} },
{ path: 'articles/:subsection', component: PageComponent, data: {section: 'articles'} },
{ path: 'gallery', component: PageComponent, data: {section: 'gallery'} },
{ path: 'gallery/:subsection', component: PageComponent, data: {section: 'gallery'} },
{ path: 'news', component: PageComponent, data: {section: 'news'} },
{ path: 'news/:subsection', component: PageComponent, data: {section: 'news'} },
{ path: 'form', component: PageComponent, data: {section: 'form'} },
{ path: 'contact', component: PageComponent, data: {section: 'contact'} },
{ path: '**', component: PageComponent, data: {section: '404'} }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
| Add contact page to routing | Add contact page to routing
| TypeScript | mit | KeJSaR/artezian-info-web,KeJSaR/artezian-info-web,KeJSaR/artezian-info-web,KeJSaR/artezian-info-web | ---
+++
@@ -15,6 +15,7 @@
{ path: 'news', component: PageComponent, data: {section: 'news'} },
{ path: 'news/:subsection', component: PageComponent, data: {section: 'news'} },
{ path: 'form', component: PageComponent, data: {section: 'form'} },
+ { path: 'contact', component: PageComponent, data: {section: 'contact'} },
{ path: '**', component: PageComponent, data: {section: '404'} }
];
|
a3e650fffaafffaf0792a8166cbd7947b9ef841e | src/app/app.search.service.ts | src/app/app.search.service.ts | import { Injectable } from '@angular/core';
import {Subject} from "rxjs/Rx";
@Injectable()
export class SearchService {
private searchTerm: string;
private subcategories: any;
private productType: string;
searchChange: Subject<any> = new Subject<any>();
uiChange: Subject<any> = new Subject<any>();
getSearch()
{
return {
"productType": this.productType,
"searchTerm": this.searchTerm,
"subcategories": this.subcategories,
"termIds": this.getTermIds()
};
}
getTermIds()
{
let termIds = [];
for (var key in this.subcategories) {
if (this.subcategories.hasOwnProperty(key)) {
let value = this.subcategories[key];
if(value && value != "null")
termIds.push(value)
}
}
return termIds;
}
findAll()
{
this.searchChange.next(this.getSearch());
}
updateSearchParameters(productType, subcategories, updateUI=false)
{
this.productType = productType;
this.subcategories = subcategories;
this.searchChange.next(this.getSearch());
if(updateUI)
this.uiChange.next(this.getSearch())
}
setSearchTerm(searchTerm) {
this.searchTerm = searchTerm;
this.searchChange.next(this.getSearch());
}
}
| import { Injectable } from '@angular/core';
import {Subject} from "rxjs/Rx";
@Injectable()
export class SearchService {
private searchTerm: string;
private subcategories: any;
private productType: string;
searchChange: Subject<any> = new Subject<any>();
uiChange: Subject<any> = new Subject<any>();
getSearch()
{
return {
"productType": this.productType,
"searchTerm": this.searchTerm,
"subcategories": this.subcategories,
"termIds": this.getTermIds()
};
}
getTermIds()
{
let termIds = [];
console.log('subcats: ', this.subcategories);
for (var key in this.subcategories) {
if (this.subcategories.hasOwnProperty(key)) {
let value = this.subcategories[key];
console.log(value);
if(value && value != "null" && value != "undefined")
termIds.push(value)
}
}
return termIds;
}
findAll()
{
this.searchChange.next(this.getSearch());
}
updateSearchParameters(productType, subcategories, updateUI=false)
{
this.productType = productType;
this.subcategories = subcategories;
this.searchChange.next(this.getSearch());
if(updateUI)
this.uiChange.next(this.getSearch())
}
setSearchTerm(searchTerm) {
this.searchTerm = searchTerm;
this.searchChange.next(this.getSearch());
}
}
| Stop undefined terms being returned. | Stop undefined terms being returned.
| TypeScript | bsd-3-clause | UoA-eResearch/research-hub,UoA-eResearch/research-hub,UoA-eResearch/research-hub | ---
+++
@@ -22,10 +22,12 @@
getTermIds()
{
let termIds = [];
+ console.log('subcats: ', this.subcategories);
for (var key in this.subcategories) {
if (this.subcategories.hasOwnProperty(key)) {
let value = this.subcategories[key];
- if(value && value != "null")
+ console.log(value);
+ if(value && value != "null" && value != "undefined")
termIds.push(value)
}
} |
6adf6067eea275cf8272ba1c8ed763f89c08acd2 | tests/cases/fourslash/staticGenericOverloads1.ts | tests/cases/fourslash/staticGenericOverloads1.ts | /// <reference path='fourslash.ts'/>
////class A<T> {
//// static B<S>(v: A<S>): A<S>;
//// static B<S>(v: S): A<S>;
//// static B<S>(v: any): A<S> {
//// return null;
//// }
////}
////var a = new A<number>();
////A.B(/**/
goTo.marker();
verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>')
// BUG 701161
//edit.insert('a');
//verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>');
| /// <reference path='fourslash.ts'/>
////class A<T> {
//// static B<S>(v: A<S>): A<S>;
//// static B<S>(v: S): A<S>;
//// static B<S>(v: any): A<S> {
//// return null;
//// }
////}
////var a = new A<number>();
////A.B(a/**/
goTo.marker();
verify.currentSignatureHelpIs('B<S>(v: A<number>): A<number>')
edit.insert('); A.B(');
verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>');
edit.insert('a');
verify.currentSignatureHelpIs('B<S>(v: A<number>): A<number>')
| Update the test for the static generic overload | Update the test for the static generic overload
| TypeScript | apache-2.0 | popravich/typescript,hippich/typescript,hippich/typescript,fdecampredon/jsx-typescript-old-version,fdecampredon/jsx-typescript-old-version,popravich/typescript,mbebenita/shumway.ts,fdecampredon/jsx-typescript-old-version,popravich/typescript,hippich/typescript,mbebenita/shumway.ts,mbebenita/shumway.ts | ---
+++
@@ -9,10 +9,11 @@
////}
////var a = new A<number>();
-////A.B(/**/
+////A.B(a/**/
goTo.marker();
-verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>')
-// BUG 701161
-//edit.insert('a');
-//verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>');
+verify.currentSignatureHelpIs('B<S>(v: A<number>): A<number>')
+edit.insert('); A.B(');
+verify.currentSignatureHelpIs('B<S>(v: A<S>): A<S>');
+edit.insert('a');
+verify.currentSignatureHelpIs('B<S>(v: A<number>): A<number>') |
09f5b3367467585d00cd69ab9838641b01d460cb | app/pages/home/home.ts | app/pages/home/home.ts | import {Component} from '@angular/core';
import {NavController, Alert} from 'ionic-angular';
import {LocalNotifications} from 'ionic-native';
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
}
showAlert() {
LocalNotifications.schedule({
id: 1,
text: "Single Notification"
});
}
}
| import {Component} from '@angular/core';
import {NavController, Alert} from 'ionic-angular';
import {LocalNotifications} from 'ionic-native';
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
constructor(public navCtrl: NavController) {
LocalNotifications.on('click', (notification, state) => {
alert(notification.id + " was clicked");
})
}
showAlert() {
LocalNotifications.schedule({
id: 1,
text: "Single Notification"
})
}
}
| Add event to check notification was clicked | Add event to check notification was clicked
and return back to app
| TypeScript | apache-2.0 | teerasej/training-ionic2-local-notification,teerasej/training-ionic2-local-notification,teerasej/training-ionic2-local-notification | ---
+++
@@ -9,12 +9,16 @@
export class HomePage {
constructor(public navCtrl: NavController) {
+ LocalNotifications.on('click', (notification, state) => {
+ alert(notification.id + " was clicked");
+ })
+
}
showAlert() {
LocalNotifications.schedule({
id: 1,
text: "Single Notification"
- });
+ })
}
} |
3bf8c3974fc6ceb2546cbfa501da0386e0f421ab | src/cli.ts | src/cli.ts | import * as commander from "commander";
import { install, parseTyping, uninstall, Typing, TYPINGS_DIR } from "./index";
commander
.version(require("../package").version);
commander
.command("install <name>")
.description(`install typings to ${TYPINGS_DIR}`)
.action((name: string) => {
const typing = parseTyping(name);
install(typing);
});
commander
.command("uninstall <name>")
.alias("remove")
.description(`uninstall typings from ${TYPINGS_DIR}`)
.action((name: string) => {
uninstall(name, (err: any) => {
if (err) {
console.error(err.message);
return;
}
console.log(`Uninstalled: ${name}`);
});
});
commander.parse(process.argv);
| import * as commander from "commander";
import { install, parseTyping, uninstall, Typing, TYPINGS_DIR } from "./index";
commander
.version(require("../package").version);
commander
.command("install <name> [otherNames...]")
.description(`install typings to ${TYPINGS_DIR}`)
.action((name: string, otherNames: string[]) => {
[name, ...otherNames]
.map(parseTyping)
.forEach((typing) => install(typing)); // Don't pass in index, array
});
commander
.command("uninstall <name> [otherNames...]")
.alias("remove")
.description(`uninstall typings from ${TYPINGS_DIR}`)
.action((name: string, otherNames: string[]) => {
[name, ...otherNames].forEach((name) => {
uninstall(name, (err: any) => {
if (err) {
console.error(err.message);
return;
}
console.log(`Uninstalled: ${name}`);
});
});
});
commander.parse(process.argv);
| Support installing/uninstalling more than one package at once | Support installing/uninstalling more than one package at once
| TypeScript | mit | tomshen/tsdm | ---
+++
@@ -6,24 +6,27 @@
.version(require("../package").version);
commander
- .command("install <name>")
+ .command("install <name> [otherNames...]")
.description(`install typings to ${TYPINGS_DIR}`)
- .action((name: string) => {
- const typing = parseTyping(name);
- install(typing);
+ .action((name: string, otherNames: string[]) => {
+ [name, ...otherNames]
+ .map(parseTyping)
+ .forEach((typing) => install(typing)); // Don't pass in index, array
});
commander
- .command("uninstall <name>")
+ .command("uninstall <name> [otherNames...]")
.alias("remove")
.description(`uninstall typings from ${TYPINGS_DIR}`)
- .action((name: string) => {
- uninstall(name, (err: any) => {
- if (err) {
- console.error(err.message);
- return;
- }
- console.log(`Uninstalled: ${name}`);
+ .action((name: string, otherNames: string[]) => {
+ [name, ...otherNames].forEach((name) => {
+ uninstall(name, (err: any) => {
+ if (err) {
+ console.error(err.message);
+ return;
+ }
+ console.log(`Uninstalled: ${name}`);
+ });
});
});
|
2f6a1417da2f45739ee2d74dfafa5cd5e00b1ad9 | src/component/index.ts | src/component/index.ts | /*
* @license
* Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
*
* Use of this source code is governed by an Apache-2.0 license that can be
* found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
*/
export * from './accordion/index';
export * from './autosize-textarea/index';
export * from './backdrop/index';
export * from './circular-picker/index';
export * from './code-viewer/index';
export * from './color-picker/index';
export * from './color-selector/index';
export * from './content-editable/index';
export * from './data-grid/index';
export * from './date-selector/index';
export * from './date-picker/index';
export * from './dialog/index';
export * from './dragdrop/index';
export * from './iframe/index';
export * from './mouse-dragdrop/index';
export * from './dropdown/index';
export * from './menu/index';
export * from './select/index';
export * from './templates/index';
export * from './tiles/index';
export * from './loaders/index';
export * from './tree-list/index';
export * from './markdown/index';
export * from './message-box/index';
export * from './monaco-editor/index';
export * from './snackbar/index';
export * from './range/index';
export * from './splitter/index';
export * from './tooltip/index';
export * from './viewport/index';
/* deja-cli export index */
/* The comment above mustn't be removed ! */
| export * from './accordion/index';
export * from './autosize-textarea/index';
export * from './backdrop/index';
export * from './circular-picker/index';
export * from './code-viewer/index';
export * from './color-picker/index';
export * from './color-selector/index';
export * from './content-editable/index';
export * from './data-grid/index';
export * from './date-selector/index';
export * from './date-picker/index';
export * from './dialog/index';
export * from './dragdrop/index';
export * from './iframe/index';
export * from './mouse-dragdrop/index';
export * from './dropdown/index';
export * from './menu/index';
export * from './select/index';
export * from './templates/index';
export * from './tiles/index';
export * from './loaders/index';
export * from './tree-list/index';
export * from './markdown/index';
export * from './message-box/index';
export * from './monaco-editor/index';
export * from './snackbar/index';
export * from './range/index';
export * from './splitter/index';
export * from './tooltip/index';
export * from './viewport/index';
/* deja-cli export index */
/* The comment above mustn't be removed ! */
| Test commit ts file without license | Test commit ts file without license
| TypeScript | apache-2.0 | DSI-HUG/dejajs-components,DSI-HUG/dejajs-components,DSI-HUG/dejajs-components,DSI-HUG/dejajs-components | ---
+++
@@ -1,11 +1,3 @@
-/*
- * @license
- * Copyright Hôpitaux Universitaires de Genève. All Rights Reserved.
- *
- * Use of this source code is governed by an Apache-2.0 license that can be
- * found in the LICENSE file at https://github.com/DSI-HUG/dejajs-components/blob/master/LICENSE
- */
-
export * from './accordion/index';
export * from './autosize-textarea/index';
export * from './backdrop/index'; |
43dde6d6aa339177ae24367f636c89d06c41054b | src/index.ts | src/index.ts | /// <reference path="../typings/index.d.ts" />
try { require("source-map-support").install(); } catch (e) { /* empty */ }
const log4js = require("log4js");
import {app, BrowserWindow} from "electron";
log4js.configure({
appenders: [{ type: "console", layout: { type: "basic" } }]
});
async function main() {
await new Promise((resolve, reject) => app.once("ready", resolve));
let win = new BrowserWindow({
width: 800,
height: 600,
resizable: true,
show: true
});
win.loadURL(`file://${__dirname}/public/index.html`);
}
main().catch(e => log4js.getLogger().error(e.stack != null ? e.stack : e));
| /// <reference path="../typings/index.d.ts" />
try { require("source-map-support").install(); } catch (e) { /* empty */ }
const log4js = require("log4js");
import { app, BrowserWindow } from "electron";
log4js.configure({
appenders: [{ type: "console", layout: { type: "basic" } }]
});
async function main() {
await new Promise((resolve, reject) => app.once("ready", resolve));
app.on("window-all-closed", () => {
app.quit()
});
let win = new BrowserWindow({
width: 800,
height: 600,
resizable: true,
show: true
});
win.loadURL(`file://${__dirname}/public/index.html`);
}
main().catch(e => log4js.getLogger().error(e.stack != null ? e.stack : e));
| Fix exit when window closed | Fix exit when window closed
| TypeScript | mit | progre/chatreader,progre/chatreader,progre/chatreader | ---
+++
@@ -1,7 +1,7 @@
/// <reference path="../typings/index.d.ts" />
try { require("source-map-support").install(); } catch (e) { /* empty */ }
const log4js = require("log4js");
-import {app, BrowserWindow} from "electron";
+import { app, BrowserWindow } from "electron";
log4js.configure({
appenders: [{ type: "console", layout: { type: "basic" } }]
@@ -9,6 +9,11 @@
async function main() {
await new Promise((resolve, reject) => app.once("ready", resolve));
+
+ app.on("window-all-closed", () => {
+ app.quit()
+ });
+
let win = new BrowserWindow({
width: 800,
height: 600, |
29980b08e15d0ca29109fc263455b6d0f3b99ece | src/tasks/memory_monitor.ts | src/tasks/memory_monitor.ts | import { Client } from 'discord.js';
import * as cron from 'node-cron';
import { log } from '../helpers/logger';
export const startMemoryMonitor = (bot: Client): void => {
cron.schedule('45 * * * * *', () => {
log('info', bot.shard.ids[0], `memory usage - ${Math.round((process.memoryUsage().rss / 1024) / 102400) / 100} MB`);
}).start();
};
| import { Client } from 'discord.js';
import * as cron from 'node-cron';
import { log } from '../helpers/logger';
export const startMemoryMonitor = (bot: Client): void => {
cron.schedule('45 * * * * *', () => {
log('info', bot.shard.ids[0], `memory usage - ${Math.round(process.memoryUsage().rss / 1024 / 1024 * 100) / 100} MB`);
}).start();
};
| Fix formula for B to MB? | Fix formula for B to MB?
| TypeScript | mpl-2.0 | BibleBot/BibleBot,BibleBot/BibleBot,BibleBot/BibleBot | ---
+++
@@ -4,6 +4,6 @@
export const startMemoryMonitor = (bot: Client): void => {
cron.schedule('45 * * * * *', () => {
- log('info', bot.shard.ids[0], `memory usage - ${Math.round((process.memoryUsage().rss / 1024) / 102400) / 100} MB`);
+ log('info', bot.shard.ids[0], `memory usage - ${Math.round(process.memoryUsage().rss / 1024 / 1024 * 100) / 100} MB`);
}).start();
}; |
231d6a6ad59ecabc66b1bf7556782aad779fe29c | 7-redux/app/components/users-list-with-details.ts | 7-redux/app/components/users-list-with-details.ts | import {Component, CORE_DIRECTIVES} from 'angular2/angular2';
import {SimpleList} from 'InfomediaLtd/angular2-simple-list/app/components/simple-list.ts!';
import {UserView} from "../views/user-view";
import {User} from "../data/user";
import {AppStore} from "angular2-redux";
import {UserActions} from "../actions/user-actions";
@Component({
selector: 'users-with-details',
template: `
<simple-list
[list]="users"
[content]="getContent"
[link]="getLink"
(current)="selectCurrentUser($event)">
</simple-list>
<user *ng-if="currentUser" [user]="currentUser" class="border:1px solid black"></user>
`,
directives: [CORE_DIRECTIVES, SimpleList, UserView]
})
export class UsersListWithDetails {
private users:User[];
private currentUser:User;
private selectCurrentUser;
constructor(private appStore:AppStore,
private userActions:UserActions) {
this.selectCurrentUser = userActions.createDispatcher(appStore, userActions.setCurrentUser);
appStore.subscribe((state) => {
this.users = state.users;
this.currentUser = state.current;
});
appStore.dispatch(userActions.fetchUsers());
}
getContent(user:User):string { return user.name; }
getLink(user:User):any[] { return ['User', {id:user.id}]; }
} | import {Component, CORE_DIRECTIVES} from 'angular2/angular2';
import {SimpleList} from 'InfomediaLtd/angular2-simple-list/app/components/simple-list.ts!';
import {UserView} from "../views/user-view";
import {User} from "../data/user";
import {AppStore} from "angular2-redux";
import {UserActions} from "../actions/user-actions";
@Component({
selector: 'users-with-details',
template: `
<simple-list
[list]="users"
[content]="getContent"
[link]="getLink"
(current)="selectCurrentUser($event)">
</simple-list>
<user *ng-if="currentUser" [user]="currentUser" class="border:1px solid black"></user>
`,
directives: [CORE_DIRECTIVES, SimpleList, UserView]
})
export class UsersListWithDetails {
private users:User[];
private currentUser:User;
private selectCurrentUser;
constructor(appStore:AppStore, userActions:UserActions) {
this.selectCurrentUser = userActions.createDispatcher(appStore, userActions.setCurrentUser);
appStore.subscribe((state) => {
this.users = state.users;
this.currentUser = state.current;
});
appStore.dispatch(userActions.fetchUsers());
}
getContent(user:User):string { return user.name; }
getLink(user:User):any[] { return ['User', {id:user.id}]; }
} | Use Actions base class to dispatch actions | Use Actions base class to dispatch actions
| TypeScript | mit | InfomediaLtd/angular2-tutorial,InfomediaLtd/angular2-tutorial,InfomediaLtd/angular2-tutorial | ---
+++
@@ -26,8 +26,7 @@
private selectCurrentUser;
- constructor(private appStore:AppStore,
- private userActions:UserActions) {
+ constructor(appStore:AppStore, userActions:UserActions) {
this.selectCurrentUser = userActions.createDispatcher(appStore, userActions.setCurrentUser);
|
e320d274e478a8b8e52bdc63c3fd7b49ed5043f1 | src/Test/Ast/RevisionInsertion.ts | src/Test/Ast/RevisionInsertion.ts | import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode'
import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode'
describe('Text surrounded by 2 plus signs', () => {
it('is put inside a revision insertion node', () => {
expect(Up.toAst('I like ++to brush++ my teeth')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionInsertionNode([
new PlainTextNode('to brush')
]),
new PlainTextNode(' my teeth')
]))
})
})
describe('A revision insertion', () => {
it('is evaluated for other conventions', () => {
expect(Up.toAst('I like ++to *regularly* brush++ my teeth')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionInsertionNode([
new PlainTextNode('to '),
new EmphasisNode([
new PlainTextNode('regularly')
]),
new PlainTextNode(' brush')
]),
new PlainTextNode(' my teeth')
]))
})
})
| import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { EmphasisNode } from '../../SyntaxNodes/EmphasisNode'
import { RevisionInsertionNode } from '../../SyntaxNodes/RevisionInsertionNode'
describe('Text surrounded by 2 plus signs', () => {
it('is put inside a revision insertion node', () => {
expect(Up.toAst('I like ++to brush++ my teeth')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionInsertionNode([
new PlainTextNode('to brush')
]),
new PlainTextNode(' my teeth')
]))
})
})
describe('A revision insertion', () => {
it('is evaluated for other conventions', () => {
expect(Up.toAst('I like ++to *regularly* brush++ my teeth')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I like '),
new RevisionInsertionNode([
new PlainTextNode('to '),
new EmphasisNode([
new PlainTextNode('regularly')
]),
new PlainTextNode(' brush')
]),
new PlainTextNode(' my teeth')
]))
})
})
describe('An empty revision insertion', () => {
it('produces no syntax nodes', () => {
expect(Up.toAst('I have nothing to add: ++++')).to.be.eql(
insideDocumentAndParagraph([
new PlainTextNode('I have nothing to add: ')
])
)
})
})
| Add passing revisoin insertion test | Add passing revisoin insertion test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -36,3 +36,15 @@
]))
})
})
+
+
+describe('An empty revision insertion', () => {
+ it('produces no syntax nodes', () => {
+ expect(Up.toAst('I have nothing to add: ++++')).to.be.eql(
+ insideDocumentAndParagraph([
+ new PlainTextNode('I have nothing to add: ')
+ ])
+ )
+ })
+})
+ |
913aa5469010918b314c9bb8ac74353ce84dc422 | src/redux/ui/reducers.ts | src/redux/ui/reducers.ts | import { ActionShowMenu, ActionHideMenu } from './actions';
import { ActionTypes, Action } from '../actions';
export interface UIState {
isMenuShown: boolean;
isFullscreen: boolean;
}
const initialState: UIState = {
isMenuShown: false,
isFullscreen: false,
};
function handleShowMenu(state: UIState, action: ActionShowMenu): UIState {
return {
...state,
isMenuShown: true,
};
}
function handleHideMenu(state: UIState, action: ActionHideMenu): UIState {
return {
...state,
isMenuShown: false,
};
}
export const ui = (state: UIState = initialState, action: Action): UIState => {
switch (action.type) {
case ActionTypes.UI_SHOW_MENU:
return handleShowMenu(state, action as ActionShowMenu);
case ActionTypes.UI_HIDE_MENU:
return handleHideMenu(state, action as ActionHideMenu);
case ActionTypes.UI_ENTER_FULLSCREEN:
case ActionTypes.UI_EXIT_FULLSCREEN:
return { ...state, isMenuShown: false };
case ActionTypes.UI_SET_IS_FULLSCREEN:
return { ...state, isFullscreen: action.payload.isFullscreen };
default:
return state;
}
};
| import { ActionShowMenu, ActionHideMenu } from './actions';
import { ActionTypes, Action } from '../actions';
export interface UIState {
isMenuShown: boolean;
isFullscreen: boolean;
}
const initialState: UIState = {
isMenuShown: false,
isFullscreen: false,
};
function handleShowMenu(state: UIState, action: ActionShowMenu): UIState {
return {
...state,
isMenuShown: true,
};
}
function handleHideMenu(state: UIState, action: ActionHideMenu): UIState {
return {
...state,
isMenuShown: false,
};
}
export const ui = (state: UIState = initialState, action: Action): UIState => {
switch (action.type) {
case ActionTypes.UI_SHOW_MENU:
return handleShowMenu(state, action as ActionShowMenu);
case ActionTypes.UI_HIDE_MENU:
return handleHideMenu(state, action as ActionHideMenu);
case ActionTypes.UI_ENTER_FULLSCREEN:
case ActionTypes.UI_EXIT_FULLSCREEN:
return { ...state, isMenuShown: false };
case ActionTypes.UI_SET_IS_FULLSCREEN:
return { ...state, isFullscreen: action.payload.isFullscreen };
case ActionTypes.ROOM_LOAD:
return { ...state, isMenuShown: false };
default:
return state;
}
};
| Hide the menu when loading a room | :lipstick: Hide the menu when loading a room
| TypeScript | mit | matthewtole/codenames,matthewtole/codenames,matthewtole/codenames | ---
+++
@@ -36,6 +36,8 @@
return { ...state, isMenuShown: false };
case ActionTypes.UI_SET_IS_FULLSCREEN:
return { ...state, isFullscreen: action.payload.isFullscreen };
+ case ActionTypes.ROOM_LOAD:
+ return { ...state, isMenuShown: false };
default:
return state;
} |
426b69811ad53a5b002056966ae1384145e27987 | test/DispatcherSpec.ts | test/DispatcherSpec.ts | import Dispatcher from '../src/Dispatcher';
import * as chai from 'chai';
const expect = chai.expect;
import * as path from 'path';
describe('Dispatcher', function () {
it.only('Dispatches to fcat', function (done) {
Dispatcher
.dispatch('fcat', ['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 Dispatcher from '../src/Dispatcher';
import * as chai from 'chai';
const expect = chai.expect;
import * as path from 'path';
describe('Dispatcher', function () {
it('Dispatches to fcat', function (done) {
Dispatcher
.dispatch('fcat', ['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);
})
})
| Remove test narrowing on Dispatcher | Remove test narrowing on Dispatcher
| TypeScript | mit | hershal/fp-cli-ts,hershal/fp-cli-ts | ---
+++
@@ -6,7 +6,7 @@
import * as path from 'path';
describe('Dispatcher', function () {
- it.only('Dispatches to fcat', function (done) {
+ it('Dispatches to fcat', function (done) {
Dispatcher
.dispatch('fcat', ['one', 'two']
.map((f) => path.resolve(__dirname + '/fixtures/' + f))) |
be53d643823473a236a2665c233d9557085f7144 | app/components/maintenance-banner/component.ts | app/components/maintenance-banner/component.ts | import { computed } from '@ember/object';
import $ from 'jquery';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import config from 'ember-get-config';
import moment from 'moment';
interface MaintenanceData {
level?: number,
message?: string,
start?: string,
end?: string,
}
export default class MaintenanceBanner extends Component.extend({
didReceiveAttrs(): void {
this._super(...arguments);
this.get('getMaintenanceStatus').perform();
},
maintenance: <MaintenanceData> null,
getMaintenanceStatus: task(function* (): void {
const url: string = `${config.OSF.apiUrl}/v2/status/`;
const data = yield $.ajax(url, 'GET');
this.set('maintenance', data.maintenance);
}).restartable(),
}) {
start = computed('maintenance.start', function(): string {
return moment(this.get('maintenance.start')).format('lll');
});
end = computed('maintenance.end', function(): string {
return moment(this.get('maintenance.end')).format('lll');
});
utc = computed('maintenance.start', function(): string {
return moment(this.get('maintenance.start')).format('ZZ');
});
alertClass = computed('maintenance.level', function(): string {
const levelMap = ['info', 'warning', 'danger'];
return `alert-${levelMap[this.get('maintenance.level') - 1]}`;
});
}
| import { computed } from '@ember/object';
import $ from 'jquery';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
import config from 'ember-get-config';
import moment from 'moment';
interface MaintenanceData {
level?: number,
message?: string,
start?: string,
end?: string,
}
export default class MaintenanceBanner extends Component.extend({
didReceiveAttrs(): void {
this._super(...arguments);
this.get('getMaintenanceStatus').perform();
},
maintenance: <MaintenanceData> null,
getMaintenanceStatus: task(function* (): void {
const url: string = `${config.OSF.apiUrl}/v2/status/`;
const data = yield $.ajax(url, 'GET');
this.set('maintenance', data.maintenance);
}).restartable(),
}) {
start = computed('maintenance.start', (): string => moment(this.get('maintenance.start')).format('lll'));
end = computed('maintenance.end', (): string => moment(this.get('maintenance.end')).format('lll'));
utc = computed('maintenance.start', (): string => moment(this.get('maintenance.start')).format('ZZ'));
alertClass = computed('maintenance.level', (): string => {
const levelMap = ['info', 'warning', 'danger'];
return `alert-${levelMap[this.get('maintenance.level') - 1]}`;
});
}
| Use arrow functions when able | Use arrow functions when able
| TypeScript | apache-2.0 | hmoco/ember-osf-web,hmoco/ember-osf-web,hmoco/ember-osf-web | ---
+++
@@ -24,19 +24,13 @@
this.set('maintenance', data.maintenance);
}).restartable(),
}) {
- start = computed('maintenance.start', function(): string {
- return moment(this.get('maintenance.start')).format('lll');
- });
+ start = computed('maintenance.start', (): string => moment(this.get('maintenance.start')).format('lll'));
- end = computed('maintenance.end', function(): string {
- return moment(this.get('maintenance.end')).format('lll');
- });
+ end = computed('maintenance.end', (): string => moment(this.get('maintenance.end')).format('lll'));
- utc = computed('maintenance.start', function(): string {
- return moment(this.get('maintenance.start')).format('ZZ');
- });
+ utc = computed('maintenance.start', (): string => moment(this.get('maintenance.start')).format('ZZ'));
- alertClass = computed('maintenance.level', function(): string {
+ alertClass = computed('maintenance.level', (): string => {
const levelMap = ['info', 'warning', 'danger'];
return `alert-${levelMap[this.get('maintenance.level') - 1]}`;
}); |
d360e2f98660e4f91e2a120f25f75395cdd50b49 | src/xrm-mock/usersettings/usersettings.mock.ts | src/xrm-mock/usersettings/usersettings.mock.ts | export class UserSettingsMock implements Xrm.UserSettings {
public defaultDashboardId: string;
public isGuidedHelpEnabled: boolean;
public isHighContrastEnabled: boolean;
public isRTL: boolean;
public languageId: number;
public securityRolePrivileges: string[];
public securityRoles: string[];
public transactionCurrencyId: string;
public userId: string;
public userName: string;
constructor(components: IUserSettingsComponents) {
this.defaultDashboardId = components.defaultDashboardId;
this.isGuidedHelpEnabled = components.isGuidedHelpEnabled;
this.isHighContrastEnabled = components.isHighContrastEnabled;
this.isRTL = components.isRTL;
this.languageId = components.languageId;
this.securityRolePrivileges = components.securityRolePrivileges;
this.securityRoles = components.securityRoles;
this.transactionCurrencyId = components.transactionCurrencyId;
this.userId = components.userId;
this.userName = components.userName;
}
public dateFormattingInfo(): Xrm.DateFormattingInfo {
throw new Error("Not implemented.");
}
public getTimeZoneOffsetMinutes(): number {
throw new Error("Not implemented");
}
}
export interface IUserSettingsComponents {
defaultDashboardId?: string;
isGuidedHelpEnabled: boolean;
isHighContrastEnabled: boolean;
isRTL: boolean;
languageId?: number;
securityRolePrivileges?: string[];
securityRoles?: string[];
transactionCurrencyId?: string;
userId: string;
userName: string;
}
| export class UserSettingsMock implements Xrm.UserSettings {
public defaultDashboardId: string;
public isGuidedHelpEnabled: boolean;
public isHighContrastEnabled: boolean;
public isRTL: boolean;
public languageId: number;
public securityRolePrivileges: string[];
public securityRoles: string[];
public transactionCurrencyId: string;
public userId: string;
public userName: string;
public roles: Xrm.Collection.ItemCollection<Xrm.LookupValue>;
public transactionCurrency: Xrm.LookupValue;
constructor(components: IUserSettingsComponents) {
this.defaultDashboardId = components.defaultDashboardId;
this.isGuidedHelpEnabled = components.isGuidedHelpEnabled;
this.isHighContrastEnabled = components.isHighContrastEnabled;
this.isRTL = components.isRTL;
this.languageId = components.languageId;
this.securityRolePrivileges = components.securityRolePrivileges;
this.securityRoles = components.securityRoles;
this.transactionCurrencyId = components.transactionCurrencyId;
this.userId = components.userId;
this.userName = components.userName;
this.roles = components.roles;
this.transactionCurrency = components.transactionCurrency;
}
public dateFormattingInfo(): Xrm.DateFormattingInfo {
throw new Error("Not implemented.");
}
public getTimeZoneOffsetMinutes(): number {
throw new Error("Not implemented");
}
}
export interface IUserSettingsComponents {
defaultDashboardId?: string;
isGuidedHelpEnabled: boolean;
isHighContrastEnabled: boolean;
isRTL: boolean;
languageId?: number;
securityRolePrivileges?: string[];
securityRoles?: string[];
transactionCurrencyId?: string;
userId: string;
userName: string;
roles?: Xrm.Collection.ItemCollection<Xrm.LookupValue>;
transactionCurrency?: Xrm.LookupValue;
}
| Add missing properties in getGlobalContext.userSettings | Add missing properties in getGlobalContext.userSettings
| TypeScript | mit | camelCaseDave/xrm-mock,camelCaseDave/xrm-mock | ---
+++
@@ -9,6 +9,8 @@
public transactionCurrencyId: string;
public userId: string;
public userName: string;
+ public roles: Xrm.Collection.ItemCollection<Xrm.LookupValue>;
+ public transactionCurrency: Xrm.LookupValue;
constructor(components: IUserSettingsComponents) {
this.defaultDashboardId = components.defaultDashboardId;
@@ -21,11 +23,14 @@
this.transactionCurrencyId = components.transactionCurrencyId;
this.userId = components.userId;
this.userName = components.userName;
+ this.roles = components.roles;
+ this.transactionCurrency = components.transactionCurrency;
}
public dateFormattingInfo(): Xrm.DateFormattingInfo {
throw new Error("Not implemented.");
}
+
public getTimeZoneOffsetMinutes(): number {
throw new Error("Not implemented");
}
@@ -42,4 +47,6 @@
transactionCurrencyId?: string;
userId: string;
userName: string;
+ roles?: Xrm.Collection.ItemCollection<Xrm.LookupValue>;
+ transactionCurrency?: Xrm.LookupValue;
} |
cfda6267fc7dc7585e406e6b963bb3384909c054 | src/testing/support/createElement.ts | src/testing/support/createElement.ts | /**
* Create HTML and SVG elements from a valid HTML string.
*
* The given HTML must contain only one root element, of type `Element`.
*/
export function createElement(html: string): Element {
return document.createRange().createContextualFragment(html).firstElementChild as Element
} | /**
* Create HTML and SVG elements from a valid HTML string.
*
* NOTE The given HTML must contain only one root element, of type `Element`.
*/
export function createElement(html: string): Element {
return document.createRange().createContextualFragment(html).firstElementChild as Element
} | Change comment for consistency and clarity | Change comment for consistency and clarity
| TypeScript | agpl-3.0 | inad9300/Soil,inad9300/Soil | ---
+++
@@ -1,7 +1,7 @@
/**
* Create HTML and SVG elements from a valid HTML string.
*
- * The given HTML must contain only one root element, of type `Element`.
+ * NOTE The given HTML must contain only one root element, of type `Element`.
*/
export function createElement(html: string): Element {
return document.createRange().createContextualFragment(html).firstElementChild as Element |
4d6952361e5b2d35513036ab5e79da5bcb5bfe81 | server/helpers/markdown.ts | server/helpers/markdown.ts | import { getSanitizeOptions, TEXT_WITH_HTML_RULES } from '@shared/core-utils'
const sanitizeOptions = getSanitizeOptions()
const sanitizeHtml = require('sanitize-html')
const markdownItEmoji = require('markdown-it-emoji/light')
const MarkdownItClass = require('markdown-it')
const markdownIt = new MarkdownItClass('default', { linkify: true, breaks: true, html: true })
markdownIt.enable(TEXT_WITH_HTML_RULES)
markdownIt.use(markdownItEmoji)
const toSafeHtml = text => {
if (!text) return ''
// Restore line feed
const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
// Convert possible markdown (emojis, emphasis and lists) to html
const html = markdownIt.render(textWithLineFeed)
// Convert to safe Html
return sanitizeHtml(html, sanitizeOptions)
}
const mdToPlainText = text => {
if (!text) return ''
// Convert possible markdown (emojis, emphasis and lists) to html
const html = markdownIt.render(text)
// Convert to safe Html
const safeHtml = sanitizeHtml(html, sanitizeOptions)
return safeHtml.replace(/<[^>]+>/g, '')
.replace(/\n$/, '')
.replace('\n', ', ')
}
// ---------------------------------------------------------------------------
export {
toSafeHtml,
mdToPlainText
}
| import { getSanitizeOptions, TEXT_WITH_HTML_RULES } from '@shared/core-utils'
const sanitizeOptions = getSanitizeOptions()
const sanitizeHtml = require('sanitize-html')
const markdownItEmoji = require('markdown-it-emoji/light')
const MarkdownItClass = require('markdown-it')
const markdownIt = new MarkdownItClass('default', { linkify: true, breaks: true, html: true })
markdownIt.enable(TEXT_WITH_HTML_RULES)
markdownIt.use(markdownItEmoji)
const toSafeHtml = text => {
if (!text) return ''
// Restore line feed
const textWithLineFeed = text.replace(/<br.?\/?>/g, '\r\n')
// Convert possible markdown (emojis, emphasis and lists) to html
const html = markdownIt.render(textWithLineFeed)
// Convert to safe Html
return sanitizeHtml(html, sanitizeOptions)
}
const mdToPlainText = text => {
if (!text) return ''
// Convert possible markdown (emojis, emphasis and lists) to html
const html = markdownIt.render(text)
// Convert to safe Html
const safeHtml = sanitizeHtml(html, sanitizeOptions)
return safeHtml.replace(/<[^>]+>/g, '')
.replace(/\n$/, '')
.replace(/\n/g, ', ')
}
// ---------------------------------------------------------------------------
export {
toSafeHtml,
mdToPlainText
}
| Fix multiple \n in md to plain text | Fix multiple \n in md to plain text
| TypeScript | agpl-3.0 | Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube | ---
+++
@@ -34,7 +34,7 @@
return safeHtml.replace(/<[^>]+>/g, '')
.replace(/\n$/, '')
- .replace('\n', ', ')
+ .replace(/\n/g, ', ')
}
// --------------------------------------------------------------------------- |
108a66f0dac7586f2f7871c6bb77f73cb924f2b3 | client/src/app/core/routing/redirect.service.ts | client/src/app/core/routing/redirect.service.ts | import { Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { ServerService } from '../server'
@Injectable()
export class RedirectService {
// Default route could change according to the instance configuration
static INIT_DEFAULT_ROUTE = '/videos/trending'
static DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
constructor (
private router: Router,
private serverService: ServerService
) {
// The config is first loaded from the cache so try to get the default route
const config = this.serverService.getConfig()
if (config && config.instance && config.instance.defaultClientRoute) {
RedirectService.DEFAULT_ROUTE = config.instance.defaultClientRoute
}
this.serverService.configLoaded
.subscribe(() => {
const defaultRouteConfig = this.serverService.getConfig().instance.defaultClientRoute
if (defaultRouteConfig) {
RedirectService.DEFAULT_ROUTE = defaultRouteConfig
}
})
}
redirectToHomepage () {
console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
this.router.navigate([ RedirectService.DEFAULT_ROUTE ])
.catch(() => {
console.error(
'Cannot navigate to %s, resetting default route to %s.',
RedirectService.DEFAULT_ROUTE,
RedirectService.INIT_DEFAULT_ROUTE
)
RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
return this.router.navigate([ RedirectService.DEFAULT_ROUTE ])
})
}
}
| import { Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { ServerService } from '../server'
@Injectable()
export class RedirectService {
// Default route could change according to the instance configuration
static INIT_DEFAULT_ROUTE = '/videos/trending'
static DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
constructor (
private router: Router,
private serverService: ServerService
) {
// The config is first loaded from the cache so try to get the default route
const config = this.serverService.getConfig()
if (config && config.instance && config.instance.defaultClientRoute) {
RedirectService.DEFAULT_ROUTE = config.instance.defaultClientRoute
}
this.serverService.configLoaded
.subscribe(() => {
const defaultRouteConfig = this.serverService.getConfig().instance.defaultClientRoute
if (defaultRouteConfig) {
RedirectService.DEFAULT_ROUTE = defaultRouteConfig
}
})
}
redirectToHomepage () {
console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { replaceUrl: true })
.catch(() => {
console.error(
'Cannot navigate to %s, resetting default route to %s.',
RedirectService.DEFAULT_ROUTE,
RedirectService.INIT_DEFAULT_ROUTE
)
RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { replaceUrl: true })
})
}
}
| Fix history back after a redirect | Fix history back after a redirect
| TypeScript | agpl-3.0 | Green-Star/PeerTube,Green-Star/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Green-Star/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Green-Star/PeerTube | ---
+++
@@ -31,7 +31,7 @@
redirectToHomepage () {
console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
- this.router.navigate([ RedirectService.DEFAULT_ROUTE ])
+ this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { replaceUrl: true })
.catch(() => {
console.error(
'Cannot navigate to %s, resetting default route to %s.',
@@ -40,7 +40,7 @@
)
RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
- return this.router.navigate([ RedirectService.DEFAULT_ROUTE ])
+ return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { replaceUrl: true })
})
} |
4c49e9bc8a1703dc3aa6701a51bd1bdb43c01e2e | packages/components/containers/topBanners/WelcomeV4TopBanner.tsx | packages/components/containers/topBanners/WelcomeV4TopBanner.tsx | import React from 'react';
import { c } from 'ttag';
import { APPS, SSO_PATHS } from 'proton-shared/lib/constants';
import TopBanner from './TopBanner';
import { useConfig } from '../../hooks';
const IS_INITIAL_LOGIN = [SSO_PATHS.AUTHORIZE, SSO_PATHS.LOGIN, '/'].includes(window.location.pathname);
const WelcomeV4TopBanner = () => {
const { APP_NAME } = useConfig();
if (!IS_INITIAL_LOGIN || APP_NAME !== APPS.PROTONACCOUNT) {
return null;
}
return (
<TopBanner className="bg-info">
{c('Message display when user visit v4 login first time')
.t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}
</TopBanner>
);
};
export default WelcomeV4TopBanner;
| import React from 'react';
import { c } from 'ttag';
import { APPS, SSO_PATHS } from 'proton-shared/lib/constants';
import TopBanner from './TopBanner';
import { useConfig } from '../../hooks';
import { Href } from '../../components';
const IS_INITIAL_LOGIN = [SSO_PATHS.AUTHORIZE, SSO_PATHS.LOGIN, '/'].includes(window.location.pathname);
const WelcomeV4TopBanner = () => {
const { APP_NAME } = useConfig();
if (!IS_INITIAL_LOGIN || APP_NAME !== APPS.PROTONACCOUNT) {
return null;
}
return (
<TopBanner className="bg-info">
<span className="mr0-5">{c('Message display when user visit v4 login first time')
.t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}</span>
<Href className="underline inline-block color-inherit" url="https://protonmail.com/blog/new-protonmail">{c(
'Link'
).t`Learn more`}</Href>
</TopBanner>
);
};
export default WelcomeV4TopBanner;
| Update welcome v4 banner to includes link | Update welcome v4 banner to includes link
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -4,6 +4,7 @@
import TopBanner from './TopBanner';
import { useConfig } from '../../hooks';
+import { Href } from '../../components';
const IS_INITIAL_LOGIN = [SSO_PATHS.AUTHORIZE, SSO_PATHS.LOGIN, '/'].includes(window.location.pathname);
@@ -16,8 +17,11 @@
return (
<TopBanner className="bg-info">
- {c('Message display when user visit v4 login first time')
- .t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}
+ <span className="mr0-5">{c('Message display when user visit v4 login first time')
+ .t`Welcome to the new ProtonMail design, modern and easy to use. Sign in to discover more.`}</span>
+ <Href className="underline inline-block color-inherit" url="https://protonmail.com/blog/new-protonmail">{c(
+ 'Link'
+ ).t`Learn more`}</Href>
</TopBanner>
);
}; |
35a7d8cfb6c6be4980835a5da029caf1bfc671d6 | config/config.local.ts | config/config.local.ts | import * as Config from "webpack-chain";
import * as CommonConfig from "./config.common";
import { Credentials, EnvOptions } from "./types";
function webpackConfig(options: EnvOptions = {}): Config {
// get the common configuration to start with
const config = CommonConfig.init(options);
// TIP: if you symlink the below path into your project as `local`,
// it makes for much easier debugging:
// (make sure you symlink the dir, not the files)
// `# ln -s /path/to/local/deploy/dir ./dist/local`
const credentials: Credentials = require("./credentials.json")
config.output.path(credentials.outputPath);
// modify the args of "define" plugin
config.plugin("define").tap((args: any[]) => {
args[0].PRODUCTION = JSON.stringify(false);
return args;
});
// HACK to add .js extension for local server
config.output.sourceMapFilename("[file].map.js");
return config;
}
module.exports = webpackConfig;
| /* tslint:disable:no-require-imports */
import * as Config from "webpack-chain";
import * as CommonConfig from "./config.common";
import { Credentials, EnvOptions } from "./types";
function webpackConfig(options: EnvOptions = {}): Config {
// get the common configuration to start with
const config = CommonConfig.init(options);
// TIP: if you symlink the below path into your project as `local`,
// it makes for much easier debugging:
// (make sure you symlink the dir, not the files)
// `# ln -s /path/to/local/deploy/dir ./dist/local`
const credentials: Credentials = require("./credentials.json")
config.output.path(credentials.outputPath);
// modify the args of "define" plugin
config.plugin("define").tap((args: any[]) => {
args[0].PRODUCTION = JSON.stringify(false);
return args;
});
// HACK to add .js extension for local server
config.output.sourceMapFilename("[file].map.js");
return config;
}
module.exports = webpackConfig;
| Disable no-require-imports on config files | Disable no-require-imports on config files
| TypeScript | mit | resir014/screeps,resir014/screeps | ---
+++
@@ -1,3 +1,4 @@
+/* tslint:disable:no-require-imports */
import * as Config from "webpack-chain";
import * as CommonConfig from "./config.common"; |
a068ef8ad62426c2635cea2163dfe5ac6c558599 | front-end/src/app/components/search-form/search-form.directive.ts | front-end/src/app/components/search-form/search-form.directive.ts | import { ApiInterface } from '../../common/services/api.service';
/** @ngInject */
export function searchForm(): angular.IDirective {
return {
restrict: 'E',
scope: {},
templateUrl: 'app/components/search-form/search-form.view.html',
controller: SearchFormController,
controllerAs: 'vm',
bindToController: true,
link: function () {}
};
}
/** @ngInject */
class SearchFormController {
searchResult:any[] = [];
judges:any[] = [];
api:any = {};
searchQuery:string = '';
constructor(constants:any, Api:ApiInterface) {
console.log('SearchForm injected!');
this.api = Api;
this.api.getData().then(res => {
debugger;
this.judges = res;
});
}
findData () {
}
}
| import { ApiInterface } from '../../common/services/api.service';
/** @ngInject */
export function searchForm():angular.IDirective {
return {
restrict: 'E',
scope: {},
templateUrl: 'app/components/search-form/search-form.view.html',
controller: SearchFormController,
controllerAs: 'vm',
bindToController: true,
link: function () {
}
};
}
/** @ngInject */
class SearchFormController {
searchResult:any[] = [];
judges:any[] = [];
api:any = {};
searchQuery:string = '';
constructor(constants:any, Api:ApiInterface) {
console.log('SearchForm injected!');
this.api = Api;
this.api.getData().then(res => {
this.judges = res;
});
}
findData() {
}
}
| Reduce lint warnings delete "debugger" | Reduce lint warnings
delete "debugger"
| TypeScript | mit | automaidan/judges,automaidan/judges,automaidan/judges,automaidan/judges | ---
+++
@@ -1,6 +1,6 @@
import { ApiInterface } from '../../common/services/api.service';
/** @ngInject */
-export function searchForm(): angular.IDirective {
+export function searchForm():angular.IDirective {
return {
restrict: 'E',
@@ -9,7 +9,8 @@
controller: SearchFormController,
controllerAs: 'vm',
bindToController: true,
- link: function () {}
+ link: function () {
+ }
};
}
@@ -25,12 +26,12 @@
console.log('SearchForm injected!');
this.api = Api;
this.api.getData().then(res => {
- debugger;
this.judges = res;
});
}
- findData () {
+
+ findData() {
}
} |
16ef5f4b158e3339c332156a65d0a6685c9f3cfd | src/pages/home/home.e2e.ts | src/pages/home/home.e2e.ts | import { browser, by, element } from 'protractor';
class HomeObj {
public title;
constructor() {
// this.title = element(by.id('title'));
}
}
describe('App', () => {
// beforeEach(() => {
// browser.get('/');
// });
// const home: HomeObj = new HomeObj();
// it('should have a title', () => {
// expect((home.title).isDisplayed()).toBeTruthy();
// });
});
| import { browser, by, element } from 'protractor';
class HomeObj {
public title;
constructor() {
// this.title = element(by.id('title'));
}
}
describe('App', () => {
// beforeEach(() => {
// browser.get('/');
// });
// const home: HomeObj = new HomeObj();
// it('should have a title', () => {
// expect((home.title).isDisplayed()).toBeTruthy();
// });
});
| Add correct indentation to config files | Add correct indentation to config files
| TypeScript | mit | kojinkai/predictor-ionic,kojinkai/predictor-ionic,kojinkai/predictor-ionic,kojinkai/predictor-ionic | ---
+++
@@ -18,4 +18,5 @@
// it('should have a title', () => {
// expect((home.title).isDisplayed()).toBeTruthy();
// });
+
}); |
d2f506845e451dbb61a3e0133cb8bed68f5ce22d | src/vs/languages/html/common/html.contribution.ts | src/vs/languages/html/common/html.contribution.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import modesExtensions = require('vs/editor/common/modes/modesRegistry');
modesExtensions.registerMode({
id: 'html',
extensions: ['.html', '.htm', '.shtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'],
aliases: ['HTML', 'htm', 'html', 'xhtml'],
mimetypes: ['text/html', 'text/x-jshtm', 'text/template'],
moduleId: 'vs/languages/html/common/html',
ctorName: 'HTMLMode'
});
| /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import modesExtensions = require('vs/editor/common/modes/modesRegistry');
modesExtensions.registerMode({
id: 'html',
extensions: ['.html', '.htm', '.shtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'],
aliases: ['HTML', 'htm', 'html', 'xhtml'],
mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'],
moduleId: 'vs/languages/html/common/html',
ctorName: 'HTMLMode'
});
| Add text/ng-template to the HTML mime types to enable HTML highlighting/help in Angular templates with in <script> blocks | Add text/ng-template to the HTML mime types to enable HTML highlighting/help in Angular templates with in <script> blocks
| TypeScript | mit | matthewshirley/vscode,f111fei/vscode,joaomoreno/vscode,edumunoz/vscode,the-ress/vscode,rishii7/vscode,mjbvz/vscode,KattMingMing/vscode,f111fei/vscode,0xmohit/vscode,the-ress/vscode,Zalastax/vscode,sifue/vscode,cleidigh/vscode,ups216/vscode,eamodio/vscode,Microsoft/vscode,veeramarni/vscode,microlv/vscode,cleidigh/vscode,hoovercj/vscode,eamodio/vscode,KattMingMing/vscode,matthewshirley/vscode,stkb/vscode,ioklo/vscode,start/vscode,matthewshirley/vscode,hungys/vscode,oneplus1000/vscode,Krzysztof-Cieslak/vscode,eamodio/vscode,williamcspace/vscode,Krzysztof-Cieslak/vscode,cra0zy/VSCode,cleidigh/vscode,Krzysztof-Cieslak/vscode,rishii7/vscode,KattMingMing/vscode,joaomoreno/vscode,eklavyamirani/vscode,eklavyamirani/vscode,williamcspace/vscode,0xmohit/vscode,radshit/vscode,Zalastax/vscode,microsoft/vscode,markrendle/vscode,Krzysztof-Cieslak/vscode,edumunoz/vscode,markrendle/vscode,jchadwick/vscode,stringham/vscode,takumif/vscode,gagangupt16/vscode,charlespierce/vscode,zyml/vscode,michaelcfanning/vscode,rishii7/vscode,charlespierce/vscode,Zalastax/vscode,0xmohit/vscode,radshit/vscode,joaomoreno/vscode,hashhar/vscode,veeramarni/vscode,dersia/vscode,bsmr-x-script/vscode,cleidigh/vscode,matthewshirley/vscode,gagangupt16/vscode,bsmr-x-script/vscode,hoovercj/vscode,eamodio/vscode,Zalastax/vscode,zyml/vscode,cleidigh/vscode,microsoft/vscode,Microsoft/vscode,sifue/vscode,start/vscode,charlespierce/vscode,mjbvz/vscode,gagangupt16/vscode,stringham/vscode,the-ress/vscode,cleidigh/vscode,KattMingMing/vscode,hoovercj/vscode,dersia/vscode,gagangupt16/vscode,zyml/vscode,hashhar/vscode,Microsoft/vscode,veeramarni/vscode,radshit/vscode,zyml/vscode,zyml/vscode,hashhar/vscode,mjbvz/vscode,sifue/vscode,DustinCampbell/vscode,hoovercj/vscode,veeramarni/vscode,ups216/vscode,williamcspace/vscode,start/vscode,radshit/vscode,Microsoft/vscode,alexandrudima/vscode,2947721120/vscode,gagangupt16/vscode,stringham/vscode,joaomoreno/vscode,hashhar/vscode,jchadwick/vscode,SofianHn/vscode,KattMingMing/vscode,microlv/vscode,edumunoz/vscode,Zalastax/vscode,gagangupt16/vscode,gagangupt16/vscode,punker76/vscode,rishii7/vscode,jchadwick/vscode,rishii7/vscode,cleidigh/vscode,Microsoft/vscode,jchadwick/vscode,Zalastax/vscode,0xmohit/vscode,eklavyamirani/vscode,gagangupt16/vscode,mjbvz/vscode,joaomoreno/vscode,tottok-ug/vscode,sifue/vscode,DustinCampbell/vscode,joaomoreno/vscode,ioklo/vscode,jchadwick/vscode,ups216/vscode,rick111111/vscode,radshit/vscode,oneplus1000/vscode,hungys/vscode,michaelcfanning/vscode,hungys/vscode,williamcspace/vscode,DustinCampbell/vscode,landonepps/vscode,takumif/vscode,the-ress/vscode,hungys/vscode,joaomoreno/vscode,alexandrudima/vscode,landonepps/vscode,f111fei/vscode,markrendle/vscode,edumunoz/vscode,f111fei/vscode,veeramarni/vscode,0xmohit/vscode,microsoft/vscode,stringham/vscode,eklavyamirani/vscode,matthewshirley/vscode,stringham/vscode,hashhar/vscode,ioklo/vscode,Krzysztof-Cieslak/vscode,michaelcfanning/vscode,mjbvz/vscode,hungys/vscode,eamodio/vscode,zyml/vscode,cleidigh/vscode,microlv/vscode,veeramarni/vscode,bsmr-x-script/vscode,eklavyamirani/vscode,stringham/vscode,hoovercj/vscode,jchadwick/vscode,hoovercj/vscode,edumunoz/vscode,microsoft/vscode,mjbvz/vscode,eamodio/vscode,Microsoft/vscode,gagangupt16/vscode,rick111111/vscode,DustinCampbell/vscode,edumunoz/vscode,edumunoz/vscode,ioklo/vscode,KattMingMing/vscode,bsmr-x-script/vscode,markrendle/vscode,cleidigh/vscode,charlespierce/vscode,microlv/vscode,edumunoz/vscode,charlespierce/vscode,0xmohit/vscode,williamcspace/vscode,oneplus1000/vscode,rishii7/vscode,williamcspace/vscode,matthewshirley/vscode,the-ress/vscode,Microsoft/vscode,mjbvz/vscode,ups216/vscode,veeramarni/vscode,f111fei/vscode,zyml/vscode,the-ress/vscode,eklavyamirani/vscode,landonepps/vscode,ups216/vscode,mjbvz/vscode,bsmr-x-script/vscode,zyml/vscode,matthewshirley/vscode,Krzysztof-Cieslak/vscode,charlespierce/vscode,the-ress/vscode,rick111111/vscode,punker76/vscode,ioklo/vscode,charlespierce/vscode,jchadwick/vscode,mjbvz/vscode,landonepps/vscode,DustinCampbell/vscode,joaomoreno/vscode,jchadwick/vscode,stringham/vscode,eklavyamirani/vscode,hoovercj/vscode,hoovercj/vscode,veeramarni/vscode,Zalastax/vscode,sifue/vscode,Zalastax/vscode,microsoft/vscode,hoovercj/vscode,DustinCampbell/vscode,williamcspace/vscode,williamcspace/vscode,eamodio/vscode,f111fei/vscode,matthewshirley/vscode,cleidigh/vscode,microlv/vscode,start/vscode,rishii7/vscode,f111fei/vscode,sifue/vscode,hashhar/vscode,joaomoreno/vscode,matthewshirley/vscode,stringham/vscode,DustinCampbell/vscode,zyml/vscode,charlespierce/vscode,veeramarni/vscode,radshit/vscode,landonepps/vscode,sifue/vscode,KattMingMing/vscode,the-ress/vscode,microlv/vscode,bsmr-x-script/vscode,mjbvz/vscode,Microsoft/vscode,rishii7/vscode,joaomoreno/vscode,edumunoz/vscode,Krzysztof-Cieslak/vscode,edumunoz/vscode,jchadwick/vscode,dersia/vscode,ups216/vscode,DustinCampbell/vscode,edumunoz/vscode,veeramarni/vscode,eamodio/vscode,microlv/vscode,radshit/vscode,ioklo/vscode,hungys/vscode,zyml/vscode,cleidigh/vscode,ups216/vscode,stringham/vscode,microlv/vscode,Zalastax/vscode,microsoft/vscode,DustinCampbell/vscode,zyml/vscode,alexandrudima/vscode,sifue/vscode,Microsoft/vscode,Zalastax/vscode,the-ress/vscode,rick111111/vscode,microsoft/vscode,hashhar/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,hashhar/vscode,dersia/vscode,cleidigh/vscode,jchadwick/vscode,stkb/vscode,tottok-ug/vscode,DustinCampbell/vscode,edumunoz/vscode,hashhar/vscode,matthewshirley/vscode,0xmohit/vscode,hungys/vscode,ups216/vscode,Microsoft/vscode,edumunoz/vscode,veeramarni/vscode,f111fei/vscode,gagangupt16/vscode,KattMingMing/vscode,charlespierce/vscode,Krzysztof-Cieslak/vscode,bsmr-x-script/vscode,bsmr-x-script/vscode,0xmohit/vscode,sifue/vscode,bsmr-x-script/vscode,microsoft/vscode,eklavyamirani/vscode,ioklo/vscode,stringham/vscode,hungys/vscode,williamcspace/vscode,veeramarni/vscode,williamcspace/vscode,microsoft/vscode,f111fei/vscode,microsoft/vscode,stringham/vscode,microlv/vscode,Krzysztof-Cieslak/vscode,microsoft/vscode,landonepps/vscode,mjbvz/vscode,tottok-ug/vscode,stringham/vscode,f111fei/vscode,mjbvz/vscode,williamcspace/vscode,Zalastax/vscode,hoovercj/vscode,rishii7/vscode,ups216/vscode,f111fei/vscode,zyml/vscode,Microsoft/vscode,2947721120/vscode,sifue/vscode,rishii7/vscode,ups216/vscode,edumunoz/vscode,veeramarni/vscode,ups216/vscode,sifue/vscode,the-ress/vscode,joaomoreno/vscode,KattMingMing/vscode,oneplus1000/vscode,eklavyamirani/vscode,microsoft/vscode,veeramarni/vscode,punker76/vscode,matthewshirley/vscode,KattMingMing/vscode,bsmr-x-script/vscode,radshit/vscode,2947721120/vscode,0xmohit/vscode,Krzysztof-Cieslak/vscode,radshit/vscode,cleidigh/vscode,f111fei/vscode,microlv/vscode,radshit/vscode,f111fei/vscode,eklavyamirani/vscode,SofianHn/vscode,the-ress/vscode,jchadwick/vscode,veeramarni/vscode,ioklo/vscode,microlv/vscode,hashhar/vscode,0xmohit/vscode,microlv/vscode,stringham/vscode,gagangupt16/vscode,hashhar/vscode,ups216/vscode,ioklo/vscode,hungys/vscode,williamcspace/vscode,eklavyamirani/vscode,Krzysztof-Cieslak/vscode,microlv/vscode,jchadwick/vscode,ioklo/vscode,Zalastax/vscode,hungys/vscode,eamodio/vscode,williamcspace/vscode,DustinCampbell/vscode,gagangupt16/vscode,f111fei/vscode,rishii7/vscode,Microsoft/vscode,ioklo/vscode,eamodio/vscode,hungys/vscode,eklavyamirani/vscode,0xmohit/vscode,the-ress/vscode,DustinCampbell/vscode,matthewshirley/vscode,KattMingMing/vscode,landonepps/vscode,microlv/vscode,jchadwick/vscode,alexandrudima/vscode,joaomoreno/vscode,radshit/vscode,landonepps/vscode,radshit/vscode,eklavyamirani/vscode,ioklo/vscode,microsoft/vscode,hoovercj/vscode,ioklo/vscode,eamodio/vscode,0xmohit/vscode,landonepps/vscode,mjbvz/vscode,williamcspace/vscode,bsmr-x-script/vscode,gagangupt16/vscode,eamodio/vscode,stringham/vscode,microsoft/vscode,takumif/vscode,charlespierce/vscode,joaomoreno/vscode,the-ress/vscode,eamodio/vscode,DustinCampbell/vscode,0xmohit/vscode,charlespierce/vscode,Zalastax/vscode,sifue/vscode,rishii7/vscode,landonepps/vscode,KattMingMing/vscode,rishii7/vscode,hungys/vscode,edumunoz/vscode,radshit/vscode,stringham/vscode,hungys/vscode,Krzysztof-Cieslak/vscode,f111fei/vscode,microsoft/vscode,eamodio/vscode,hungys/vscode,sifue/vscode,SofianHn/vscode,hashhar/vscode,hungys/vscode,mjbvz/vscode,joaomoreno/vscode,rishii7/vscode,charlespierce/vscode,hashhar/vscode,ups216/vscode,stkb/vscode,eamodio/vscode,sifue/vscode,landonepps/vscode,hoovercj/vscode,DustinCampbell/vscode,hashhar/vscode,ups216/vscode,joaomoreno/vscode,cleidigh/vscode,matthewshirley/vscode,DustinCampbell/vscode,KattMingMing/vscode,jchadwick/vscode,Zalastax/vscode,radshit/vscode,eamodio/vscode,bsmr-x-script/vscode,microlv/vscode,rishii7/vscode,Microsoft/vscode,jchadwick/vscode,DustinCampbell/vscode,charlespierce/vscode,hashhar/vscode,jchadwick/vscode,stringham/vscode,mjbvz/vscode,zyml/vscode,KattMingMing/vscode,Microsoft/vscode,microlv/vscode,eklavyamirani/vscode,landonepps/vscode,rkeithhill/VSCode,hoovercj/vscode,veeramarni/vscode,the-ress/vscode,landonepps/vscode,jchadwick/vscode,matthewshirley/vscode,SofianHn/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,0xmohit/vscode,Krzysztof-Cieslak/vscode,eklavyamirani/vscode,zyml/vscode,0xmohit/vscode,charlespierce/vscode,charlespierce/vscode,michaelcfanning/vscode,Krzysztof-Cieslak/vscode,Zalastax/vscode,landonepps/vscode,KattMingMing/vscode,mjbvz/vscode,hoovercj/vscode,KattMingMing/vscode,bsmr-x-script/vscode,cleidigh/vscode,ioklo/vscode,veeramarni/vscode,ioklo/vscode,gagangupt16/vscode,zyml/vscode,sifue/vscode,matthewshirley/vscode,takumif/vscode,gagangupt16/vscode,joaomoreno/vscode,cleidigh/vscode,bsmr-x-script/vscode,2947721120/vscode,Microsoft/vscode,0xmohit/vscode,landonepps/vscode,f111fei/vscode,Microsoft/vscode,eamodio/vscode,ups216/vscode,Zalastax/vscode,gagangupt16/vscode,microsoft/vscode,rishii7/vscode,williamcspace/vscode,hashhar/vscode,the-ress/vscode,charlespierce/vscode,mjbvz/vscode,radshit/vscode,punker76/vscode,eklavyamirani/vscode,hoovercj/vscode,KattMingMing/vscode,Zalastax/vscode,DustinCampbell/vscode,eklavyamirani/vscode,stringham/vscode,zyml/vscode,matthewshirley/vscode,microsoft/vscode,the-ress/vscode,bsmr-x-script/vscode,williamcspace/vscode,joaomoreno/vscode,0xmohit/vscode,stkb/vscode,bsmr-x-script/vscode,landonepps/vscode,hoovercj/vscode,microlv/vscode,tottok-ug/vscode,hashhar/vscode,hungys/vscode,ups216/vscode,cleidigh/vscode,matthewshirley/vscode,charlespierce/vscode,sifue/vscode,Krzysztof-Cieslak/vscode,zyml/vscode,ioklo/vscode,radshit/vscode,landonepps/vscode,gagangupt16/vscode,radshit/vscode,hungys/vscode,ups216/vscode,edumunoz/vscode,hoovercj/vscode,williamcspace/vscode | ---
+++
@@ -10,7 +10,7 @@
id: 'html',
extensions: ['.html', '.htm', '.shtml', '.mdoc', '.jsp', '.asp', '.aspx', '.jshtm'],
aliases: ['HTML', 'htm', 'html', 'xhtml'],
- mimetypes: ['text/html', 'text/x-jshtm', 'text/template'],
+ mimetypes: ['text/html', 'text/x-jshtm', 'text/template', 'text/ng-template'],
moduleId: 'vs/languages/html/common/html',
ctorName: 'HTMLMode'
}); |
0cdd7af407f46169601ec81f396409ebc576a0c3 | platforms/platform-alexa/src/AlexaHandles.ts | platforms/platform-alexa/src/AlexaHandles.ts | import { HandleOptions, Jovo } from '@jovotech/framework';
import { AlexaRequest } from './AlexaRequest';
import { PermissionStatus } from './interfaces';
export type PermissionType = 'timers' | 'reminders';
export class AlexaHandles {
static onPermission(status: PermissionStatus, type?: PermissionType): HandleOptions {
return {
global: true,
types: ['Connections.Response'],
platforms: ['alexa'],
if: (jovo: Jovo) =>
(jovo.$request as AlexaRequest).request?.name === 'AskFor' &&
(jovo.$request as AlexaRequest).request?.payload?.status === status &&
(type
? (jovo.$request as AlexaRequest).request?.payload?.permissionScope ===
`alexa::alerts:${type}:skill:readwrite`
: true),
};
}
}
| import { HandleOptions, Jovo } from '@jovotech/framework';
import { AlexaRequest } from './AlexaRequest';
import { PermissionStatus } from './interfaces';
export type PermissionType = 'timers' | 'reminders';
export class AlexaHandles {
static onPermission(status: PermissionStatus, type?: PermissionType): HandleOptions {
return {
global: true,
types: ['Connections.Response'],
platforms: ['alexa'],
if: (jovo: Jovo) =>
(jovo.$request as AlexaRequest).request?.name === 'AskFor' &&
(jovo.$request as AlexaRequest).request?.payload?.status === status &&
(type
? (jovo.$request as AlexaRequest).request?.payload?.permissionScope ===
`alexa::alerts:${type}:skill:readwrite`
: true),
};
}
static onDialogInvoked(): HandleOptions {
return {
global: true,
types: ['Dialog.API.Invoked'],
platforms: ['alexa'],
};
}
}
| Add onDialogInvoked to handle hand-off from Alexa Conversations | :sparkles: Add onDialogInvoked to handle hand-off from Alexa Conversations
| TypeScript | apache-2.0 | jovotech/jovo-framework-nodejs,jovotech/jovo-framework-nodejs | ---
+++
@@ -19,4 +19,12 @@
: true),
};
}
+
+ static onDialogInvoked(): HandleOptions {
+ return {
+ global: true,
+ types: ['Dialog.API.Invoked'],
+ platforms: ['alexa'],
+ };
+ }
} |
06e7bc39ce24164e3623b6c630e79af84af1c9bb | admin/src/main/app-ui/src/app/mapping-interface.ts | admin/src/main/app-ui/src/app/mapping-interface.ts | export interface MappingValues {
OriginTissue: string;
TumorType: string;
SampleDiagnosis: string;
DataSource: string;
}
export interface Mapping {
entityId: number;
entityType: string;
mappingLabels: string[];
mappingValues: MappingValues;
mappedTerm?: any;
mapType?: any;
justification?: any;
status: string;
suggestedMappings: any[];
dateCreated?: any;
dateUpdated?: any;
}
export interface MappingInterface {
mappings: Mapping[];
}
| export interface MappingValues {
OriginTissue: string;
TumorType: string;
SampleDiagnosis: string;
DataSource: string;
}
export interface Mapping {
entityId: number;
entityType: string;
mappingLabels: string[];
mappingValues: MappingValues;
mappedTerm?: any;
mapType?: any;
justification?: any;
status: string;
suggestedMappings: any[];
dateCreated?: any;
dateUpdated?: any;
}
export interface MappingInterface {
mappings: Mapping[];
size: number;
totalElements: number;
totaPages: number;
page: number;
beginIndex: number;
endIndex: number;
currentIndex: number;
}
| Extend the Data Transfer Object Interface in angular to capture pagination info | Extend the Data Transfer Object Interface in angular to capture pagination info
| TypeScript | apache-2.0 | PDXFinder/pdxfinder,PDXFinder/pdxfinder,PDXFinder/pdxfinder,PDXFinder/pdxfinder | ---
+++
@@ -20,7 +20,14 @@
}
export interface MappingInterface {
+
mappings: Mapping[];
+
+ size: number;
+ totalElements: number;
+ totaPages: number;
+ page: number;
+ beginIndex: number;
+ endIndex: number;
+ currentIndex: number;
}
-
- |
72f4c0223b751e579194d44d02bbe2dc7a550a41 | src/test/model-utils.spec.ts | src/test/model-utils.spec.ts | import {fdescribe,describe,expect,fit,it,xit, inject,beforeEach, beforeEachProviders} from 'angular2/testing';
import {provide} from "angular2/core";
import {IdaiFieldObject} from "../app/model/idai-field-object";
import {ModelUtils} from "../app/model/model-utils";
/**
* @author Jan G. Wieners
*/
export function main() {
describe('ModelUtils', () => {
it('should clone an IdaiFieldObject with all of its properties',
function(){
var initialObject = {
"identifier": "ob1",
"title": "Title",
"synced": 0,
"valid": true,
"type": "Object"
};
var clonedObject = ModelUtils.clone(initialObject);
//clonedObject.identifier = "obNew"; // make test fail
expect(clonedObject).toEqual(initialObject);
}
);
})
} | import {fdescribe,describe,expect,fit,it,xit, inject,beforeEach, beforeEachProviders} from 'angular2/testing';
import {provide} from "angular2/core";
import {IdaiFieldObject} from "../app/model/idai-field-object";
import {ModelUtils} from "../app/model/model-utils";
/**
* @author Jan G. Wieners
*/
export function main() {
describe('ModelUtils', () => {
it('should clone an IdaiFieldObject with all of its properties if no filter properties are given',
function(){
var initialObject = {
"identifier": "ob1",
"title": "Title",
"synced": 0,
"valid": true,
"type": "Object"
};
var clonedObject = ModelUtils.filterUnwantedProps(initialObject);
expect(clonedObject).toEqual(initialObject);
}
);
it('should create a full copy of an IdaiFieldObject, not just a reference to the object',
function(){
var initialObject = {
"identifier": "ob1",
"title": "Title",
"synced": 0,
"valid": true,
"type": "Object"
};
var clonedObject = ModelUtils.filterUnwantedProps(initialObject);
expect(clonedObject).not.toBe(initialObject);
}
);
it('should create a clone of an IdaiFieldObject which lacks defined properties',
function(){
var initialObject = {
"identifier": "ob1",
"title": "Title",
"synced": 0,
"valid": true,
"type": "Object"
};
var clonedObject = ModelUtils.filterUnwantedProps(initialObject, ['title', 'synced', 'type']);
var filteredObject = {
"identifier": "ob1",
"valid": true
};
expect(clonedObject).toEqual(filteredObject);
}
);
})
} | Add tests for cloning objects and filtering unwanted object propierties. | Add tests for cloning objects and filtering unwanted object propierties.
| TypeScript | apache-2.0 | codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client | ---
+++
@@ -9,7 +9,7 @@
export function main() {
describe('ModelUtils', () => {
- it('should clone an IdaiFieldObject with all of its properties',
+ it('should clone an IdaiFieldObject with all of its properties if no filter properties are given',
function(){
var initialObject = {
@@ -19,10 +19,43 @@
"valid": true,
"type": "Object"
};
- var clonedObject = ModelUtils.clone(initialObject);
+ var clonedObject = ModelUtils.filterUnwantedProps(initialObject);
+ expect(clonedObject).toEqual(initialObject);
+ }
+ );
- //clonedObject.identifier = "obNew"; // make test fail
- expect(clonedObject).toEqual(initialObject);
+ it('should create a full copy of an IdaiFieldObject, not just a reference to the object',
+ function(){
+
+ var initialObject = {
+ "identifier": "ob1",
+ "title": "Title",
+ "synced": 0,
+ "valid": true,
+ "type": "Object"
+ };
+ var clonedObject = ModelUtils.filterUnwantedProps(initialObject);
+ expect(clonedObject).not.toBe(initialObject);
+ }
+ );
+
+ it('should create a clone of an IdaiFieldObject which lacks defined properties',
+ function(){
+
+ var initialObject = {
+ "identifier": "ob1",
+ "title": "Title",
+ "synced": 0,
+ "valid": true,
+ "type": "Object"
+ };
+ var clonedObject = ModelUtils.filterUnwantedProps(initialObject, ['title', 'synced', 'type']);
+
+ var filteredObject = {
+ "identifier": "ob1",
+ "valid": true
+ };
+ expect(clonedObject).toEqual(filteredObject);
}
);
}) |
82c47a0d04856a7bfea468db580a20f62a2f55cb | examples/spaceGame.ts | examples/spaceGame.ts | import { Boolean, Number, String, Literal, Array, Tuple, Record, Union, Static } from '../src/index'
const Vector = Tuple(Number, Number, Number)
type Vector = Static<typeof Vector>
const Asteroid = Record({
type: Literal('asteroid'),
location: Vector,
mass: Number,
})
type Asteroid = Static<typeof Asteroid>
const Planet = Record({
type: Literal('planet'),
location: Vector,
mass: Number,
population: Number,
habitable: Boolean,
})
type Planet = Static<typeof Planet>
const Rank = Union(
Literal('captain'),
Literal('first mate'),
Literal('officer'),
Literal('ensign'),
)
type Rank = Static<typeof Rank>
const CrewMember = Record({
name: String,
age: Number,
rank: Rank,
home: Planet,
})
type CrewMember = Static<typeof CrewMember>
const Ship = Record({
type: Literal('ship'),
location: Vector,
mass: Number,
name: String,
crew: Array(CrewMember),
})
type Ship = Static<typeof Ship>
const SpaceObject = Union(Asteroid, Planet, Ship)
type SpaceObject = Static<typeof SpaceObject>
| import { Boolean, Number, String, Literal, Array, Tuple, Record, Union, Static } from '../src/index'
const NonNegative = Number.withConstraint(n => n >= 0)
const Vector = Tuple(Number, Number, Number)
type Vector = Static<typeof Vector>
const Asteroid = Record({
type: Literal('asteroid'),
location: Vector,
mass: NonNegative,
})
type Asteroid = Static<typeof Asteroid>
const Planet = Record({
type: Literal('planet'),
location: Vector,
mass: NonNegative,
population: NonNegative,
habitable: Boolean,
})
type Planet = Static<typeof Planet>
const Rank = Union(
Literal('captain'),
Literal('first mate'),
Literal('officer'),
Literal('ensign'),
)
type Rank = Static<typeof Rank>
const CrewMember = Record({
name: String,
age: NonNegative,
rank: Rank,
home: Planet,
})
type CrewMember = Static<typeof CrewMember>
const Ship = Record({
type: Literal('ship'),
location: Vector,
mass: NonNegative,
name: String,
crew: Array(CrewMember),
})
type Ship = Static<typeof Ship>
const SpaceObject = Union(Asteroid, Planet, Ship)
type SpaceObject = Static<typeof SpaceObject>
| Add a constraint to the example | Add a constraint to the example
| TypeScript | mit | pelotom/runtypes,typeetfunc/runtypes,pelotom/runtypes | ---
+++
@@ -1,4 +1,6 @@
import { Boolean, Number, String, Literal, Array, Tuple, Record, Union, Static } from '../src/index'
+
+const NonNegative = Number.withConstraint(n => n >= 0)
const Vector = Tuple(Number, Number, Number)
type Vector = Static<typeof Vector>
@@ -6,15 +8,15 @@
const Asteroid = Record({
type: Literal('asteroid'),
location: Vector,
- mass: Number,
+ mass: NonNegative,
})
type Asteroid = Static<typeof Asteroid>
const Planet = Record({
type: Literal('planet'),
location: Vector,
- mass: Number,
- population: Number,
+ mass: NonNegative,
+ population: NonNegative,
habitable: Boolean,
})
type Planet = Static<typeof Planet>
@@ -29,7 +31,7 @@
const CrewMember = Record({
name: String,
- age: Number,
+ age: NonNegative,
rank: Rank,
home: Planet,
})
@@ -38,7 +40,7 @@
const Ship = Record({
type: Literal('ship'),
location: Vector,
- mass: Number,
+ mass: NonNegative,
name: String,
crew: Array(CrewMember),
}) |
3c1c688716409baf0e104ec9631b1cf3f95ccf37 | packages/lesswrong/components/posts/PostsPage/PostsPageEventData.tsx | packages/lesswrong/components/posts/PostsPage/PostsPageEventData.tsx | import React from 'react'
import { registerComponent, Components } from '../../../lib/vulcan-lib';
import Typography from '@material-ui/core/Typography'
const styles = theme => ({
metadata: {
marginTop:theme.spacing.unit*3,
...theme.typography.postStyle,
color: 'rgba(0,0,0,0.5)',
}
})
const PostsPageEventData = ({classes, post}: {
classes: ClassesType,
post: PostsBase,
}) => {
const { location, contactInfo } = post
return <Typography variant="body2" className={classes.metadata}>
<div className={classes.eventTimes}> <Components.EventTime post={post} dense={false} /> </div>
{ location && <div className={classes.eventLocation}> {location} </div> }
{ contactInfo && <div className={classes.eventContact}> Contact: {contactInfo} </div> }
</Typography>
}
const PostsPageEventDataComponent = registerComponent('PostsPageEventData', PostsPageEventData, {styles});
declare global {
interface ComponentTypes {
PostsPageEventData: typeof PostsPageEventDataComponent
}
}
| import React from 'react'
import { registerComponent, Components } from '../../../lib/vulcan-lib';
import Typography from '@material-ui/core/Typography'
const styles = theme => ({
metadata: {
marginTop:theme.spacing.unit*3,
...theme.typography.postStyle,
color: 'rgba(0,0,0,0.5)',
}
})
const PostsPageEventData = ({classes, post}: {
classes: ClassesType,
post: PostsBase,
}) => {
const { location, contactInfo } = post
return <Typography variant="body2" className={classes.metadata}>
<div className={classes.eventTimes}> <Components.EventTime post={post} dense={false} /> </div>
{ location && <div className={classes.eventLocation}> {location} </div> }
{ contactInfo && <div className={classes.eventContact}> Contact: {contactInfo} </div> }
<Components.Covid19Notice/>
</Typography>
}
const PostsPageEventDataComponent = registerComponent('PostsPageEventData', PostsPageEventData, {styles});
declare global {
interface ComponentTypes {
PostsPageEventData: typeof PostsPageEventDataComponent
}
}
| Add COVID-19 notice to event pages | Add COVID-19 notice to event pages
| TypeScript | mit | Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Lesswrong2 | ---
+++
@@ -19,6 +19,7 @@
<div className={classes.eventTimes}> <Components.EventTime post={post} dense={false} /> </div>
{ location && <div className={classes.eventLocation}> {location} </div> }
{ contactInfo && <div className={classes.eventContact}> Contact: {contactInfo} </div> }
+ <Components.Covid19Notice/>
</Typography>
}
|
1dcf933dde3946397d38dde78ddc668c66d728d7 | packages/@sanity/field/src/diff/annotations/DiffAnnotationCard.tsx | packages/@sanity/field/src/diff/annotations/DiffAnnotationCard.tsx | import React, {createElement} from 'react'
import {useAnnotationColor} from './hooks'
import {AnnotationProps, AnnotatedDiffProps} from './DiffAnnotation'
import {getAnnotationAtPath} from './helpers'
interface BaseDiffAnnotationCardProps {
as?: React.ElementType | keyof JSX.IntrinsicElements
}
export type DiffAnnotationCardProps = (AnnotationProps | AnnotatedDiffProps) &
BaseDiffAnnotationCardProps
export function DiffAnnotationCard(
props: DiffAnnotationCardProps & React.HTMLProps<HTMLDivElement>
): React.ReactElement {
const {as = 'div', children, style = {}, ...restProps} = props
const annotation =
'diff' in props ? getAnnotationAtPath(props.diff, props.path || []) : props.annotation
const color = useAnnotationColor(annotation)
const colorStyle = color ? {background: color.background, color: color.text} : {}
return createElement(as, {...restProps, style: {...colorStyle, ...style}}, children)
}
| import React, {createElement} from 'react'
import {useAnnotationColor} from './hooks'
import {AnnotationProps, AnnotatedDiffProps} from './DiffAnnotation'
import {getAnnotationAtPath} from './helpers'
import {Diff, Annotation} from '../../types'
import {Path} from '../../paths'
interface BaseDiffAnnotationCardProps {
as?: React.ElementType | keyof JSX.IntrinsicElements
diff?: Diff
path?: Path | string
annotation?: Annotation
}
export type DiffAnnotationCardProps = (AnnotationProps | AnnotatedDiffProps) &
BaseDiffAnnotationCardProps
export function DiffAnnotationCard(
props: DiffAnnotationCardProps & React.HTMLProps<HTMLDivElement>
): React.ReactElement {
const {
as = 'div',
children,
path,
diff,
annotation: specifiedAnnotation,
style = {},
...restProps
} = props
const annotation = diff ? getAnnotationAtPath(diff, path || []) : specifiedAnnotation
const color = useAnnotationColor(annotation)
const colorStyle = color ? {background: color.background, color: color.text} : {}
return createElement(as, {...restProps, style: {...colorStyle, ...style}}, children)
}
| Fix diff/path/annotation passed down to DOM element | [field] Fix diff/path/annotation passed down to DOM element
| TypeScript | mit | sanity-io/sanity,sanity-io/sanity,sanity-io/sanity,sanity-io/sanity | ---
+++
@@ -2,9 +2,14 @@
import {useAnnotationColor} from './hooks'
import {AnnotationProps, AnnotatedDiffProps} from './DiffAnnotation'
import {getAnnotationAtPath} from './helpers'
+import {Diff, Annotation} from '../../types'
+import {Path} from '../../paths'
interface BaseDiffAnnotationCardProps {
as?: React.ElementType | keyof JSX.IntrinsicElements
+ diff?: Diff
+ path?: Path | string
+ annotation?: Annotation
}
export type DiffAnnotationCardProps = (AnnotationProps | AnnotatedDiffProps) &
@@ -13,10 +18,17 @@
export function DiffAnnotationCard(
props: DiffAnnotationCardProps & React.HTMLProps<HTMLDivElement>
): React.ReactElement {
- const {as = 'div', children, style = {}, ...restProps} = props
- const annotation =
- 'diff' in props ? getAnnotationAtPath(props.diff, props.path || []) : props.annotation
+ const {
+ as = 'div',
+ children,
+ path,
+ diff,
+ annotation: specifiedAnnotation,
+ style = {},
+ ...restProps
+ } = props
+ const annotation = diff ? getAnnotationAtPath(diff, path || []) : specifiedAnnotation
const color = useAnnotationColor(annotation)
const colorStyle = color ? {background: color.background, color: color.text} : {}
return createElement(as, {...restProps, style: {...colorStyle, ...style}}, children) |
7699ca680dd0a6c5b81da3e1a5cc194c46e8c87c | src/app/doc/utilities/code.card.component.ts | src/app/doc/utilities/code.card.component.ts | import { Component, Input } from '@angular/core';
@Component({
selector: 'codeCard',
template: `<plrsCard sectioned title="Angular Code">
<pre><code>{{ code }}</code></pre>
</plrsCard>`,
styles: ["plrscard {margin-top: 2rem;}"]
})
export class CodeCardComponent {
@Input() public code = '';
}
| import { Component, Input } from '@angular/core';
@Component({
selector: 'codeCard',
template: `<plrsCard sectioned title="Angular Code">
<pre><code>{{ code }}</code></pre>
</plrsCard>`,
styles: [
"plrscard {margin-top: 2rem;}",
"pre {overflow: auto;}"
]
})
export class CodeCardComponent {
@Input() public code = '';
}
| Allow scrolling of the code. | Allow scrolling of the code.
| TypeScript | mit | syrp-nz/angular-polaris,syrp-nz/angular-polaris,syrp-nz/angular-polaris | ---
+++
@@ -4,7 +4,10 @@
template: `<plrsCard sectioned title="Angular Code">
<pre><code>{{ code }}</code></pre>
</plrsCard>`,
- styles: ["plrscard {margin-top: 2rem;}"]
+ styles: [
+ "plrscard {margin-top: 2rem;}",
+ "pre {overflow: auto;}"
+ ]
})
export class CodeCardComponent {
@Input() public code = ''; |
b2ef9b22bb880342e7688303b698a7410ee98763 | server/src/providers/DocumentSymbolProvider.ts | server/src/providers/DocumentSymbolProvider.ts | import { DocumentSymbol, DocumentSymbolParams, IConnection } from 'vscode-languageserver';
import Provider from './Provider';
import { analyses } from '../Analyzer';
export default class DocumentSymbolProvider extends Provider {
static register(connection: IConnection) {
return new DocumentSymbolProvider(connection);
}
constructor(connection: IConnection) {
super(connection);
this.connection.onDocumentSymbol(this.handleDocumentSymbol);
}
private handleDocumentSymbol = async (
params: DocumentSymbolParams
): Promise<DocumentSymbol[]> => {
const {
textDocument: { uri },
} = params;
const analysis = analyses.getAnalysis(uri);
console.log(JSON.stringify(analysis.documentSymbols));
return analysis.documentSymbols;
};
}
| import { DocumentSymbol, DocumentSymbolParams, IConnection } from 'vscode-languageserver';
import Provider from './Provider';
import { analyses } from '../Analyzer';
export default class DocumentSymbolProvider extends Provider {
static register(connection: IConnection) {
return new DocumentSymbolProvider(connection);
}
constructor(connection: IConnection) {
super(connection);
this.connection.onDocumentSymbol(this.handleDocumentSymbol);
}
private handleDocumentSymbol = async (
params: DocumentSymbolParams
): Promise<DocumentSymbol[]> => {
const {
textDocument: { uri },
} = params;
const analysis = analyses.getAnalysis(uri);
return analysis.documentSymbols;
};
}
| Remove document symbol console.log statement | Remove document symbol console.log statement
| TypeScript | mit | rubyide/vscode-ruby,rubyide/vscode-ruby,rubyide/vscode-ruby,rubyide/vscode-ruby,rubyide/vscode-ruby | ---
+++
@@ -19,7 +19,6 @@
textDocument: { uri },
} = params;
const analysis = analyses.getAnalysis(uri);
- console.log(JSON.stringify(analysis.documentSymbols));
return analysis.documentSymbols;
};
} |
c6feaa016a92ff3ef9ba36ea6694a43f04712e2d | tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts | tests/cases/fourslash/completionListImplementingInterfaceFunctions.ts | /// <reference path="fourslash.ts" />
////interface I1 {
//// a(): void;
//// b(): void;
////}
////
////var imp1: I1 {
//// a() {},
//// /*0*/
////}
////
////interface I2 {
//// a(): void;
//// b(): void;
////}
////
////var imp2: I2 {
//// a: () => {},
//// /*1*/
////}
goTo.marker("0");
verify.not.completionListContains("a");
goTo.marker("1");
verify.not.completionListContains("a");
| /// <reference path="fourslash.ts" />
////interface I1 {
//// a(): void;
//// b(): void;
////}
////
////var imp1: I1 {
//// a() {},
//// /*0*/
////}
////
////var imp2: I1 {
//// a: () => {},
//// /*1*/
////}
goTo.marker("0");
verify.not.completionListContains("a");
goTo.marker("1");
verify.not.completionListContains("a");
| Remove unnecessary I2 from test case | Remove unnecessary I2 from test case
| TypeScript | apache-2.0 | microsoft/TypeScript,DLehenbauer/TypeScript,weswigham/TypeScript,jeremyepling/TypeScript,kitsonk/TypeScript,erikmcc/TypeScript,mihailik/TypeScript,nycdotnet/TypeScript,kimamula/TypeScript,kpreisser/TypeScript,DLehenbauer/TypeScript,ziacik/TypeScript,synaptek/TypeScript,erikmcc/TypeScript,minestarks/TypeScript,mmoskal/TypeScript,evgrud/TypeScript,fabioparra/TypeScript,blakeembrey/TypeScript,mmoskal/TypeScript,kitsonk/TypeScript,basarat/TypeScript,evgrud/TypeScript,SaschaNaz/TypeScript,donaldpipowitch/TypeScript,basarat/TypeScript,yortus/TypeScript,kpreisser/TypeScript,plantain-00/TypeScript,vilic/TypeScript,yortus/TypeScript,ionux/TypeScript,plantain-00/TypeScript,evgrud/TypeScript,thr0w/Thr0wScript,kimamula/TypeScript,chuckjaz/TypeScript,Eyas/TypeScript,alexeagle/TypeScript,kpreisser/TypeScript,mihailik/TypeScript,samuelhorwitz/typescript,yortus/TypeScript,thr0w/Thr0wScript,jwbay/TypeScript,nycdotnet/TypeScript,DLehenbauer/TypeScript,SaschaNaz/TypeScript,Eyas/TypeScript,jwbay/TypeScript,RyanCavanaugh/TypeScript,erikmcc/TypeScript,jeremyepling/TypeScript,weswigham/TypeScript,vilic/TypeScript,mmoskal/TypeScript,donaldpipowitch/TypeScript,TukekeSoft/TypeScript,alexeagle/TypeScript,mmoskal/TypeScript,vilic/TypeScript,samuelhorwitz/typescript,Eyas/TypeScript,microsoft/TypeScript,RyanCavanaugh/TypeScript,thr0w/Thr0wScript,nojvek/TypeScript,Eyas/TypeScript,nycdotnet/TypeScript,jeremyepling/TypeScript,AbubakerB/TypeScript,kitsonk/TypeScript,nojvek/TypeScript,minestarks/TypeScript,blakeembrey/TypeScript,synaptek/TypeScript,chuckjaz/TypeScript,ziacik/TypeScript,SaschaNaz/TypeScript,synaptek/TypeScript,mihailik/TypeScript,chuckjaz/TypeScript,basarat/TypeScript,DLehenbauer/TypeScript,AbubakerB/TypeScript,minestarks/TypeScript,donaldpipowitch/TypeScript,donaldpipowitch/TypeScript,blakeembrey/TypeScript,TukekeSoft/TypeScript,yortus/TypeScript,alexeagle/TypeScript,ionux/TypeScript,kimamula/TypeScript,samuelhorwitz/typescript,microsoft/TypeScript,AbubakerB/TypeScript,ziacik/TypeScript,TukekeSoft/TypeScript,plantain-00/TypeScript,nycdotnet/TypeScript,mihailik/TypeScript,Microsoft/TypeScript,weswigham/TypeScript,thr0w/Thr0wScript,ionux/TypeScript,kimamula/TypeScript,RyanCavanaugh/TypeScript,fabioparra/TypeScript,vilic/TypeScript,plantain-00/TypeScript,nojvek/TypeScript,samuelhorwitz/typescript,jwbay/TypeScript,Microsoft/TypeScript,ziacik/TypeScript,chuckjaz/TypeScript,nojvek/TypeScript,SaschaNaz/TypeScript,evgrud/TypeScript,erikmcc/TypeScript,synaptek/TypeScript,fabioparra/TypeScript,ionux/TypeScript,fabioparra/TypeScript,basarat/TypeScript,jwbay/TypeScript,blakeembrey/TypeScript,AbubakerB/TypeScript,Microsoft/TypeScript | ---
+++
@@ -10,12 +10,7 @@
//// /*0*/
////}
////
-////interface I2 {
-//// a(): void;
-//// b(): void;
-////}
-////
-////var imp2: I2 {
+////var imp2: I1 {
//// a: () => {},
//// /*1*/
////} |
811a44e5fd539d6dd1da83ec807795e9c40d850a | src/app/model/SearchQuery.ts | src/app/model/SearchQuery.ts | /**
* Created by user on 4/7/2017.
*/
export class Rule {
condition = 'equal';
field = 'all_fields';
data = '';
data2 = '';
query: SearchQuery = null;
}
export class SearchQuery {
operator = 'AND';
rules: Rule[] = [];
constructor() {
const rule: Rule = new Rule();
this.rules.push(rule);
}
public toQueryString(): string {
let str = '';
for (let i = 0; i < this.rules.length; i++) {
if (i > 0) {
str += ' ' + this.operator + ' ';
}
if (null != this.rules[i].query) {
const tmp = this.rules[i].query.toQueryString();
if (tmp !== '') {
str += '(' + tmp + ')';
}
} else {
const rule = this.rules[i];
let strtemp = '';
if (rule.condition === 'range') {
strtemp = '["' + rule.data + '" TO "' + (rule.data2 || '') + '"]';
}
if (rule.condition === 'equal') {
if (rule.data !== '') {
strtemp = '"' + rule.data + '"';
}
}
if (rule.field === 'all_fields') {
str += strtemp;
} else {
str += rule.field + ': ' + strtemp;
}
}
}
return str;
}
}
| /**
* Created by user on 4/7/2017.
*/
export class Rule {
condition = 'equal';
field = 'all_fields';
data = '';
data2 = '';
query: SearchQuery = null;
}
export class SearchQuery {
operator = 'AND';
rules: Rule[] = [];
constructor() {
const rule: Rule = new Rule();
this.rules.push(rule);
}
public toQueryString(): string {
let str = '';
for (let i = 0; i < this.rules.length; i++) {
if (i > 0) {
str += ' ' + this.operator + ' ';
}
if (null != this.rules[i].query) {
const tmp = this.rules[i].query.toQueryString();
if (tmp !== '') {
str += '(' + tmp + ')';
}
} else {
const rule = this.rules[i];
let strtemp = '';
if (rule.condition === 'range') {
strtemp = '["' + rule.data + '" TO "' + (rule.data2 || '') + '"]';
}
if (rule.condition === 'equal') {
if (rule.data !== '') {
strtemp = '"' + rule.data + '"';
}
}
if (rule.field === 'all_fields') {
if (strtemp[0] === '"') {
strtemp = strtemp.slice(1, strtemp.length - 1);
}
str += strtemp;
} else {
str += rule.field + ': ' + strtemp;
}
}
}
return str;
}
}
| Fix facet selecting not worked | Fix facet selecting not worked
| TypeScript | unknown | BD2K-DDI/ddi-web-app,OmicsDI/ddi-web-app,OmicsDI/ddi-web-app,BD2K-DDI/ddi-web-app,OmicsDI/ddi-web-app | ---
+++
@@ -43,6 +43,9 @@
}
if (rule.field === 'all_fields') {
+ if (strtemp[0] === '"') {
+ strtemp = strtemp.slice(1, strtemp.length - 1);
+ }
str += strtemp;
} else {
str += rule.field + ': ' + strtemp; |
0ad3e930c5bf430b1fc5210b99706e6ab4639041 | packages/tux/src/services/editor.ts | packages/tux/src/services/editor.ts | const schema = new Map()
export interface Field {
field: string,
label: string,
component: React.ReactElement<any>,
props?: Object
}
export interface Meta {
type: string,
editorSchema?: Array<Field>,
name?: string,
}
export function registerEditable(type: string,
value: Array<Object> | ((editorSchema: Map<string, Field>) => Map<string, Field>)) {
schema.set(type, value)
}
export function getEditorSchema(meta: Meta): Array<Field> {
const adapterSchema = meta.editorSchema
const userDefinedSchema = schema.get(meta.type)
if (adapterSchema && !userDefinedSchema) {
return adapterSchema
} else if (!adapterSchema && userDefinedSchema) {
if (userDefinedSchema instanceof Array) {
return userDefinedSchema
}
// else, if the userDefinedSchema is a function to operate on current schema
// we do not have any schema to operate on, so return an empty array
} else if (adapterSchema && userDefinedSchema) {
if (userDefinedSchema instanceof Array) {
// overwrite adapter schema
return userDefinedSchema
} else if (userDefinedSchema instanceof Function) {
// operate on adapter schema with user provided function
const schemaAsMap = new Map(adapterSchema.map(field => [field.field, field]))
const editedSchema = userDefinedSchema(schemaAsMap)
const result = []
for (const field of editedSchema) {
result.push(field)
}
return result
}
}
return []
}
| const schema = new Map()
export interface Field {
field: string,
label: string,
component: React.ReactElement<any>,
props?: Object
}
export interface Meta {
type: string,
editorSchema?: Array<Field>,
name?: string,
}
export function registerEditable(
type: string,
value: Array<Field> | ((editorSchema: Map<string, Field>) => Map<string, Field>)
) {
schema.set(type, value)
}
export function getEditorSchema(meta: Meta): Array<Field> {
const adapterSchema = meta.editorSchema
const userDefinedSchema = schema.get(meta.type)
if (adapterSchema && !userDefinedSchema) {
return adapterSchema
} else if (!adapterSchema && userDefinedSchema) {
if (userDefinedSchema instanceof Array) {
return userDefinedSchema
}
// else, if the userDefinedSchema is a function to operate on current schema
// we do not have any schema to operate on, so return an empty array
} else if (adapterSchema && userDefinedSchema) {
if (userDefinedSchema instanceof Array) {
// overwrite adapter schema
return userDefinedSchema
} else if (userDefinedSchema instanceof Function) {
// operate on adapter schema with user provided function
const schemaAsMap = new Map(adapterSchema.map(field => [field.field, field]))
const editedSchema = userDefinedSchema(schemaAsMap)
const result = []
for (const field of editedSchema) {
result.push(field)
}
return result
}
}
return []
}
| Change expected type of value in registerEditable | Change expected type of value in registerEditable
| TypeScript | mit | aranja/tux,aranja/tux,aranja/tux | ---
+++
@@ -13,8 +13,10 @@
name?: string,
}
-export function registerEditable(type: string,
- value: Array<Object> | ((editorSchema: Map<string, Field>) => Map<string, Field>)) {
+export function registerEditable(
+ type: string,
+ value: Array<Field> | ((editorSchema: Map<string, Field>) => Map<string, Field>)
+) {
schema.set(type, value)
}
|
143ac55a08c94b524581d4a8cbe0a48d40f834b6 | src/providers/sentry-error.ts | src/providers/sentry-error.ts | import { IonicErrorHandler } from 'ionic-angular';
import Raven from 'raven-js';
Raven
.config('https://54c01f896cbb4594b75639dfbf59b81e@sentry.io/155883')
.install();
// Sentry.io error handling
export class SentryErrorHandler extends IonicErrorHandler {
handleError(error) {
super.handleError(error);
try {
Raven.captureException(error.originalError || error);
Raven.showReportDialog({});
}
catch (e) {
console.error(e);
}
}
} | import { IonicErrorHandler } from 'ionic-angular';
import Raven from 'raven-js';
// only initialize Sentry.io if on actual device
if ((<any>window).cordova)
Raven
.config('https://54c01f896cbb4594b75639dfbf59b81e@sentry.io/155883')
.install();
// Sentry.io error handling
export class SentryErrorHandler extends IonicErrorHandler {
handleError(error) {
super.handleError(error);
try {
Raven.captureException(error.originalError || error);
Raven.showReportDialog({});
}
catch (e) {
console.error(e);
}
}
} | Disable error logging in dev | Disable error logging in dev
| TypeScript | mit | longzheng/mypal-ionic,longzheng/mypal-ionic,longzheng/mypal-ionic | ---
+++
@@ -1,9 +1,11 @@
import { IonicErrorHandler } from 'ionic-angular';
import Raven from 'raven-js';
-Raven
- .config('https://54c01f896cbb4594b75639dfbf59b81e@sentry.io/155883')
- .install();
+// only initialize Sentry.io if on actual device
+if ((<any>window).cordova)
+ Raven
+ .config('https://54c01f896cbb4594b75639dfbf59b81e@sentry.io/155883')
+ .install();
// Sentry.io error handling
export class SentryErrorHandler extends IonicErrorHandler { |
86047a7206c60e7964e7108f7aab758bc485bd5b | tests/cases/fourslash/superInsideInnerClass.ts | tests/cases/fourslash/superInsideInnerClass.ts | / / / < |