Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
d̷o̷n̷'̷t̷ ̷e̷v̷e̷n̷ ̷t̷r̷y̷ ̷t̷o̷ ̷b̷o̷t̷h̷e̷r̷ ̷m̷e̷

Svetlana Linuxenko linuxenko

💭
d̷o̷n̷'̷t̷ ̷e̷v̷e̷n̷ ̷t̷r̷y̷ ̷t̷o̷ ̷b̷o̷t̷h̷e̷r̷ ̷m̷e̷
  • ⓡⓐⓖⓤⓛⓐⓝⓓ
View GitHub Profile
@linuxenko
linuxenko / 1-1000.txt
Created Mar 8, 2017 — forked from deekayen/1-1000.txt
1,000 most common US English words
View 1-1000.txt
the
of
to
and
a
in
is
it
you
that
View es6-feature-detection.js
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 / lib.js
Created Dec 13, 2016 — forked from juandopazo/lib.js
Function.prototype.extend for simple classes in ES5
View lib.js
Object.getOwnPropertyDescriptors = function getOwnPropertyDescriptors(obj) {
var descriptors = {};
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
descriptors[prop] = Object.getOwnPropertyDescriptor(obj, prop);
}
}
return descriptors;
};
View identify_image_format.rb
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 / encoder.js
Created Nov 19, 2016 — forked from mscdex/encoder.js
Encode text into a PNG
View encoder.js
const kCRCTable = new Int32Array([
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
@linuxenko
linuxenko / nanopng.cpp
Created Nov 19, 2016 — forked from fpsunflower/nanopng.cpp
Tiny PNG output
View nanopng.cpp
// c++ -o nanopng nanopng.cpp && ./nanopng /tmp/foo.png
#include <cstdio>
// write an uncompressed PNG file from a uint8 RGB buffer
struct Png {
FILE*f; unsigned int tab[256], crc; ~Png() { fclose(f); }
Png(const char* fn, int w, int h, const unsigned char* c) {
crc=0x575e51f5;unsigned char d[]={137,80,78,71,13,
10,26,10,0,0,0,13,73,72,68,82,73,68,65,84,120,1,0,
0,0,73,69,78,68,174,66,96,130};/*chunk headers*/
@linuxenko
linuxenko / web-servers.md
Created Nov 1, 2016 — forked from neilhwatson/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@linuxenko
linuxenko / README.md
Created Oct 31, 2016 — forked from joyrexus/README.md
curl tutorial
View README.md

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

View app.js
const net = require('net');
const exec = require('child_process').exec;
const os = require('os');
function run(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (err, stdout) => {
if (err) {
return reject(err);
}
@linuxenko
linuxenko / easing.js
Created Sep 21, 2016 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
View easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity