Skip to content

Instantly share code, notes, and snippets.

Avatar

Nate Murray jashmenn

View GitHub Profile
@jashmenn
jashmenn / gist:6206
Created Aug 19, 2008
growl notify for irssi
View gist:6206
upgraded to a real git repository. Please see: http://github.com/jashmenn/irssi-growl
@jashmenn
jashmenn / gist:6626
Created Aug 21, 2008
nate murray's .irbrc
View gist:6626
# Nate Murray's ~/.irbrc
#
# Can be found at:
# http://gist.github.com/6626
# git clone git://gist.github.com/6626.git gist-6626
#
# Include colorization
require 'rubygems'
require 'wirble'
Wirble.init
View gist:7109
# paste whatever is in the clipboard to gist using gisit from http://gist.github.com/5774
# and MacClipboard code from http://project.ioni.st/post/1334#snippet_1334
# this goes in your ~/.irbrc
# * todo, change code to update an existing gist
def gistit
require 'mechanize'
require 'gistit'
gist = Gistit.new
number = gist.paste(MacClipboard.read) # => 12345
gist_url = Gistit::LOGIN_SUCCESS_URL + number.to_s
View gist:7162
ruby -e "require 'irb'; IRB.setup(__FILE__); gistit"
View gist:9998
# Function to check for a minimum rubygems version
#
# Can be found at: http://gist.github.com/9998
def check_rubygems_version
min_version = '1.2.0'
local_version = %x[gem --version].chomp
unless local_version >= min_version
puts "You need to update the RubyGems utility to #{min_version} using the following"
puts ""
@jashmenn
jashmenn / gist:13686
Created Sep 29, 2008
use inflectors from cli
View gist:13686
#!/usr/bin/env ruby
# http://gist.github.com/13686
# Nate Murray 2008
require 'activesupport'
#
# Examples:
# * inflect camelize foo_bar
# * echo "foo_bar" | inflect camelize
unless method = ARGV[0]
puts "usage: #{$0} method string"
View gist:14584
# exponential random backoff ala ethernet
# Nate Murray, 2008
# inspired by code found in http://files.rubyforge.vm.bytemark.co.uk/rhb/xmpphttpbind.rb
class EthernetBackoff
class Error < StandardError
end
# Retries block with exponential random backoff ala ethernet The retry is
# based on the return value of &block. If the value evaluates to a boolean
# true then the value is returned. Otherwise it will sleep for the calculated
@jashmenn
jashmenn / gist:16729
Created Oct 14, 2008
A tiny utility to generate graphviz dot files from objects that use pluginaweek's excellent state_machine library.
View gist:16729
#!/usr/bin/env ruby
require 'trollop'
require 'pp'
opts = Trollop::options do
version "#{$0} (c) 2008 Nate Murray"
banner <<-EOS
http://gist.github.com/16729
A tiny utility to generate graphviz dot files from objects that use pluginaweek's
@jashmenn
jashmenn / gist:16738
Created Oct 14, 2008
random-pronounceable-strings-in-ruby
View gist:16738
#!/usr/bin/env ruby
# from http://e-huned.com/2008/10/13/random-pronounceable-strings-in-ruby/
require 'rubygems'
require 'activesupport'
class String
def self.random_pronounceable(syllables = 2)
alphabet = ('a'..'z').to_a
vowels = %w{ a e i o u }
@jashmenn
jashmenn / remote.rb
Created Nov 6, 2008
sake task to create a new bare git repo on a foreign server
View remote.rb
# http://gist.github.com/22673
# Nate Murray 2008
# based on ssh:install_public_key
namespace :git do
namespace :init do
namespace :bare do
desc "Init a new bare repository on a foreign server"
task :remote do
begin
(
You can’t perform that action at this time.