I wrote this up here: http://blog.steveklabnik.com/posts/2012-02-27-hypermedia-api-reading-list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warden::Manager.serialize_into_session{|user| user.id } | |
Warden::Manager.serialize_from_session{|id| User.get(id) } | |
Warden::Manager.before_failure do |env,opts| | |
# Sinatra is very sensitive to the request method | |
# since authentication could fail on any type of method, we need | |
# to set it for the failure app so it is routed to the correct block | |
env['REQUEST_METHOD'] = "POST" | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JS Module Pattern: | |
// http://j.mp/module-pattern | |
// Redefine: $, window, document, undefined. | |
var APP = (function($, window, document, undefined) { | |
// Automatically calls all functions in APP.init | |
$(document).ready(function() { | |
APP.go(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jeremy | |
Absolutely brilliant | |
both technically | |
and oratorically | |
He wrote CoffeeScript | |
1st place 5k | |
21 min, 3 seconds | |
<7min mile | |
Big picture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
require "#{Rails.root}/app/models/user" | |
describe User do | |
it "does something sweet" | |
it "does something cool" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Testable Abstractions in Rails | |
============================= | |
In Java or C#, it is common to build abstractions around external | |
dependencies like Logging or Caching libraries. | |
The advantages of such abstractions are twofold: | |
1) They can allow the caller to hide the methods/usage patterns that aren't | |
relevant to their application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a short collection of tools that are useful for managing your | |
# known_hosts file. In this case, I'm using the '-f' flag to specify the | |
# global known_hosts file because I'll be adding many deploy users on this | |
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts | |
# Add entry for host | |
ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts | |
# Scan known hosts | |
ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Lean Architecture example in Ruby - with ContextAccessor | |
# This example keeps interaction state in a "current context", represented | |
# by a ContextAccessor module. This can be mixed in to any class that needs | |
# access to the current context. It is implemented as a thread-local variable. | |
module ContextAccessor | |
def context | |
Thread.current[:context] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Lean Architecture example in Ruby - without ContextAccessor | |
# In this example, the context passes the needed roles into each method it | |
# invokes, and so the roles have no reference back to the context. | |
# Model class with no external dependenices. Includes a simple find method | |
# to create and store instances given an id - for illustration purposes only. | |
class Account | |
attr_reader :account_id, :balance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'integration_helper' | |
require 'rack' | |
require 'rack/handler/webrick' | |
describe HttpClient do | |
before :all do | |
@server = WEBrick::HTTPServer.new( | |
:Port => 9293, | |
:Logger => Rails.logger, | |
:AccessLog => Rails.logger |
OlderNewer