Skip to content

Instantly share code, notes, and snippets.

View hone's full-sized avatar

Terence Lee hone

View GitHub Profile
>> [1,2,3].shuffle
=> [3, 1, 2]
require 'net/http'
require 'uri'
require 'json'
new_file_lines = []
File.open('.gems') do |file|
file.each_line do |line|
gem_name = line.split.first
version = JSON.parse(Net::HTTP.get(URI.parse("http://gemcutter.org/gems/#{gem_name}.json")))["version"]
@hone
hone / .vimrc
Created December 2, 2009 20:22
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
set nocp " for omnicppcomplete plugin
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set laststatus=2
set statusline=%<%f\ %h%m%r%=%-20.(%)\%h%m%r%=%-40(%n%Y%)\%P
set nocul " cursor line
set cf " Enable error files & error jumping
# detach on hangup
autodetach on
# # don't display the copyright page
startup_message off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
# terminfo and termcap for nice 256 color terminal
# or some way to figure out the app name
desc "Run worker for an hour then tear down"
task :run_worker do
require 'heroku'
appname = ENV['NEW_RELIC_APPNAME']
time = 60 * 60 # hour
heroku_client = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASSWORD'])
heroku_client.set_workers(appname, '+1')
sleep(time)
hone@hone-x200:~/Projects/oib/rails_bundler$ ruby script/console
Loading development environment (Rails 2.3.5)
>> Hash['foo', 'foo']
=> {"foo"=>nil}
>> exit
hone@hone-x200:~/Projects/oib/rails_bundler$ gem bundle
Calculating dependencies...
Updating source: http://gems.github.com
Updating source: http://gems.rubyforge.org
Installing xml-simple (1.0.12)
url += ":#{uri['port']}" if uri['port']
class Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
Rails::Initializer.class_eval do
old_load = instance_method(:load_environment)
def commit_path(build)
path = ""
if /github.com/.match(build.project.uri.to_s)
git_uri = build.project.uri.to_s.sub(/git(@|:\/\/)github.com[:\/]/, '').split('/')
project_name = git_uri.last.split('.').first
github_username = git_uri.first
path = "https://github.com/#{github_username}/#{project_name}/commit/#{build.commit.identifier}"
end
path
"So you see this especially in the appliance market where Microsoft will go to a company — off the record as this is never ever done in public — and say 'this product you have there, shame if someone brought a patent suit. So you have two options you can re-architect — here is Windows — or the other thing is why don't you give us a cut on all the free software you are using?'. It is an attempt to create the work that we do, into a Microsoft revenue stream. I don't know about you but that really pisses me off."