Skip to content

Instantly share code, notes, and snippets.

View davidbanham's full-sized avatar

David Banham davidbanham

View GitHub Profile
@davidbanham
davidbanham / gist:1407615
Created November 30, 2011 01:55
Jade info passing
res.render('couplesearch', {
title: "Honeymoon!",
couples: results
});
@davidbanham
davidbanham / gist:1407631
Created November 30, 2011 01:59
Set-Cookie header out of Express req
{"name":"Location","value":"https://3ahk.localtunnel.com/login#loginPage"},{"name":"Set-Cookie","value":"pinion.sid=9clqqOCzv2xjkvF0E6q9A0It.JWld7dqXBoCkUQboxVJ6Yu4Nb1HUJRZ7bdXNGVDe42g; path=/; expires=Mon, 28 Nov 2011 09:29:38 GMT; httpOnly"}],"cookies":[{"name":"pinion.sid","value":"9clqqOCzv2xjkvF0E6q9A0It.JWld7dqXBoCkUQboxVJ6Yu4Nb1HUJRZ7bdXNGVDe42g","path":"/","expires":"2011-11-28T09:29:38.000Z","httpOnly":true,"secure":false}
@davidbanham
davidbanham / gist:1421331
Created December 2, 2011 01:49
npm output time issue
npm install time
> time@0.6.5 preinstall /home/ubuntu/oim-cpanel/node_modules/time
> node-waf clean || true; node-waf configure build
sh: node-waf: not found
sh: node-waf: not found
npm ERR! error installing time@0.6.5 Error: time@0.6.5 preinstall: `node-waf clean || true; node-waf configure build`
npm ERR! error installing time@0.6.5 `sh "-c" "node-waf clean || true; node-waf configure build"` failed with 127
npm ERR! error installing time@0.6.5 at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20)
@davidbanham
davidbanham / gist:1654833
Created January 22, 2012 00:50
node v0.6.8 on MBP Lion with --debug flag
davidbanham@David-Banhams-MacBook-Pro:~/segnode/node-v0.6.8$ ./configure --debug
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : not found
@davidbanham
davidbanham / gist:1702828
Created January 30, 2012 05:59
VideoJS API ready call failing
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="http://vjs.zencdn.net/c/video.js"></script>
<script type="text/javascript">
@davidbanham
davidbanham / gist:1702844
Created January 30, 2012 06:03
Piece of VideoJS behaving strangely
// Adjust for jQuery ID syntax
if (id.indexOf("#") === 0) {
id = id.slice(1);
}
// If a player instance has already been created for this ID return it.
console.log(_V_.players); // Object that appears to have one property Class named example_video_1
console.log(id); // example_video_1
console.log(_V_.players[id]); // undefined
if (_V_.players[id]) {
@davidbanham
davidbanham / gist:1706479
Created January 30, 2012 20:29
VideoJS API ready call delayed with jQuery - Fails
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!-- video.js must be in the <head> for older IEs to work. -->
@davidbanham
davidbanham / gist:1706484
Created January 30, 2012 20:29
VideoJS API ready call delayed with javascript - Fails
<!DOCTYPE html>
<html>
<head>
<title>Video.js | HTML5 Video Player</title>
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet" type="text/css">
<!-- video.js must be in the <head> for older IEs to work. -->
<script src="video.js"></script>
@davidbanham
davidbanham / gist:1990381
Created March 7, 2012 01:50
Ansi fiddling
// Ignore the md5 stuff. It's a super naive implementation as a POC for a contest.
var a = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'x', 'y', 'z' ]
var crypto = require('crypto');
var ansi = require('ansi')
, cursor = ansi(process.stdout);
var key = 'asd97-896aj-sa82n';
@davidbanham
davidbanham / gist:2550648
Created April 29, 2012 14:12
Failing to download a file with request
var request = require('request');
var fs = require('fs');
var url = 'http://www.google.com/images/srpr/logo3w.png';
// for comparison, wget https://www.google.com/images/srpr/logo3w.png then diff logo3w.png nodeVersion.png
request({url: url}, function(error, response, body) {
if (error) callback(error);
else {
fs.writeFile('./nodeVersion.png', body, 'base64', function(err){
if(err) console.log(err);
else console.log('yay')