Skip to content

Instantly share code, notes, and snippets.

@matthewmccullough
matthewmccullough / gitignorechanges.sh
Created January 24, 2011 04:08
This script sets up aliases for ignoring changes to a version controlled file
# Using Git? Want to ignore changes to a noisy (e.g. tool-updated file), yet have to have it exist to satisfy said tool?
# Check it in once to source code control, then ignore all future changes. This option only applies to your local clone.
# Use this by typing 'git ignorechanges MYFILE'
git config --global alias.ignorechanges = update-index --assume-unchanged
# Use this by typing 'git noticechanges MYFILE'
git config --global alias.noticechanges = update-index --no-assume-unchanged
@mojombo
mojombo / vwilight.vim
Created January 26, 2011 03:23
vwilight.vim: A TRUE Twilight color theme for Vim
" Vim color file
" Converted from Textmate theme Twilight using Coloration v0.2.5 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@igrigorik
igrigorik / ruby-1.9-tips.rb
Created February 3, 2011 17:19
Ruby 1.9 features, tips & tricks you may not know about...
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@yuya-takeyama
yuya-takeyama / binarytree.rb
Created February 5, 2011 14:32
Binary Tree implemented in Ruby.
module BinaryTree
class Node
attr_reader :word, :count, :left, :right
include Enumerable
def initialize(word)
@word, @count = word, 1
end
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.
@headius
headius / output
Created May 19, 2011 21:58
Rubinius's actor API under JRuby
~/projects/jruby ➔ jruby rbx_actor_example.rb
Processing: 0
Processing: 4
Processing: 7
Processing: 5
Processing: 8
Processing: 3
Processing: 2
Processing: 6
Processing: 1
@dbrady
dbrady / csv_tests.rb
Created May 26, 2011 06:05
Unit Tests for CSV demonstrating that Enumerable is supported only at the whim of the underlying StringIO seek position
#!/usr/bin/env ruby
unless RUBY_VERSION.start_with? "1.9"
puts "This test file is for Ruby 1.9.x"
exit -1
end
require 'csv'
require 'test/unit'
#!/usr/bin/env ruby
# encoding: utf-8
require "rubygems"
require "amqp"
EventMachine.run do
AMQP.connect(:host => '127.0.0.1') do |connection|
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
#!/usr/bin/env ruby
# encoding: utf-8
require "rubygems"
require "amqp"
AMQP.start("amqp://dev.rabbitmq.com:5672") do |connection|
channel = AMQP::Channel.new(connection)
exchange = channel.fanout("nba.scores")
@topfunky
topfunky / new-github.sh
Created July 25, 2011 22:23
Shell shortcut to setup a Git repo with GitHub. Works with zsh or bash.
# Usage: new-github topfunky tidy_table
function new-github() {
git remote add origin git@github.com:$1/$2.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}