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
# sudo gem install rack nokogiri mongrel --no-rdoc --no-ri | |
# curl http://gist.github.com/raw/258378/31dc0cc39faf8328cc6b5b5e2fa2a973153f174d/gistfile1.txt > hello_world.rb | |
# ruby hello_world.rb | |
require 'rubygems' | |
require 'rack' | |
require 'nokogiri' | |
require 'open-uri' | |
class HelloWorld |
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
package main | |
import "os"; | |
import "fmt"; | |
var foo = os.Args[1:]; | |
func main() { | |
fmt.Println(foo); | |
} |
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
Carl-Lerches-MacBook-Pro:~ carllerche$ rvm remove 1.9.1-head ; rvm install 1.9.1-head --trace | |
<i> Removing /Users/carllerche/.rvm/src/ruby-1.9.1-head... </i> | |
<i> it seems that /Users/carllerche/.rvm/ruby-1.9.1-head is already non existent. </i> | |
install 1.9.1-head --trace | |
+ [[ -z install ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ 0 -gt 0 ]] | |
+ [[ 0 -gt 0 ]] | |
+ [[ ! -z '' ]] |
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
Carl-Lerches-MacBook-Pro:~ carllerche$ rvm remove 1.9.1-head ; rvm install 1.9.1-head --trace | |
<i> Removing /Users/carllerche/.rvm/src/ruby-1.9.1-head... </i> | |
<i> it seems that /Users/carllerche/.rvm/ruby-1.9.1-head is already non existent. </i> | |
install 1.9.1-head --trace | |
+ [[ -z install ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ 0 -gt 0 ]] | |
+ [[ 0 -gt 0 ]] | |
+ [[ ! -z '' ]] |
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 Array | |
def /(n) | |
arr = [] | |
size = length / n | |
size += 1 if length % n > 0 | |
n.times do |i| | |
arr << self[i*size, size] | |
end | |
arr | |
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
# This is pretty evil, yeah... I know | |
class Module | |
alias old_append_features append_features | |
def append_features(base) | |
return false if base < self | |
(@_needed || []).each { |mod| base.send(:include, mod) } | |
(@_class_methods || []).each do |blk| | |
(class << base ; self ; end).class_eval(&blk) | |
end | |
old_append_features(base) |
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
def matching(prop) | |
@matching ||= inject({}) do |hash, p| | |
(hash[p.root] ||= []) << p | |
hash | |
end[prop.root] || [] | |
end | |
def matching(prop) | |
@matching ||= begin | |
map = {} |
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 File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe "Koios::Relationship" do | |
model :Owner do |sql| | |
has n, :things, :model => 'Thing', :on => :owner_id | |
end | |
model :Thing do |sql| | |
property :owner_id, Integer |
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
gem_env do | |
gem "merb" | |
gem "json", :namespace => "pure" | |
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
# This is pretty evil, yeah... I know | |
class Module | |
alias old_append_features append_features | |
def append_features(base) | |
return false if base < self | |
(@_needed || []).each { |mod| base.send(:include, mod) } | |
(class << base ; self ; end).class_eval(&@_class_methods) if @_class_methods | |
old_append_features(base) | |
end |