- Authoring Ebooks: http://www.authoringebooks.com/
- Create Your Own Programming Language: http://createyourproglang.com/
- Exceptional Ruby: http://exceptionalruby.com/
- JavaScript Performance Rocks: http://javascriptrocks.com/performance/
- Redmine Tips: http://www.redminetips.com/
- The SPDY Book: http://spdybook.com/
- Rails 3 Upgrade Handbook: http://www.railsupgradehandbook.com/
- Refactoring Redmine: http://www.refactoringredmine.com/book/
- Bootstrapping Design: http://bootstrappingdesign.com/
- Recipes With Backbone: http://recipeswithbackbone.com/
View itr.rb
class Metaclass | |
include Enumerable | |
def initialize obj | |
@obj = obj | |
end | |
def each | |
return enum_for(:each) unless block_given? | |
x = meta_for @obj |
View webapp.rb
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
View a.rb
#! /usr/bin/env ruby | |
status = DATA.flock(File::LOCK_EX | File::LOCK_NB) | |
if status == 0 | |
puts "we have the lock..." | |
sleep | |
else |
View timeoutx.rb
#! /usr/bin/env ruby | |
# you can timeout in ruby even when all signals are blocked by doing the work | |
# in a child process (relaying the value back up a pipe) and doing the | |
# timeout-ing in the parent. of course this only works in POSIX systems | |
# | |
require 'timeout' | |
def timeoutx(seconds, &block) |
View ebooks.md