Skip to content

Instantly share code, notes, and snippets.

View maxvipon's full-sized avatar

Maxim Ponomarev maxvipon

View GitHub Profile
@maxvipon
maxvipon / bench-some-vs-set.js
Created May 4, 2018 06:28
Bench Arr.some vs Set.has
const Benchmark = require('benchmark').Benchmark;
const suite = new Benchmark.Suite;
const users = new Array(50).fill().map(gen);
const logins = new Array(10).fill().map(gen);
function random(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
@maxvipon
maxvipon / dabblet.css
Created December 7, 2016 11:03
Untitled
html,body {
min-height: 100%;
height: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
@maxvipon
maxvipon / dabblet.css
Created December 6, 2016 09:57
Untitled
.a {
display: flex;
width: 100%;
height: 200px;
}
.b {
background: blue;
min-width: 100px;
min-height: 100%;
@maxvipon
maxvipon / bench-array.js
Created September 13, 2016 06:37
Bench const array vs dynamic array
const Benchmark = require('benchmark').Benchmark;
const suite = new Benchmark.Suite();
function uid() {
return 'xxx'.replace(/x/g, function(c) {
return Math.floor(Math.random()*10);
});
}
const count = 100;
html, body {
height: 100%;
margin: 0;
padding: 0;
}
.one {
background-color: yellow;
width: 200px;
height: 100px;
margin-top: 10%;
@maxvipon
maxvipon / dabblet.css
Last active June 22, 2016 10:50
sizes
@font-face
{
font-family: 'Open Sans';
font-weight: normal;
src: local('Open Sans');
src: url(data:application/octet-stream;base64,d09GRgABAAAAAPjgABIAAAABnwwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABlAAAABwAAAAcXcVGfkdERUYAAAGwAAAAHgAAACAD3gADR1BPUwAAAdAAAAAgAAAAIGyRdI9HU1VCAAAB8AAAAb8AAAKKSI+4209TLzIAAAOwAAAAXwAAAGChNp7WY21hcAAABBAAAAMiAAAEfs0qHI1jdnQgAAAHNAAAAEQAAABECwcOSmZwZ20AAAd4AAABsQAAAmUPtC+nZ2FzcAAACSwAAAAIAAAACAAAABBnbHlmAAAJNAAAz9oAAVocaDlL+GhlYWQAANkQAAAAMwAAADb6fLBQaGhlYQAA2UQAAAAhAAAAJA3MCX1obXR4AADZaAAABzkAAA6881I+gmxvY2EAAOCkAAAHMwAAB2R3/NCSbWF4cAAA59gAAAAgAAAAIATnAq1uYW1lAADn+AAAAPUAAAG+JThAUXBvc3QAAOjwAAAPFgAAH3APmSRLcHJlcAAA+AgAAADYAAABfMhgFiwAAAABAAAAAMmJbzEAAAAAyTUxiwAAAADLBqXBeNpjYGRgYOADYgkGEGBiAPKZNwBJFjCPAQAL8QDlAAAAAQAAAAoAHAAeAAFsYXRuAAgABAAAAAD//wAAAAAAAHjaXVJNaxNRFD1vTpM0g4tAkqqxFHFRsijFKmTZlRRSkkwRKV0FgtCiTBNlJkaEfmptq7b18wfEfqlV202LS3+DC7dSiiAiIhKki0J638uAKMOcc9+95368OwMFwMYVfIZyS34Z7YjByju5s0hfdvKCQLOJqKgUiDaEEEZEVFHjt43f+i9iu9fGSuh3y9VxXHIrV10MVrQ9dEPjiFdyfRQ9
@maxvipon
maxvipon / dabblet.css
Last active March 10, 2016 06:05
Untitled
.a {
display: flex;
flex-flow: column nowrap;
width: 200px;
height: 200px;
background: yellow;
border: 1px solid #999;
padding: 5px;
box-sizing: border-box;
}
@maxvipon
maxvipon / random-item.js
Created September 11, 2015 09:41
Random item from Array
items[ Math.floor(Math.random() * items.length) ]
items[ ~~(Math.random() * items.length) ]
items[ Math.random() * items.length >>> 0 ]
@maxvipon
maxvipon / bench-hash.js
Created September 11, 2015 09:38
bench-hash
const Benchmark = require('benchmark').Benchmark;
const siphash = require('siphash');
const murmur = require('murmur');
const HASH_KEY = siphash['string16_to_key']('A054ED26FF2BC196');
const suite = new Benchmark.Suite('Generate Hash');
var hash;
@maxvipon
maxvipon / bench-number.js
Last active September 11, 2015 09:37
bench-number
const Benchmark = require('benchmark').Benchmark;
const suite = new Benchmark.Suite();
function uid() {
return 'xxx'.replace(/x/g, function(c) {
return Math.floor(Math.random()*10);
});
}
const count = 100;