Skip to content

Instantly share code, notes, and snippets.

@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;
}
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
[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
[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
copy('[playlist]\n'+AudioAddict.WP.channels.map((ch,i) => (ch=ch.channel ? ch.channel : ch,`File${i+1}=http://pub1.diforfree.org:8000/di_${ch.key}_hi\nTitle${i+1}=${ch.name}`)).join('\n\n') + `\n\nNumberOfEntries=${AudioAddict.WP.channels.length}\nVersion=2`)
import * as React from 'react';
interface AppProps {
urlParams: { name: string },
searchParams: { foo: string }
}
class App extends React.Component<AppProps, {}> {
}
interface ListProps {
--experimental_extras (enable code compiled in via v8_experimental_extra_library_files)
type: bool default: false
--use_strict (enforce strict mode)
type: bool default: false
--es_staging (enable test-worthy harmony features (for internal use only))
type: bool default: false
--harmony (enable all completed harmony features)
type: bool default: false
--harmony_shipping (enable all shipped harmony features)
type: bool default: true
function getRandomObj(i) {
switch (i % 5) {
case 0:
return {a: 1, b: i, c: 3, d: "abc", k: true};
case 1:
return {c: "sadf", k: false};
case 2:
return {a: null, b: 45};
case 3:
return {a: null, b: 45, c: 2, d: "Asdaf"};
var orig = Common.Revealer.reveal;
Common.Revealer.reveal = function(revealable, omitFocus) {
console.log(revealable);
// console.log(Persistence.persistence.binding(uiSourceCode).fileSystem.url())
orig.apply(this, arguments);
}
@cevek
cevek / obj arr.js
Last active January 26, 2017 15:47
function Node(kind) {
this.kind = kind;
}
var node = new Node(0);
var node1 = new Node(1);
node1.expression = node;
var node2 = new Node(2);