Skip to content

Instantly share code, notes, and snippets.

# = 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.
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
@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
@comboy
comboy / A_Gemfile
Created May 15, 2011 13:55
bundler env problem
# A/Gemfile
gem 'thor'
@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
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 / 1.mars
Last active August 29, 2015 14:11
baby steps
!:
|_ [hid=hide ~]
++ poke-mars-args
|= [ost=bone you=ship *]
:_ +>.$
:- [ost %pass / %g %cide %$]
:- [ost %give %nice ~]
%+ turn (~(tap by sup.hid))
|= [ost=bone *]
=- [ost %give %rush %tang -]
@comboy
comboy / core.hook
Created January 3, 2015 22:46
Simple tool for playing with multiline hoon. After putting it in /main/app/run/core.hook, create `/try/run/moo.hoon` execute `:run %moo` and stay in your editor while watching what happens when you try to compile random characters as hoon.
/- term-line
!:
|%
++ axle
$% [%0 prog=@tas]
==
++ clay-gift
$% [%ergo p=@p q=@tas r=@ud]
[%note p=@tD q=tank]
[%writ p=riot]
local band = bit.band
local bor = bit.bor
local rshift = bit.rshift
local char = string.char
local payload = _G.do_input.payload
local opcode = _G.do_input.opcode
opcode = opcode or 2
assert(type(opcode) == "number", "opcode must be number")