Skip to content

Instantly share code, notes, and snippets.

View sanex3339's full-sized avatar
💭
Something happening!

Timofey Kachalov sanex3339

💭
Something happening!
View GitHub Profile
export function ArraySortBy <T> (array: T[], getProperty: (value: T) => any): T[] {
return array.sort((a, b) => {
let aValue: any = getProperty(a),
bValue: any = getProperty(b);
if (aValue === undefined || bValue === undefined) {
return 0;
}
return (aValue > bValue ) ? 1 : ((bValue > aValue) ? -1 : 0);
@sanex3339
sanex3339 / gist:78fba42ee9597e605c93a744048741e8
Created April 1, 2016 14:30
Deep Extend underscore typescrpit
import * as _ from "underscore";
/**
* @param destination
* @param sources
* @returns {any}
* @constructor
*/
export function DeepExtend (destination: any, ...sources: any[]): any {
var parentRE: RegExp = new RegExp('#{\s*?_\s*?}');
https://maxfarseer.gitbooks.io/redux-course-ru/content/
/**
* Находит на странице слова из словаря, если кол-во слов больше лимита - сайт порнографической/эротической тематики.
*
* @param dictionary
* @param debug
* @constructor
*/
function PornoDetector (dictionary, debug) {
this.dictionary = dictionary;
this.filteredDictionary = [];
var StringExpressionParser = function () {
this.operators = [
'+', '-', '*', '/', '^'
];
this.priorities = [
['*', '/'],
['+', '-']
];
};