Skip to content

Instantly share code, notes, and snippets.

View hkarthik's full-sized avatar

Karthik Hariharan hkarthik

  • Goodwater Capital
  • San Francisco, CA
  • X @hkarthik
View GitHub Profile
@hkarthik
hkarthik / gist:2699002
Created May 15, 2012 03:53
Codility Demo test in Java
class Solution {
public int equi ( int[] A ) {
int result = -1;
for(int i = 0; i < A.length; i++) {
if (lowerBound(A,i) == upperBound(A,i)) {
result = i;
break;
}
}
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.
@hkarthik
hkarthik / gist:1121201
Created August 2, 2011 20:55
SSH tunneling for localhost:3000 while pairing
ssh tmux@host -L 3000:localhost:3000
@hkarthik
hkarthik / gist:1111827
Created July 28, 2011 16:04
Pow link for a catchall app
cd ~/.pow
ln -s /path/to.app default
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar xzf ruby-1.9.2-p180.tar.gz
cd ruby-1.9.2-p180
./configure
make
make install
make install-doc
gem update --system
@hkarthik
hkarthik / fetch_pgbackups.rb
Created May 11, 2011 04:00 — forked from jwood/fetch_pgbackups.rb
Create a pgbackup on Heroku for a given project, and then download it for local storage
#!/usr/bin/ruby
#
# This script assumes that you have either 0 or 1 pgbackups stored
# on Heroku, and that you already have the heroku gem installed
# and configured on your system.
#
PROJECT_DIRECTORY = "/home/jwood/dev/myproj"
BACKUP_FILE = "/home/jwood/backup/myproj.dump"