Skip to content

Instantly share code, notes, and snippets.


Senthil Arivudainambi sent-hil

View GitHub Profile
View gist:882659
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.
View open_auth2.rb
require 'active_support/inflector'
module OpenAuth2
module Provider
class Base
attr_accessor :client_id
def initialize
View iteration.rb
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)
View method_missing_iteration.rb
module Iteration
def map
def to_a
sent-hil / webapp_folder_structure
Created March 21, 2012 12:18
Rearrangement of Rails folder structure based on 'Architecture the Lost Years'
View webapp_folder_structure
# 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
View api_versions.rb
# Problem: Divide api into version to provide a consistent experience to developers.
require 'goliath'
require 'active_support/all'
module V01
class Hello
[200, {}, {'response' => 'V01'}]
sent-hil / gist:3418572
Created August 21, 2012 19:32
River ( Install Ruby, MongoDb on clean Ubuntu server.
View gist:3418572

Ideally this process should be automated via Puppet/Chef, I just haven't gotten around to it.

Upload local SSH keys to server for password less login

Create ssh dir on server

mkdir .ssh

Upload local key from laptop

local> cat .ssh/ | ssh b@B 'cat >> .ssh/authorized_keys'

sent-hil / goliath.markdown
Created August 21, 2012 21:58
River ( HaProxy rules that matches based on api versions, http verbs and paths.
View goliath.markdown
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
sent-hil / gist:3423695
Created August 22, 2012 08:09
River ( Gemfile and Bundler best practices.
View gist:3423695

This is my current Gemfile for River.

source ''

gem 'god' # monitoring of Goliath & Sinatra apps

group :default do
  gem 'yajl-ruby', :require => 'yajl' # fast JSON dumping/parsing
sent-hil / pictures.markdown
Created August 24, 2012 02:18
River ( Keep a programming journal.
View pictures.markdown

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature