Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@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 / 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,
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
app.error (err,req,res,next)->
if process.env.RACK_ENV == 'production'
hoptoad.key = 'hoptoadkey'
hoptoad.notify(err)
res.render 'error.ejs', 500
// 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) {
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
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"
[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
// generated by npm, please don't touch!
var i = require.paths.indexOf(__dirname)
if (i && i + 1) require.paths.splice(i, 1)
if (i) require.paths.shift(__dirname)
exports["express"] = require('./'+"express")
,exports["oauth"] = require('./'+"oauth")
,exports["ejs"] = require('./'+"ejs")
Feature: 3.5.2.1 - Client Requests Authorization
In order for the end user to grant the client access, the client
sends the end user to the authorization server.
Background:
Given a registered client "desktop" with id "abc" and secret "def"
And a user named "bob" with password "example"
And a request path of "/oauth/authorize"
And a "type" parameter of "web_server"
And a "client_id" parameter of "abc"