Skip to content

Instantly share code, notes, and snippets.

View sent-hil's full-sized avatar

Senthil Arivudainambi sent-hil

View GitHub Profile
@sent-hil
sent-hil / gist:3834447
Created October 4, 2012 15:34
HS: +3 Monad and Gonads

Monads

Monads are a way to chain functions together. Maybe monad (from Haskell) is used to chain functions together when the functions might fail. It assumes:

  1. If I have Nothing, stop computing.
  2. If I have Something, pass it to next function.
  3. That function may return Something or Nothing. Go back to Step 1.
x ||= y # x = y unless x
@sent-hil
sent-hil / gist:3828580
Created October 3, 2012 17:51
HS: +2 Node Spagetti

Setup cron on mac

$ crontab -e

stop vim from saving tmp files temporarily for crontab :set backupskip=/tmp/*,/private/tmp/*

0 22 * * * bash -c 'source /Users/sent-hil/.rvm/scripts/rvm && /usr/bin/env ruby /Users/sent-hil/Documents/play/single/twitter_status.rb'
@sent-hil
sent-hil / gist:3821532
Created October 2, 2012 17:42
HS: +1 Node noodles
@sent-hil
sent-hil / gist:3775255
Created September 24, 2012 10:02
Pick me up
"If we did the things we are capable of doing, we would literally astound ourselves." Edison
"When the student is ready, the teacher appears." Buddhist proverb
"Too busy to care."
Berklee College of Music keynote by Sivers: https://sivers.org/berklee6
The Mystery Box by JJ Abrams: http://www.ted.com/talks/j_j_abrams_mystery_box.html
@sent-hil
sent-hil / gist:3752697
Created September 19, 2012 22:16
Companies I want to work for:

WARNING: this is a draft and the list is by no means complete.

Methodology:

  1. Meaningful product:
  2. Do I use it?
  3. Does it solve a real and interesting problem?
  4. Is it important to the well being of others?
  5. Are they small?
  6. Tech stack - Preferably Rails + MongoDb with a hint of Javascript/Coffeescript. As long as it's not Java.
  7. Company culture
@sent-hil
sent-hil / gist:3735640
Created September 17, 2012 05:00
Plan for HackerSchool Fall 2012
GOAL: Become a much, much better programmer:
Get better at Ruby and OOP in general,
Open black boxes and see what goes on underneath.
TIME: Oct 22 - Dec 20.
IDEAS (all open sourced):
* Learn how interpreters work.
Status: Finished Scheme interpreter in Ruby. Rewrite in Go?
@sent-hil
sent-hil / gist:3550075
Created August 31, 2012 08:03
Create Phonegap 2.0 app from commandline
# ios
cd /Users/sent-hil/Documents/play/phonegap/sdks/lib/ios
./bin/create ../../../ios com.{name} {name}
cd ../../../ios
# android (doesn't work, use http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android instead)
cd /Users/sent-hil/Documents/play/phonegap/sdks/lib/android
./bin/create ../../../ios com.{name} {name}
@sent-hil
sent-hil / gist:3423695
Created August 22, 2012 08:09
River (getriver.com): Gemfile and Bundler best practices.

This is my current Gemfile for River.

source 'http://rubygems.org'

gem 'god' # monitoring of Goliath & Sinatra apps

group :default do
  gem 'yajl-ruby', :require => 'yajl' # fast JSON dumping/parsing
end
@sent-hil
sent-hil / goliath.markdown
Created August 21, 2012 21:58
River (getriver.com): HaProxy rules that matches based on api versions, http verbs and paths.
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
sent-hil / gist:3418572
Created August 21, 2012 19:32
River (getriver.com): Install Ruby, MongoDb on clean Ubuntu server.

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/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'