Skip to content

Instantly share code, notes, and snippets.

[playlist]
File1=http://pub1.diforfree.org:8000/di_futurebass_hi
Title1=Future Bass
File2=http://pub1.diforfree.org:8000/di_vocaltrance_hi
Title2=Vocal Trance
File3=http://pub1.diforfree.org:8000/di_chillntropicalhouse_hi
Title3=Chill & Tropical House
[playlist]
File1=http://pub1.diforfree.org:8000/di_hit00s_hi
Title1=00s Hits
File2=http://pub1.diforfree.org:8000/di_00srnb_hi
Title2=00s R&B
File3=http://pub1.diforfree.org:8000/di_hit60s_hi
Title3=60s Hits
Parse speed:
compact JSON 1kb binary: 7700ns, 120mb/sec
msgpack 1kb binary: 41000ns, 22mb/sec
Filter array with custom function:
1k rows: 6600ns, 150 mln objects/sec
Uint8 read: 600mb/s
Create 8 fields object with constructor: 20ns (6m) 500 mln/sec
@cevek
cevek / example.ts
Last active May 15, 2018 14:39
Replace transformer example
function foo() {}
var a = foo();
var b = foo();
function bar() {
const foo = 1;
return foo + 2;
}
eval
new Function
new GeneratorFunction
new AsyncFunction
setTimeout("eval")
setInterval("eval")
div.innerHTML
div.setAttribute("onclick", "eval") // all events
div.attributes.setNamedItem
div.attributes.setNamedItemNS
@cevek
cevek / fibers.js
Created May 30, 2018 13:19
Fibers with async await
var prev = Date.now();
var callbacks;
function wait() {
return new Promise((resolve) => {
if (Date.now() > prev + 8) {
if (callbacks === undefined) {
callbacks = [];
callbacks.push(resolve);
requestAnimationFrame(() => {
prev = Date.now();
@cevek
cevek / result.js
Last active December 15, 2020 05:22
Typescript pre transformer
"use strict";
function Bar(props) { return null; }
React.createElement(Bar, { sdf: true, id: 'hello' });
React.createElement("div", { id: 'hi' }, "abc");
React.createElement("div", null, "abc");
@cevek
cevek / wait.js
Last active June 4, 2018 21:14
Wait until all async is done
var arr = [];
function allDone() { console.log('All done') }
function replaceCallback(callback) {
if (typeof callback !== 'function') return callback;
arr.push(callback);
return function () {
var pos = arr.indexOf(callback);
if (pos > -1) arr.splice(pos, 1);
var res = callback.apply(this, arguments);
if (arr.length === 0) allDone();
type AtLeastOne<T, U = { [K in keyof T]: { [P in K]: T[P] } }> = { [P in keyof T]?: T[P] } & U[keyof U];
type Exactify<Base, T extends Base> = Base & { [K in keyof T]: K extends keyof Base ? T[K] : never };
declare function requireExact<X extends Exactify<{a: number}, X>>(x: X): void;
type Omit<T, Keys extends string> = Pick<T, Exclude<keyof T, Keys>>;
type IfEquals<X, Y, A=X, B=never> =
(<T>() => T extends X ? 1 : 2) extends
(<T>() => T extends Y ? 1 : 2) ? A : B;
type WritableKeys<T> = {
// Поместите настраиваемые сочетания клавиш в этот файл, чтобы перезаписать клавиши по умолчанию.
[
{
"key": "cmd+k",
"command": "workbench.action.terminal.clear",
},
{
"key": "cmd+alt+i",
"command": "workbench.action.terminal.toggleTerminal"
},