Skip to content

Instantly share code, notes, and snippets.

Dallas Reedy dallas

Block or report user

Report or block dallas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
olvado / getAverageColourAsRGB.js
Created Jun 27, 2011
Get the average colour of an image in javascript using getImageData in CANVAS
View getAverageColourAsRGB.js
function getAverageColourAsRGB (img) {
var canvas = document.createElement('canvas'),
context = canvas.getContext && canvas.getContext('2d'),
rgb = {r:102,g:102,b:102}, // Set a base colour as a fallback for non-compliant browsers
pixelInterval = 5, // Rather than inspect every single pixel in the image inspect every 5th pixel
count = 0,
i = -4,
data, length;
// return the base colour for non-compliant browsers
You can’t perform that action at this time.