This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component, ViewEncapsulation, Directive, Input, ContentChild, Renderer2, ElementRef} from "@angular/core"; | |
@Directive({ | |
selector: "input,select,textarea" | |
}) | |
export class FormInputDirective { | |
} | |
@Directive({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BehaviorSubject, Observable} from 'rxjs'; | |
@Injectable() | |
export class LocalStorage implements ILocalStorage { | |
protected subjects: {[key: string]: BehaviorSubject<any>} = {}; | |
select(key: string, defaultValue: any = null): Observable<any> { | |
if (this.subjects.hasOwnProperty(key)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [1, 3, 3, 1] => [[1, 3], [3, 3], [3, 1]] | |
const pairs = ([head, ...tail]) => tail.map((item, i) => i === 0 ? [head, item] : [tail[i - 1], item]); | |
// [1, 3, 3, 1] => [1, 4, 6, 4, 1] | |
const next = numbers => [1, ...pairs(numbers).reduce((carry, pair) => [...carry, pair[0] + pair[1]], []), 1]; | |
// 5 => <5 rows of pascal triangle> | |
const pascal = (n, carry = [[1]]) => n > 1 ? pascal(n - 1, [next(carry[0]), ...carry]) : carry.reverse(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Client</title> | |
<script> | |
function openWindow() { | |
window.open('http://service/auth.html', '_blank', "toolbar=0,location=0,menubar=0,height=600,width=400"); | |
window.addEventListener('message', function(message) { | |
document.write('Authorized with token: ' + message.data.token); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const compose: (...funcs) => (value: any) => any = | |
(...funcs) => value => funcs.reduce((value, func) => value !== undefined ? func(value) : undefined, value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ "keys": ["tab"], "command": "unbound", "context": | |
[ | |
{ "key": "has_next_field", "operator": "equal", "operand": true } | |
] | |
}, | |
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": true} }, | |
{ "keys": ["tab"], "command": "insert_best_completion", "args": {"default": "\t", "exact": false}, | |
"context": | |
[ |
NewerOlder