Skip to content

Instantly share code, notes, and snippets.

View genki's full-sized avatar

Genki Takiuchi genki

View GitHub Profile
#!/usr/bin/env ruby
class Formatter
WIDTH = 78
def initialize(string)
@string = string.gsub(/\s*\|$/, '')
end
def format
#!/usr/bin/env ruby
class Formatter
WIDTH = 78
def initialize(string)
@string = string.gsub(/\s*\|$/, '')
end
def format
~ (1) SELECT "id", "digest", "fetched_at", "created_at", "site_id" FROM "pages"
WHERE ("site_id" IN (1)) ORDER BY "id" ~ ERROR: syntax error at or near "("
merb : worker (port 4000) ~ ERROR: syntax error at or near "(" - (PostgresError)
/Users/takiuchi/project/watch-me/gems/gems/dm-core-0.9.11/lib/dm-core/adapters/data_objects_adapter.rb:186:in `with_reader'
/*
* s21g GoogleDocs Outliner
*
* (C) 2009 Genki Takiuchi <genki{at}s21g{dot}com>
*/
function gdol_cleanup(){
var ol = document.getElementById("outline");
if(ol){
clearInterval(ol.timer);
ol.doc.body.style.marginRight = '0px';
class Foo
foo = puts "foo"
bar =
- puts "bar"
- puts "hello"
baz = "BAZ"
Foo.new.foo
pt = PropertyTranslator.new(Item)
scope = pt.translate("name") # => "Item.name"
emt = ErrorMessageTranslator.new(:be_present)
scope = emt.translate(scope) #=> "Item.name should be present"
gtt = GetTextTranslator.new(:ja, :JP)
scope = gtt.translate(scope) #=> "名前は必須です"
require "rubygems"
require "sinatra"
require "dm-core"
require "haml"
DataMapper::setup(:default, "sqlite3::memory:")
class Post
include DataMapper::Resource
property :id, Serial
def require_el(path)
result = []
indents = [0]
ended = false
open(path).read.split("\n").each do |line|
if ended
result << line
elsif line == "__END__"
result << line
ended = true
module Git
module_function
def require(name, sha1 = "HEAD")
puts `git show #{sha1}:#{name}.rb`
end
end
Git.require "foo", "2004ce1aeaa12ed99c48f5e55c9ba97927f98337"
puts "Hello, world!"