Skip to content

Instantly share code, notes, and snippets.

View linuxenko's full-sized avatar

Svetlana Linuxenko linuxenko

View GitHub Profile
var DEFAULT_MAX_LISTENERS = 12
function error(message, ...args){
console.error.apply(console, [message].concat(args))
console.trace()
}
class EventEmitter {
constructor(){
this._maxListeners = DEFAULT_MAX_LISTENERS

Request frame js

// ------------------------------------
// Assorted JavaScript utility functions

function isDef(v) 			{ return v !== undefined; }
function isNull(v) 			{ return v === null; }
function isDefAndNotNull(v) { return vl != null; }
function jenkinsHash(str) {
    for (var hash = 0, i = 0, len = str.length; i < len; ++i) {
        hash += (str.charCodeAt(i) >>> 0);
        hash = hash >>> 0
        hash += ((hash << 10) >>> 0);
        hash = hash >>> 0
        hash ^= ((hash >>> 6) >>> 0);
        hash = hash >>> 0
 }
function (r, g, b) {
var avg = 0.3 * r + 0.59 * g + 0.11 * b;
return [avg + 100, avg + 50, avg, 255];
}
@linuxenko
linuxenko / index.js
Created February 19, 2016 13:40 — forked from bnerd/index.js
Serve large files with Node.js
var libpath = require('path');
var http = require('http');
var fs = require('fs');
var url = require('url');
var bind_port = 8001;
var path = "/path/to/your/base_directory/";
http.createServer(function (request, response) {
var uri = url.parse(request.url).pathname;
var filename = libpath.join(path, uri);
@linuxenko
linuxenko / webpack-babel-es6.md
Last active February 25, 2016 10:18
ES6-Babel-webpack

webpack-config.js

/* global __dirname */

var path = require('path');

var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
[submodule "eslint"]
path = eslint
url = https://github.com/eslint/eslint
var color = {r: 186, g: 218, b: 85};
// RGB to HEX
var rgb2hex = function(r, g, b) {
return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).substr(1);
}
@linuxenko
linuxenko / index.html
Created March 25, 2016 18:20
uSpritEd demo
<a href="https://github.com/linuxenko/usprited" target="_blank">
<img style="position: absolute; z-index:100; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>

GIXIE Demo

HTML5 canvas based GitHub identicons like pixel/avatar images generator library. Available as jquery plugin, es6 library or directly call it with vanillaJS.

A Pen by Svetlana Linuxenko on CodePen.

License.