Вспомогательные функции:
function fac(x) {
return x === 1 ? 1 : x*fac(x-1);
}
Число возможных топология для дерева.
ЕАЭС (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 { |
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
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", |