Skip to content

Instantly share code, notes, and snippets.

class A
class B < A
end
def foo
puts "AMA #{self.class}"
end
end
puts A::B::B::B::B::B::B::B.new.foo # "AMA A::B"
@comboy
comboy / update.rb
Created June 18, 2011 22:11
update all your namecoin domains
require 'json'
# put this file in the same dir as namecoind executable
JSON.load(`./namecoind name_list`).each do |domain|
if domain['expires_in'] < 5000
command = "./namecoind name_update '#{domain['name']}' '#{domain['value']}'"
puts command
puts `#{command}`
end
@comboy
comboy / A_Gemfile
Created May 15, 2011 13:55
bundler env problem
# A/Gemfile
gem 'thor'
@comboy
comboy / fail
Created April 18, 2011 11:05
model def
irb(main):004:0> Mol::TimeLog.auto_upgrade!
DataObjects::SyntaxError: ERROR: syntax error at or near "PRIMARY"
LINE 1: CREATE TABLE "time_logs" ( SERIAL PRIMARY KEY, "ttype" VARCH...
^
(code: 16801924, sql state: 42601, query: CREATE TABLE "time_logs" ( SERIAL PRIMARY KEY, "ttype" VARCHAR(255), "log" TEXT, "created_at" TIMESTAMP, PRIMARY KEY("id")), uri: postgres://mol:justatest@bzibm/mol?port=&adapter=postgres&fragment=&scheme=postgres&path=/mol&host=bzibm&user=mol&password=justatest&query=)
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in `execute_non_query'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:100:in `create_model_storage'
from /comboy/projects/mol/.bunndle/ruby/1.8/gems/dm-migrations-1.1.0/lib/dm-migrations/adapters/dm-do-adapter.rb:98:in `each'
from /comboy/projects/mol/.bunndle/ruby/1
namespace :open_flash_chart_lazy do
PLUGIN_ROOT = File.dirname(__FILE__) + '/../'
# avoid warning in newer version of rails, and stay compatible with older ones
rails_root = (Object.const_defined?('Rails') && Rails.respond_to?(:root)) ?
Rails.root : RAILS_ROOT
desc 'Installs required swf in public/ and javascript files to the public/javascripts directory.'
task :install do
# = rfc2047.rb
#
# An implementation of RFC 2047 decoding and encoding.
#
# This module depends on the iconv library by Nobuyoshi Nakada, which
# I've heard may be distributed as a standard part of Ruby 1.8. Many
# thanks to him for helping with building and using iconv.
#
# Thanks to "Josef 'Jupp' Schugt" <jupp@gmx.de> for pointing out an error
# with stateful character sets.