Skip to content

Instantly share code, notes, and snippets.

View addisonj's full-sized avatar

Addison Higham addisonj

View GitHub Profile
@addisonj
addisonj / -
Created February 27, 2015 20:32
diff --git a/lib/uniform_notifier.rb b/lib/uniform_notifier.rb
index f362948..41e4022 100644
--- a/lib/uniform_notifier.rb
+++ b/lib/uniform_notifier.rb
@@ -42,5 +42,13 @@ module UniformNotifier
def raise=(exception_class)
UniformNotifier::Raise.setup_connection(exception_class)
end
+
+ def add_notifier(logger)
var gulp = require('gulp')
var source = require('vinyl-source-stream')
var gutil = require('gulp-util')
var stylus = require('gulp-stylus')
var imagemin = require('gulp-imagemin')
var del = require('del')
var nib = require('nib')
var nodemon = require('gulp-nodemon')
var browserify = require('browserify')
var watchify = require('watchify')
@addisonj
addisonj / gist:993686
Created May 26, 2011 18:13
connect-form issues
app.get('/upload', checkAuth, function(req, res) {
res.render('upload');
});
app.post('/upload', checkAuth, function(req, res) {
console.log('Got Here');
req.form.complete(function(err, fields, files) {
if (err) {
throw new Error('Upload failed');
@addisonj
addisonj / app.js
Created May 26, 2011 20:48
connect-form middleware
app.get('/upload', checkAuth, function(req, res) {
res.render('upload');
});
//Doesn't work (times out) if checkAuth is used as middleware, works fine without check auth
app.post('/upload', checkAuth, function(req, res, next) {
req.form.complete(function(err, fields, files){
if (err) {
next(err);
} else {
App.Draw.findNode = function(e) {
var mousePos = new THREE.Vector3(0, 0, 1),
r,
matrix;
mousePos.x = (e.clientX / window.innerWidth) * 2 - 1;
mousePos.y = (e.clientY / window.innerHeight) * 2 + 1;
mousePos.z = 1;
r = new THREE.Ray();
@addisonj
addisonj / test_bench.js
Created August 3, 2011 22:32
Just a little benchmark... but its not working
var http = require('http'),
CONFIG = require('./config'),
Client = require('mysql').Client,
fs = require('fs'),
client = new Client(CONFIG),
TEST_DB = 'node_test',
TEST_TABLE = 'test',
count = 0;
client.connect();
@addisonj
addisonj / gist:1163207
Created August 22, 2011 19:00
example of nested return from db
app.get('/jobs/:id', checkAuth, function(req, res, next) {
Job.findOne({ _id: req.params.id, user_id: req.session.user._id }, function(err, j) {
if (!j) return(new NotFound());
res.render('jobs/show', {
locals: {
j: j,
user: req.session.user
}
});
@addisonj
addisonj / finalRoute.js
Created December 21, 2011 20:57
normalize a response
// with normalizing middleware
app.use(normalizeResponse)
app.get('/account', common, UserRead)
function UserRead(req, res, next) {
// do stuff and attach it onto the res object
// call next() when done
next()
@addisonj
addisonj / failApp.js
Created February 28, 2012 16:55
an app that fails
// this app is full of fail
var express = require("express")
exports.createServer = function() {
var app = express.createServer()
app.get('/', function(req, res) {
process.exit(1) // obviously not going to get past this
@addisonj
addisonj / ServiceProxy.coffee
Created May 22, 2012 15:38
a small wrapper for request that does fancy things
request = require 'request'
_ = require 'underscore'
transformUrl = (host, url) ->
return host + url
onError = (err, req, res) ->
res.send "an error occurred", 500
makeDefaults = (options) ->