Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'gsl'
users = { 1 => "Ben", 2 => "Tom", 3 => "John", 4 => "Fred" }
m = GSL::Matrix[
#Ben, Tom, John, Fred
[5,5,0,5], # season 1
[5,0,3,4], # season 2
[3,4,0,3], # season 3
[0,0,5,3], # season 4
gem install hobo
hobo thingybob && cd thingybob
ruby script/generate hobo_model_resource thing name:string body:text
ruby script/generate hobo_migration
# Respond to the prompt with 'm'
# then press enter to chose the default filename
ruby script/server
require 'test/unit'
class RemoteTest < Test::Unit::TestCase
def setup
@domain ||= registered_domain
end
def test_domain_expiry_date
assert @domain.expiry_date
end
require 'test/unit'
class RemoteTest < Test::Unit::TestCase
def setup
@@domain ||= registered_domain
end
def test_domain_expiry_date
assert @@domain.expiry_date
end
require 'active_resource'
require 'shopify_api'
$KCODE = 'u' # for #parameterize
ActiveResource::Base.site = 'https://API_KEY:PASSWORD@jstorimer.myshopify.com/admin'
# I only had one blog
ShopifyAPI::Blog.find(:first).articles.select {|a| a.published_at.present?}.each do |article|
File.open("_posts/#{article.published_at.year}-#{article.published_at.month}-#{article.published_at.day}-#{article.title.parameterize}.textile", 'w') do |f|
f.write(article.body)
end
require 'masquerade'
run Sinatra::Application
module OpenSRS
class APP < SockIt::Base
host 'admin.test.hostedemail.com'
port 4449
ssl true
attr_accessor :username, :password, :domain
def initialize(options = {})
# assign variables
function --on-event fish_command_not_found method_missing
fish_method_missing $argv;
end
#!/usr/bin/env python
# -*- coding: latin-1 -*-
shortname = "lorem"
program = "Lorem Ipsum Generator (%s)" % shortname
version = "0.6.1"
copyright = "Copyright (C) 2007 Per Erik Strandberg"
license = """This is free software, and you are welcome to redistribute it
under the GNU General Public License <http://www.gnu.org/licenses/gpl.html>
%s comes with NO WARRANTY, to the extent permitted by law.""" % shortname
gem 'mysql', '1.2.2'
gem 'stuff'
group :test do
gem 'webrat'
end
eval(IO.read("#{ENV['HOME']}/.custom_gemfile")) if File.exists?("#{ENV['HOME']}/.custom_gemfile")