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
const step = 24 * 60 * 60 * 1000; | |
function findMissed(values) { | |
const dates = values.map(x => new Date(x.date).getTime()); | |
const sum = dates.reduce((acc, x) => acc + x); | |
const min = Math.min(...dates); | |
return new Date((min * (dates.length + 1) + step * (dates.length + 1) * dates.length / 2) - sum).toISOString().split('T')[0]; | |
} |
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
const dates = [{date: '2018-01-02'}, {date: '2018-01-03'}]; | |
function findMissed(values) { | |
let arr = values.map(x => new Date(x).getTime()); | |
const step = 24 * 60 * 60 * 1000; | |
while (arr.length >= 2) { | |
const randomIndex = Math.floor(Math.random() * arr.length + 1); | |
const randomItem = arr[randomIndex]; | |
let leftBucket = []; | |
let rightBucket = []; | |
let rightBucketMin = Infinity; |
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 socketIo = require('socket.io-client') | |
const client = socketIo.connect('http://localhost:8080') | |
setInterval(() => { | |
client.emit('custom_stream', Buffer.from('aaaa')) | |
}, 1000) |
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
// polyfill | |
if (Symbol["asyncIterator"] === undefined) ((Symbol as any)["asyncIterator"]) = Symbol.for("asyncIterator") | |
const enum TokenTypes { | |
value, | |
bracket, | |
operation, | |
} | |
interface 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 class users_layers extends Model<users_layers> { | |
@AutoIncrement | |
@PrimaryKey | |
@Column(DataType.INTEGER) | |
id: number; | |
@ForeignKey(() => users) | |
@Column(DataType.CHAR(100)) | |
user_id: string; | |
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
// ==UserScript== | |
// @name Fanfics auto refresh | |
// @version 0.1 | |
// @match http://fanfics.me/message* | |
// @grant none | |
// ==/UserScript== | |
(function(window) { | |
'use strict'; | |
window.setInterval(function() { |
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
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define gen_time 1000 | |
#define sum_time 2000 | |
#define prin_time 3000 | |
// Размерность матриц |