This file contains hidden or 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 | |
require 'optparse' | |
require 'ostruct' | |
require 'pathname' | |
require 'fileutils' | |
require 'digest/sha1' | |
ACTIONS = [] | |
TARGETS = [] |
This file contains hidden or 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
From 69c54b3b56d6ca1e51cfe33a15a4a5b730cc82ec Mon Sep 17 00:00:00 2001 | |
From: Michael Fellinger <[email protected]> | |
Date: Thu, 16 Apr 2009 13:57:17 +0900 | |
Subject: [PATCH] Improved Rack::Reloader | |
--- | |
lib/rack/reloader.rb | 134 +++++++++++++++++++++++++++++++++----------------- | |
1 files changed, 88 insertions(+), 46 deletions(-) | |
diff --git a/lib/rack/reloader.rb b/lib/rack/reloader.rb |
This file contains hidden or 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 'ramaze' | |
module Thoth | |
def self.setup | |
puts 'ramaze is not up yet, but gonna be soon' | |
end | |
end | |
Ramaze.options.setup << Thoth |
This file contains hidden or 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 AttribBase | |
def initialize | |
eval($initLine) | |
end | |
end | |
module ConstExtend | |
def const_missing(name) | |
const = const_set(name, Class.new(AttribBase)) | |
const.extend(ConstExtend) |
This file contains hidden or 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 'bacon' | |
Bacon.summary_on_exit | |
describe 'keychain splitter' do | |
def split(keychain) | |
return nil, keychain if keychain.first == '0' | |
argument, rest = [], [] | |
digits = true |
This file contains hidden or 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
layout do |path, wish| | |
if path !~ /feed|show/ | |
mobile_rendering? ? :mobile : :main | |
end | |
end | |
def self.mobile_rendering? | |
(request.host =~ /m\.learnivore/) ? true : false | |
end |
This file contains hidden or 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 'benchmark' | |
def with_zip(n, a1, a2) | |
n.times do | |
a1.zip(a2).each{|a,b| [a,b]} | |
end | |
end | |
def with_index(n, a1, a2) | |
n.times do |
This file contains hidden or 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 'benchmark' | |
h = { | |
:asymbol => :foo, | |
:astring => 'foo', | |
'bsymbol' => :bar, | |
'bsymbol' => 'bar' | |
} | |
iterations = 2_000_000 |
This file contains hidden or 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
jruby-1.4.0: jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-02 69fbfa3) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [amd64-java] | |
Rehearsal ------------------------------------------------------- | |
on the fly: 1.591000 0.000000 1.591000 ( 1.511000) | |
compiled: 0.861000 0.000000 0.861000 ( 0.861000) | |
on the fly right: 0.814000 0.000000 0.814000 ( 0.815000) | |
compiled right: 0.712000 0.000000 0.712000 ( 0.712000) | |
---------------------------------------------- total: 3.978000sec | |
user system total real |
This file contains hidden or 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 'nokogiri' | |
require 'csv' | |
template = Nokogiri::XML(DATA.read) | |
builder = Nokogiri::XML::Builder.with(template.at('group')) do |group| | |
CSV.foreach('export', headers: true) do |row| | |
group.entry do |entry| | |
entry.title row['title'] | |
entry.username row['username'] | |
entry.password row['password'] |