Skip to content

Instantly share code, notes, and snippets.

View cjpartridgeb's full-sized avatar

Chris Partridge cjpartridgeb

View GitHub Profile
@cjpartridgeb
cjpartridgeb / gist:5431818
Created April 22, 2013 01:09
for rpcesar
var RTII = function(req, res, next){
types.list(function(types_){
req.types = types_;
return next();
});
};
app.get('/some/handler/that/needs/types', RTII, function(req, res){
// req.types available here
});
@cjpartridgeb
cjpartridgeb / gist:5507358
Created May 3, 2013 05:28
for happyGilmorian
var http = require('http');
var sockjs = require('sockjs');
var node_static = require('node-static');
// 1. Echo sockjs server
var sockjs_opts = {sockjs_url: "http://cdn.sockjs.org/sockjs-0.3.min.js"};
var sockjs_echo = sockjs.createServer(sockjs_opts);
sockjs_echo.on('connection', function(conn) {
conn.on('data', function(message) {
{
"name": "wanderfoot",
"version": "0.0.1",
"contributors" : [
{
"name": "jarrod parkes",
"email": "[email protected]"
}
],
"description": "wanderfoot application",
{ "keys": ["ctrl+k", "ctrl+["], "command": "insert_gist_list" },
{ "keys": ["ctrl+k", "ctrl+]"], "command": "gist_add_file" }
{ "keys": ["ctrl+k", "ctrl+["], "command": "insert_gist_list" },
{ "keys": ["ctrl+k", "ctrl+]"], "command": "gist_add_file" }
@cjpartridgeb
cjpartridgeb / binding.gyp
Created June 4, 2013 00:23
building node-chimera on Ubuntu 12.04 Grab node-chimera master Grab phantomjs master Copy qt folder from phantomjs/src/qt to node-chimera/qt Run ./scripts/compile_openssl.sh Run ./scripts/compile_qt.sh Run ./scripts/compile_binary.sh Tested on two separate machines, both Ubuntu 12.04, on node 0.8.23 & node 0.10.9
{
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
function check(id) {
return function(article, callback) {
// scope with id
// and the article itself
};
}
exports.checkAll = function (d, callback) {
async.each(d.articles,
check(d.id),
@cjpartridgeb
cjpartridgeb / gist:5727139
Created June 7, 2013 04:53
curry car part stamper
var partStamper = function(id) {
return function(part) {
part.stamp(id);
}
};
var stamper1 = partStamper('car1');
car1.parts.forEach(stamper1);
var stamper2 = partStamper('car2');
@cjpartridgeb
cjpartridgeb / Vagrantfile
Created June 21, 2013 01:45
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.100.1"
config.vm.provision :shell, :path => "vagrant/bootstrap.sh"
end
@cjpartridgeb
cjpartridgeb / test.js
Created June 21, 2013 06:58
for yalamber
function export_connect_csv(user_id, res){
ConnectModel.mysqlPool.getConnection(function(err, connection){
res.header('Content-Type', 'text/csv');
var csv_header_row = "Email,First Name,Last Name,Status,Created\n";
res.write(csv_header_row);
var query = connection.query('SELECT * FROM connects where user_id = ? AND deleted = 0', [user_id]);
query
.on('error', function(err) {