This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Formatter | |
WIDTH = 78 | |
def initialize(string) | |
@string = string.gsub(/\s*\|$/, '') | |
end | |
def format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Formatter | |
WIDTH = 78 | |
def initialize(string) | |
@string = string.gsub(/\s*\|$/, '') | |
end | |
def format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ (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' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
foo = puts "foo" | |
bar = | |
- puts "bar" | |
- puts "hello" | |
baz = "BAZ" | |
Foo.new.foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) #=> "名前は必須です" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "sinatra" | |
require "dm-core" | |
require "haml" | |
DataMapper::setup(:default, "sqlite3::memory:") | |
class Post | |
include DataMapper::Resource | |
property :id, Serial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Git | |
module_function | |
def require(name, sha1 = "HEAD") | |
puts `git show #{sha1}:#{name}.rb` | |
end | |
end | |
Git.require "foo", "2004ce1aeaa12ed99c48f5e55c9ba97927f98337" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Hello, world!" |