Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
[flockfeed] $ npm bundle ./vendor
npm info it worked if it ends with ok
npm info version 0.1.27-9
npm info bundle [ './vendor' ]
npm info fetch http://registry.npmjs.org/express/-/express-1.0.0rc2.tgz
npm info fetch http://registry.npmjs.org/ejs/-/ejs-0.2.0.tgz
npm info fetch http://registry.npmjs.org/oauth/-/oauth-0.8.1.tgz
npm info install ejs@0.2.0
npm info install oauth@0.8.1
npm info install express@1.0.0rc2
npm info it worked if it ends with ok
npm verb cli [ 'bundle', 'vendor', '--loglevel', 'verbose' ]
npm info version 0.1.27-9
npm verb config file /Users/mbleigh/.npmrc
npm verb config file /usr/local/Cellar/node/0.2.0/etc/npmrc
npm info bundle [ 'vendor' ]
npm verb caching package.json
npm verb packTar . /Users/mbleigh/.node_libraries/.npm/.cache/flockfeed/v0.0.1alpha/package.tgz
npm verb success gzip "--stdout"
npm verb success tar "cv" "--exclude" ".git" "-X" "/Users/mbleigh/.node_libraries/.npm/npm/0.1.27-9/package/lib/utils/default.npmignore" "flockfeed"
require.paths.unshift './vendor'
Twitter = require './twitter'
# ...
app.get '/sign_in', (req, res)->
Twitter.consumer.getOAuthRequestToken (error, token, secret, url, params)->
# save it to the session
// Change the _open function in mongoose's connection.js to this
// and you'll be able to connect to MongoHQ URLS!
_open: function(options){
var self = this;
this.db = new mongo.Db(this.name, new mongo.Server(this.uri.hostname, this.uri.port, options));
if (this.uri.auth) {
var auth = this.uri.auth.split(':');
this.db.open(function(err) {
app.error (err,req,res,next)->
if process.env.RACK_ENV == 'production'
hoptoad.key = 'hoptoadkey'
hoptoad.notify(err)
res.render 'error.ejs', 500
events:12
throw arguments[1];
^
Error: Parse Error
at Client.ondata (http:882:22)
at IOWatcher.callback (net:494:29)
at node.js:764:9
@mbleigh
mbleigh / jquery.navigable.js
Created November 18, 2010 17:46
A jQuery plugin for keyboard navigation.
(function() {
(function($) {
return ($.fn.navigable = function(options) {
var container, current, first, navigateTo, next, prev;
options = $.extend({
tag: 'li',
focusClass: 'focused',
scroll: true,
keyNext: 74,
keyPrev: 75,
@mbleigh
mbleigh / mongomapper_openid_store.rb
Created December 3, 2010 09:29
An OpenID store that works using MongoMapper. Useful for Heroku Mongo apps!
# Thanks to http://github.com/collectiveidea/open_id_authentication for
# 99% of this code, I just collapsed it into one file and made small
# changes to work with newer versions of MongoMapper.
require 'openid/store/interface'
module OpenID
module Store
class Mongo < OpenID::Store::Interface
class Association
@mbleigh
mbleigh / generate_markets.rb
Created April 5, 2011 03:55
The model and generation code to pull the 100 biggest US cities out as geographical models for a Rails app.
# Data culled from Wikipedia. Could be cleaner, but this is nice and simple.
major_cities = [["New York", "New York"], ["Los Angeles", "California"], ["Chicago", "Illinois"], ["Houston", "Texas"], ["Philadelphia", "Pennsylvania"], ["Phoenix", "Arizona"], ["San Antonio", "Texas"], ["San Diego", "California"], ["Dallas", "Texas"], ["San Jose", "California"], ["Jacksonville", "Florida"], ["Indianapolis", "Indiana"], ["San Francisco", "California"], ["Austin", "Texas"], ["Columbus", "Ohio"], ["Fort Worth", "Texas"], ["Charlotte", "North Carolina"], ["Detroit", "Michigan"], ["El Paso", "Texas"], ["Memphis", "Tennessee"], ["Baltimore", "Maryland"], ["Boston", "Massachusetts"], ["Seattle", "Washington"], ["Washington", "District of Columbia"], ["Nashville", "Tennessee"], ["Denver", "Colorado"], ["Louisville", "Kentucky"], ["Milwaukee", "Wisconsin"], ["Portland", "Oregon"], ["Las Vegas", "Nevada"], ["Oklahoma City", "Oklahoma"], ["Albuquerque", "New Mexico"], ["Tucson", "Arizona"], ["Fresno", "California"], ["Sacrame
GameRouter = new Backbone.Router.extend
routes:
"start": "start"
"draw": "draw"
start: ->
this.navigate('/draw')
draw: ->
$('#sketchpad .front > div').hide()
$('#draw').show()