Skip to content

Instantly share code, notes, and snippets.

@blowmage
blowmage / .profile
Last active August 29, 2015 13:55
chruby and ohmygems together at last
# my preferred prompt - ☣ [pairwithme:rails4] $
PS1='\[\e[1;31m\]☣ [\W$(if [ -n "$OMG_NAME" ]; then eval "echo :$OMG_NAME"; fi)] $\[\e[0m\] '
# chruby configuration
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
# set default ruby
chruby 2.1
@blowmage
blowmage / test_fakefs_thor.rb
Last active August 29, 2015 13:56
Test to reproduce the problems we were having with FakeFS in the minitest-rails tests. Use version 0.5.0 of FakeFS, and whatever the current version of Thor is.
require "minitest/autorun"
require "thor"
require "fakefs/safe"
class SampleGenerator < Thor::Group
include Thor::Actions
def start *args
template "foo.erb", "new/path/here/foo.rb"
end
end

Keybase proof

I hereby claim:

  • I am blowmage on github.
  • I am blowmage (https://keybase.io/blowmage) on keybase.
  • I have a public key whose fingerprint is 7FC4 001A B3B0 FFBA 60FD E278 861B B5BD 2A72 06AF

To claim this, I am signing this object:

@blowmage
blowmage / diff.diff
Last active August 29, 2015 14:02
Updated Minitest::Spec doco
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index 40b5e6a..c5b334d 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -22,6 +22,25 @@ module Kernel # :nodoc:
##
# Describe a series of expectations for a given target +desc+.
#
+ # You can describe your test by passing the object under test:
+ #
@blowmage
blowmage / docs.rake
Created November 15, 2014 01:56
A rake task to update the documentation in the gh-pages branch.
namespace :docs do
desc "Updates the documentation on the gh-pages branch"
task :update do
branch = `git symbolic-ref --short HEAD`.chomp
if "master" != branch
puts "You are on the #{branch} branch. You must be on the master branch to run this rake task."
exit
end
require_relative "../lib/my_gem/version.rb"
@blowmage
blowmage / ruby.svg
Created August 17, 2015 22:06
Ruby and RubyGems SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
require 'rubygems'
require 'gosu'
class LittleBrat < Gosu::Window
LETTER_LIMIT = 100
def initialize
# Full resolution, fullscreen
super(Gosu.screen_width, Gosu.screen_height, true)
self.caption = "Leave me alone you little brat!"
# The letters the little brat hits on the keyboard
@blowmage
blowmage / gist:590629
Created September 21, 2010 21:39
Array#=~
a = [1, 2, 3]
b = [3, 2, 1]
class Array
def =~(other)
self.sort == other.sort
end
end
puts a =~ b #=> true
@blowmage
blowmage / event_queue_callbacks.rb
Created April 5, 2011 19:26
Quick example on using a local hash to hold event callbacks.
class Foo
def start
# Do something important here
perform :start
end
def finish
perform :finish
# Clean up stuff here
end
@blowmage
blowmage / GEM_NAME.gemspec
Created June 8, 2011 22:08
Simple Gem Template
require "rake"
Gem::Specification.new do |s|
s.name = "GEM_NAME"
s.version = "0.1.0"
s.summary = "GEM_SUMMARY (short)"
s.description = "GEM_DESCRIPTION (longer)"
s.homepage = "http://example.com/GEM_NAME"
s.authors = ["GEM_AUTHOR_NAME"]
s.email = "GEM_AUTHOR_EMAIL"