Skip to content

Instantly share code, notes, and snippets.

View Semigradsky's full-sized avatar
😉

Dmitry Semigradsky Semigradsky

😉
View GitHub Profile
ЕАЭС (2015 - ...)
===
- Армения
- Белоруссия
- Казахстан
- Киргизия
- Россия
Глобальный инновационный индекс
224 - Воронянского 13к4
212 - Казинца 105А
275 - Асаналиева 42А
367 - Рокоссовского 27
230 - Стахановская 25А
245 - Менделеева 13
2918 - Бабушкина 14
200 - Гебелева 7
2721 - Есенина 14
2592 - Панченко 8
import BaseWidget from 'widgets/mixins/base/BaseWidget';
import Taggable from 'widgets/mixins/behaviour/Taggable';
type TaggableWidget = BaseWidget & Taggable;
/**
* Find intersection of two intervals: (a, b) and (c, d)
*/
function findIntersection(a: number, b: number, c: number, d: number): number {

Вспомогательные функции:

function fac(x) {
  return x === 1 ? 1 : x*fac(x-1);
}

Практические аспекты обращения с деревьями

Число возможных топология для дерева.

@Semigradsky
Semigradsky / index.md
Created May 6, 2017 08:38
truncate.js-tests
  truncate.js
    ✓ truncates nothing when content fits (52ms)
    1) truncate correctly with default options
    ✓ truncate correctly word with no space
    2) truncate correctly white space
    3) truncate correctly when container has no margin or padding
    4) truncate correctly when container has margin
    5) truncate correctly when container has padding
    6) truncate correctly when container has margin and padding
@Semigradsky
Semigradsky / Collection.js
Created March 26, 2017 10:54
cancellable async
function Collection(options) {
this.index = options.index || 'id';
this.format = options.format;
this.data = [];
this.indexes = {};
this.asyncTasks = new AsyncTasks();
}
var model = new Collection({
format: () => ({})
// Manually simulating an apply() for constructors
var arr = [2011, 11, 24];
new (Function.prototype.bind.apply(
Date, [null].concat(arr)))
// Switching over an object’s constructor
try {
/*
* Repeating the background mostly makes sense in the <body>. Otherwise, people
* usually want the image and preferably its center (not the top-right corner)
*/
*:not(body) {
background-repeat: no-repeat;
background-position: 50%;
background-size: cover;
}
function template(str, obj) {
return str.replace(/\{(\w+)\}/g, (_, x) => {
const value = obj[x];
return Array.isArray(value) ? value.join(', ') : value;
});
}
{
"AB": "Abkhazia",
"AD": "Andorra",
"AE": "United Arab Emirates",
"AF": "Afghanistan",
"AG": "Antigua and Barbuda",
"AI": "Anguilla",
"AL": "Albania",
"AM": "Armenia",
"AO": "Angola",