frontend http
bind *:8000
# match http verbs
acl is_post method POST
# match api versions
acl one hdr(Accept) -i application/v0.1
acl two hdr(Accept) -i application/v0.2
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
# Problem: Divide api into version to provide a consistent experience to developers. | |
require 'goliath' | |
require 'active_support/all' | |
module V01 | |
class Hello | |
def self.call(env) | |
[200, {}, {'response' => 'V01'}] | |
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
# Rearrangement of Rails folder structure based on Robert Martins' Keynote: Architecture the Lost Years. | |
# This structure was meant to say 'I am a web app that does x and y and only incidentally uses Rails'. | |
# I'm interested in knowing if: | |
# 1. Is this viable in the long run? | |
# 2. Can you tell what the app does? | |
|── Gemfile | |
├── Gemfile.lock | |
├── Readme |
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
module Iteration | |
def map | |
each[0] | |
end | |
def to_a | |
each.split("") | |
end | |
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
module BackwardIteration | |
def self.included(base) | |
if base.ancestors.include?(ForwardIteration) | |
instance_methods.each do |method| | |
base.class_eval do | |
alias_method "#{method}_reverse", method | |
define_method method do | |
unbound = ForwardIteration.instance_method(method) | |
unbound.bind(self).call |
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
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
require 'active_support/inflector' | |
module OpenAuth2 | |
module Provider | |
class Base | |
attr_accessor :client_id | |
def initialize |
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
We all have the drum major instinct. We all want to be important, to surpass others, to | |
achieve distinction, to lead the parade…. And the great issue of life is to harness the drum | |
major instinct. It is a good instinct if you don’t distort it and pervert it. | |
Don’t give it up. Keep feeling the need for being important. Keep feeling the need for | |
being first. But I want you to be the first in love. I want you to be the first in moral | |
excellence. I want you to be the first in generosity. |
NewerOlder