- вино - 5 бут
- мясо готовое
- мясо маринованное
- сыр
- крекеры
- томаты
- овощи-зелень
This file contains hidden or 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
input = [0,1,2,3,4,5,6,7,8,9] | |
len = 3 | |
resort = function(input, len) { | |
count = len | |
while(count--) { | |
last = input.length-(len-count) | |
id = parseInt(Math.random()*last) | |
el = input[id] | |
input[id] = input[last] |
This file contains hidden or 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
let resolver = (sbj, ctx = {}) => Observable.zip( ...Object.keys(sbj).map(k => sbj[k]), (...args) => | |
args.reduce((r, a, n) => Object.defineProperty(r, Object.keys(sbj)[n], {value: a, enumerable: true}) | |
, ctx)) |
This file contains hidden or 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
d = { v: i for i, v in enumerate('zero one two three four five six seven eight nine ten eleven twelve thirteen'.split())} | |
d.update({v+'teen': i+10 for v, i in d.items() if 3 < i < 10}) | |
d.update({'fifteen': 15, 'eighteen': 18}) | |
d.update({v: (i+2)*10 for i, v in enumerate('twenty thirty forty fifty sixty seventy eighty ninety'.split())}) | |
def parse_int(s): | |
if 'million' in s: return 1E6 | |
s = s.replace('thousand', '|').replace('and ', '').replace('-', ' ').replace('hundred', '-') | |
keys =[[sum([ d[k] for k in x.strip().split()]) for x in a.split('-')[::-1]] for a in s.split('|')[::-1]] | |
return sum([sum([100**j*1000**i*a for j, a in enumerate(b)]) for i, b in enumerate(keys)]) |
This file contains hidden or 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
{ | |
"data": [ | |
{ | |
"os_type": "mobile", | |
"country": "KW", | |
"ssp_id": 360, | |
"maxbid": 12.28427727968510824 | |
} | |
] | |
} |
This file contains hidden or 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
describe('sync', () => { | |
test('value', () => expect(100500).toBe(100500)) | |
test('throw', () => expect(() => { throw 100500 }).toThrow('100500')) | |
}) | |
describe('async', () => { | |
describe('.resolves', () => { | |
test('sleep', () => expect( | |
new Promise(resolve => setTimeout(() => resolve(100500), 1)) | |
).resolves.toBe(100500)) |