Skip to content

Instantly share code, notes, and snippets.

View jasonm's full-sized avatar

Jason Morrison jasonm

View GitHub Profile
require 'rubygems'
require 'bio'
triplets = %w( 1 2 3 1 2 2 4 2 1 3 2 4 3 1 1 3 4 4 2 4 1 1 1 4 2 3 1)
bases = %w(a c t g)
decoded = []
bases.each do |i|
bases.each do |j|
bases.each do |k|
require 'rubygems'
require 'bio'
triplets = %w( 1 2 3 1 2 2 4 2 1 3 2 4 3 1 1 3 4 4 2 4 1 1 1 4 2 3 1)
bases = %w(a c t g)
decoded = []
bases.each do |i|
bases.each do |j|
bases.each do |k|
#!/bin/sh
# originally from http://www.macosxhints.com/article.php?story=20060121171126988
# note that the last four lines were modified from the original;
# I also updated the Current alias (since my /usr/bin/java* are symlinked through that)
# and I added the rm and removed the -h option from ln
cd /System/Library/Frameworks/JavaVM.framework/Versions
Recipe: lulz
step 1. go to the grocery store
-> go to search.twitter.com
step 2. find your ingredients
-> search for twitpic [TERM]
http://search.twitter.com/search?q=twitpic+bear
step 3. gather your ingredients
# generic module that holds configuration and serves as namespace
module Hoptoad
mattr_accessor :api_key
end
# framework-agnostic data structure holding Hoptoad-specific fields
class Hoptoad::Notice
class Error
def backtrace=(backtrace)
# Implementation
class PostsController < ApplicationController
def index
@posts = Post.published
end
def new
@post = Post.new
end
class Calculator
def sum(a, b)
a + b
end
def product(a, b)
a * b
end
end
# via http://robots.thoughtbot.com/post/168368158/lets-get-ready-to-rummmmmmmble
require 'rubygems'
require 'hpricot'
require 'open-uri'
def get_stock_name
doc = Hpricot(open('http://stocknames.info'))
names = doc / '.list ul li'
names[rand(names.size)].innerText
@jasonm
jasonm / gist:194554
Created September 27, 2009 02:10
Faking $stdin for testing in Ruby
require 'test/unit'
class InputFaker
def initialize(strings)
@strings = strings
end
def gets
next_string = @strings.shift
# Uncomment the following line if you'd like to see the faked $stdin#gets
diff --git a/ruby_focused_unit_test.vim b/ruby_focused_unit_test.vim
index 6455c35..c3c35c0 100644
--- a/ruby_focused_unit_test.vim
+++ b/ruby_focused_unit_test.vim
@@ -69,7 +69,7 @@ class RubyFocusedUnitTest
buffer.bdelete!
end
- buffer = VIM::Buffer.create DEFAULT_OUTPUT_BUFFER, :location => :below, :text => "--- Run Focused Unit Test ---\n\n"
+ buffer = VIM::Buffer.create DEFAULT_OUTPUT_BUFFER, :location => :below, :text => "--- Run Focused Unit Test ---\nCommand:\n#{test_command}\n\n"