Skip to content

Instantly share code, notes, and snippets.

View linuxenko's full-sized avatar

Svetlana Linuxenko linuxenko

View GitHub Profile
IMAGE_MAGIC = {
'JPG' => 'ffd8',
'BMP' => '424d',
'TIFF-LE' => '49492a00',
'TIFF-BE' => '4d4d002a',
'GIF87a' => '474946383761',
'GIF89a' => '474946383961',
'PNG' => '89504e470d0a1a0a',
}.freeze
IMAGE_MAGIC_LEN = (IMAGE_MAGIC.values.map(&:size).max / 2.0).ceil
@linuxenko
linuxenko / lib.js
Created December 13, 2016 20:54 — forked from juandopazo/lib.js
Function.prototype.extend for simple classes in ES5
Object.getOwnPropertyDescriptors = function getOwnPropertyDescriptors(obj) {
var descriptors = {};
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
descriptors[prop] = Object.getOwnPropertyDescriptor(obj, prop);
}
}
return descriptors;
};
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@linuxenko
linuxenko / 1-1000.txt
Created March 8, 2017 08:01 — forked from deekayen/1-1000.txt
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that