Skip to content

Instantly share code, notes, and snippets.

@codeincontext
codeincontext / gist:4731825
Last active December 12, 2015 06:49
SEGFAULT 11
var Canvas = require('canvas')
, Image = Canvas.Image
, canvas = new Canvas(400, 400)
, ctx = canvas.getContext('2d')
, fs = require('fs')
var sprite
var hairSprite
Reading symbols for shared libraries ++++......................................................................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .warning: Could not find object file "/Users/skattyadz/Dropbox/code/node-canvas/pixman-0.28.0/pixman/.libs/pixman.o" - no debug information available for "pixman.c".
warning: Could not find object file "/Users/skattyadz/Dropbox/code/node-canvas/pixman-0.28.0/pixman/.libs/pixman-access.o" - no debug information available for "pixman-access.c".
warning: Could not find object file "/Users/skattyadz/Dropbox/code/node-canvas/pixman-0.28.0/pixman/.libs/pixman-access-accessors.o" - no debug information available for "pixman-access-accessors.c".
warning: Could not find object file "/Users/skattyadz/Dropbox/code/node-canvas/pixman-0.28.0/pixman/.libs/pixman-bits-image.o" - no debug information available for "pixman-bits-image.c".
@codeincontext
codeincontext / gist:4479523
Last active December 10, 2015 19:08
Simple counter node server (cache testing)
var http = require('http');
var number = 0;
http.createServer(function (req, res) {
if (req.url == '/') number++;
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end(number.toString());
}).listen(3000);
@codeincontext
codeincontext / gist:4286762
Created December 14, 2012 16:37
Make terminal text purple when ssh'ed into a server
# in remote ~/.bashrc
if [ -n "$SSH_CLIENT" ]; then text=" ssh"
fi
export PS1='\[\e[0;35m\]\u@\h:\w${text}$\[\e[m\] '
# - Colour codes -
# Black 0;30
@codeincontext
codeincontext / gist:4286311
Created December 14, 2012 15:36
ssh into the same directory on the server as your local working directory. If you're in /Users/skattyadz/Dropbox/code/instawall, it will ssh in and "cd instawall"
# add to ~/.bash_profile
function sshh() {
local PROJECTNAME=${PWD##*/}
local HOST=$1
eval "ssh -t ${HOST} \"cd ${PROJECTNAME}; bash\""
}
ripped from http://meyerweb.com/eric/tools/dencoder/
This tool is provided without warranty, guarantee, or much in the way of explanation. Note that use of this tool may or may not crash your browser, lock up your machine, erase your hard drive, or e-mail those naughty pictures you hid in the Utilities folder to your mother. Don't blame me if anything bad happens to you, because it's actually the aliens' fault. The code expressed herein is solely that of the author, and he's none too swift with the JavaScript, if you know what we mean, so it's likely to cause giggle fits in anyone who knows what they're doing. Not a flying toy. Thank you for playing. Insert coin to continue.
@codeincontext
codeincontext / gist:3862543
Created October 10, 2012 01:11
Photo capture, manipulation, and upload in iOS6 Safari
<!DOCTYPE html>
<html>
<head>
<title>iOS6 Safari Photo Capture Demo</title>
<script type="text/javascript">
window.onload = function() {
var input = document.getElementById("input");
input.addEventListener("change", handleFile);
}
@codeincontext
codeincontext / gist:3852976
Created October 8, 2012 14:59
Generate a thumbnail with imagemagick, maintining aspect ratio and cropping as needed
convert 1.jpg -scale '225x225^' -gravity center -extent 225x225 1-square.jpg
@codeincontext
codeincontext / gist:3707167
Created September 12, 2012 14:53
Facebook and Twitter login with Sinatra
require 'rubygems'
require 'sinatra'
require 'json'
require 'omniauth'
require 'omniauth-facebook'
require 'omniauth-twitter'
class SinatraApp < Sinatra::Base
configure do
set :sessions, true
@codeincontext
codeincontext / gist:3694924
Created September 10, 2012 23:59
because meh. Let's not block the ui for too long in one go
var i = 0;
var addPhotoInterval = setInterval(function() {
instawall.renderImage(data.data[i++]);
if (i == data.data.length) clearInterval(addPhotoInterval);
}, 10);