- 6 - What happens if NPM goes down
- 8 - Running Node in production
- 5 - Show and Tell all the things
- 7 - Database Year (mongo, cassandra, redis, leveldb, couch, manta, datomic)
- 7 - Koa.js
- Teal - talk with the indie game dev group
Some test gist right here |
var OAuth = require('oauth').OAuth; | |
var baseURL = 'https://passport.vml.com'; | |
consumer = new OAuth( | |
baseURL + '/oauth/request_token', | |
baseURL + '/oauth/access_token', | |
'w9hJkqLgqRR9mPdrmxyh76qxMrnG3CeD', | |
'4TAfNxp2JCwCYz4Tn8hP8bwuHe7PWdjK', | |
'1.0', null, 'HMAC-SHA1' | |
); |
require 'oauth' | |
class User < ActiveRecord::Base | |
validates :email, :email => true | |
validates :name, :passport_id, :presence => true | |
before_validation :get_passport_data, :on => :create | |
def get_passport_data | |
@consumer = OAuth::Consumer.new ENV['PASSPORT_OAUTH_KEY'], |
require 'spec_helper' | |
describe User do | |
it 'should reach out to passport via oauth and populate user attributes' do | |
user = FactoryGirl.create( | |
:user, | |
:passport_id => 2322 | |
) | |
user.email.should eq '[email protected]' |
require 'oauth' | |
require 'json' | |
consumer = OAuth::Consumer.new ENV['PASSPORT_OAUTH_KEY'], | |
ENV['PASSPORT_OAUTH_SECRET'], | |
{ :site => 'https://passport.vml.com' } | |
request_token = consumer.get_request_token | |
access_token = request_token.get_access_token | |
response_body = JSON.parse(access_token.get("/api/user/jlongstreet/ui.json").body) |
var OAuth = require('oauth').OAuth; | |
var baseURL = 'https://passport.vml.com'; | |
consumer = new OAuth( | |
baseURL + '/oauth/request_token', | |
baseURL + '/oauth/access_token', | |
process.env.PASSPORT_OAUTH_KEY, | |
process.env.PASSPORT_OAUTH_SECRET, | |
'1.0', null, 'HMAC-SHA1' | |
); |
// Pasting from Microsoft word is an ABSOLUTE DISASTER | |
// this method removes the endless gobs of garbage produced | |
// by the world's worst, yet most popular, text editor | |
// Requires jQuery | |
var cleanHTML = function(pastedString){ | |
// If this looks like some kind of raunchy ass microsoft bull shit, | |
// rip off it's effing <HEAD></HEAD> | |
var headRegex = new RegExp("<head[\\d\\D]*?\/head>", "g"); | |
pastedString = pastedString.replace(headRegex, ''); |
var obj = [{"id":"user_1","name":"Matt Carter","gender":"male","age":"30"}, {"id":"user_2","name":"Erik Akers","gender":"male","age":"29"}] | |
var str = JSON.stringify(obj) | |
var parsed = JSON.parse(str) |
require.config({ | |
baseUrl : '/js/', | |
paths : { | |
'jquery' : '/vendor/jquery', | |
'underscore' : '/vendor/underscore', | |
'handlebars' : '/vendor/handlebars', | |
'hbs' : '/vendor/hbs', | |
'ejs' : '/vendor/ejs', | |
'backbone' : '/vendor/backbone', | |
'chaplin' : '/vendor/chaplin', |