Skip to content

Instantly share code, notes, and snippets.

View BoyCook's full-sized avatar

Craig Cook BoyCook

View GitHub Profile
@BoyCook
BoyCook / blog.js
Last active December 12, 2015 01:39
TiddlyWiki5 server side modules
/*\
title: $:/core/modules/blog.js
type: application/javascript
module-type: server-off
WordPress blog module
\*/
(function(){
@BoyCook
BoyCook / npm_tips.sh
Created January 23, 2013 15:17
NPM tips
# Install package to local repo
sudo npm install . -g
# Delete package from local repo
sudo rm -r /usr/local/lib/node_modules/{module}
# Install package from local repo
npm install /usr/local/lib/node_modules/{module}
@BoyCook
BoyCook / node_makefile
Last active December 11, 2015 13:18
Makefile for Node.js projects
TESTS = test/spec
REPORTER = spec
XML_FILE = reports/TEST-all.xml
HTML_FILE = reports/coverage.html
test: test-mocha
test-ci:
$(MAKE) test-mocha REPORTER=xUnit > $(XML_FILE)
@BoyCook
BoyCook / express_server.js
Last active December 11, 2015 10:29
Node.js express server.js defaults
/*
Server app
*/
var express = require('express');
var app = express();
var port = 3000;
app.configure(function () {
console.log('Doing [default] configure');
app.use(express.static(__dirname + '/public'));
@BoyCook
BoyCook / node_session_redis.js
Created November 18, 2012 22:55
Node.js configuration for session with redis
var RedisStore = require('connect-redis')(express);
app.use(express.cookieParser('appsecret'));
app.use(express.bodyParser());
app.use(express.session({ secret:'appsecret', store:new RedisStore, cookie:{ maxAge:60000, expires: false } }));
app.use(express.cookieSession());
app.use(app.router);