Skip to content

Instantly share code, notes, and snippets.

@ericsaboia
ericsaboia / reactivate-jobtype.js
Created September 11, 2014 15:49
Reactivate kue jobs passing a type
var kue = require('kue');
var jobs = kue.createQueue();
console.log('Restarting job ' + process.argv[2]);
jobs.state(process.argv[2], function (err, ids) {
ids.forEach(reactivate);
});
function reactivate (id) {
anonymous
anonymous / gist:9924932
Created April 1, 2014 23:08
%% Read image and convert to grayscale
img = imread('pic.jpg');
img = rgb2gray(img);
%% Define grayscale representations of 0-255
chars = fliplr([' ', '.', ',', ':', '-', '=', '+', '*', '#', '%', '@']);
step = 256 / 11;
%% Cut image so its size is 8*w times 13*h
imgSize = size(img);
@bolshchikov
bolshchikov / gist:8069009
Last active January 1, 2016 00:49
Creating read-only JS object
// lo-dash lib is the dependency
function readOnly(target){
var _readOnly = function (target, acc) {
// acc is passed into the function to be used for observer
var _defineProperty = function (propName, target, acc) {
var i, len;
// operation to be performed when add occurred
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active October 26, 2024 07:45
A badass list of frontend development resources I collected over time.
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#