Skip to content

Instantly share code, notes, and snippets.

@hchoroomi
hchoroomi / hi.rb
Created July 22, 2008 00:21 — forked from anonymous/hi.rb
puts "error" if __FILE__ = $0
require 'rubygems'
require 'atom' # sudo gem install atom
require 'net/http'
require 'uri'
feed_url = 'http://search.twitter.com/search.atom?q=meh'
begin
feed = Atom::Feed.new(Net::HTTP::get(URI::parse(feed_url)))
feed.entries.each do |entry|
@hchoroomi
hchoroomi / meh.rb
Created November 3, 2008 20:04 — forked from seaofclouds/README
require "rubygems"
require "sinatra"
require 'atom' #sudo gem install ratom
require 'net/http'
require 'uri'
not_found do
headers["Status"] = "301 Moved Permanently"
redirect("/")
end
# git
alias gst="git status"
alias ga="git add ."
alias gb="git branch"
alias gba="git branch -a"
alias gl="git pull"
alias gh="git push"
alias gd="git diff"
alias gdm="git diff | mate"
alias gc="git commit -v"
" rdoc.vim
command! -nargs=0 RDocPreview call RDocRenderBufferToPreview()
noremap <buffer> <LocalLeader>rd :RDocPreview<CR>
function! RDocRenderBufferToPreview()
if (system('which rdoc') == "rdoc not found\n")
throw "Could not find rdoc!"
end
class String
def translate
I18n.t self, :default => self
end
def t
translate
end
class TestGist
# test
end
@hchoroomi
hchoroomi / http-proxy-server.rb
Created February 3, 2009 15:31 — forked from jamis/http-proxy-server.rb
HTTP proxy server
# This is a trivial HTTP proxy server, intended for use as a troubleshooting tool
# ONLY (not for real, actual, production use). I wrote this because I couldn't find
# a simple HTTP proxy that I could use to test HTTP proxy support in Net::SSH.
#
# This code is in the public domain, so do with it what you will!
require 'socket'
server = TCPServer.new('127.0.0.1', 8080)
client = server.accept
# haml + liquid example
#
# James MacAulay 2009
require 'rubygems'
require 'liquid'
require 'haml'
template = <<EOF
require File.dirname(__FILE__) + '/../spec_helper'
describe CategoriesController, "GET #index" do
subject { controller }
before(:each) { get :index }
it { should assign_to(:categories) }
it { should respond_with(:success) }
end