Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hrp's full-sized avatar

Hiten Parmar hrp

View GitHub Profile
@hrp
hrp / link_to.rb
Created January 15, 2010 08:19 — forked from emk/link_to.rb
@hrp
hrp / gist:278023
Created January 15, 2010 12:41 — forked from giom/gist:58005
module Sass::Script
module Functions
# substitue text in a string
# @params
# str the string to substitute text from
# reg the regexp given to sub
# rep the replacement text
def sub(str, reg, rep = '')
Sass::Script::String.new(str.to_s.sub(/#{reg.to_s}/, rep.to_s))
end
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
# PATH=$PATH:$HOME/ruby/trunk/bin
@hrp
hrp / .vimrc
Created January 16, 2010 00:36
set nocompatible
filetype plugin on
set expandtab
set sts=2
set shiftwidth=2
set autoindent
set scrolljump=5
set scrolloff=3
colors torte
let g:EnhCommentifyRespectIndent = 'Yes'
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
Hello
@hrp
hrp / happy.rb
Created April 30, 2010 15:49
Extract happy hour information from SF Weekly
#!/usr/bin/ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
url = 'http://www.sfweekly.com/content/printVersion/1956736'
doc = Hpricot open url
@hrp
hrp / happy.rb
Created April 30, 2010 16:20
SF Weekly Happy Hours on a Map
#!/usr/bin/ruby
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'geokit'
url = 'http://www.sfweekly.com/content/printVersion/1956736'
doc = Hpricot open url
@hrp
hrp / happy.kml
Created April 30, 2010 16:38
SF Weekly Happy Hours KML
<?xml version="1.0"?>
<test>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<Placemark>
<name>Blue Fin Sushi</name>
<Point>
<coordinates>-122.478712,37.782421</coordinates>
</Point>
</Placemark>
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/astashov/vim-ruby-debugger.git",
"git://github.com/msanders/snipmate.vim.git",
"git://github.com/scrooloose/nerdtree.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
"git://github.com/tpope/vim-git.git",