Monthly Archives: July 2008

FollowersYou can now follow people on Wow it’s like FaceBook + code snippets! Better get your mom an account!

You’ll then have a page with all stuff posted by your new friends and even an Atom feed.

To follow someone, simply go to their profile page and click on “Follow this user”.

Hope you like it!



Filed under refactormycode

You See the Invisible Block?

require "rubygems";require "thin";require"markaby"; class Invisible
HTTP_METHODS =[:get,:post,:head,:put,:delete];attr_reader :request,
:response, :params; def initialize(&block); @actions =[]; @with=[];
@layouts={};@views={};;@app=self; instance_eval(
&block) if block end; def action(method, route, &block); @actions<<
[method.to_s, build_route(@with*"/"+route),block] end;HTTP_METHODS.
each{|m|class_eval "def #{m}(r='/',&b); action('#{m}', r, &b) end"}
def with(route); @with.push(route);yield;@with.pop end; def render(
*args,&block);options=args.last.is_a?(Hash)?args.pop: {};@response.
args.last :,@helpers, &(block||@views[
args.last] )).to_s ; content = assigns.merge(
:content => content), @helpers, &layout).to_s if layout; @response.
headers.merge!(options);@response.body=content end;def layout(name=
:default, &block); @layouts[name]=block end; def view(name,&block);
@views[name]=block end; def helpers(&block);@helpers.instance_eval(
&block ) ; instance_eval(&block)  end;  def session;  @request.env[
"rack.session"]end; def use(middleware, *args);
@app,*args) end; def run(*args);Thin::Server.start(@app, *args) end
def call(env); @request =; @response =Rack::; @params = @request.params; if action = recognize(env[
"PATH_INFO"], @params["_method"] ||env["REQUEST_METHOD"]); @params.
merge!(@path_params);;@response.finish; else; [404,
{}, "Not found"]; end; end; def*args,&block);new(&block).
run(*args) end; def;@app|| end;def end; private; def build_route(route);pattern= route.
split("/").inject('\/*') { |r, s| r << (s[0] == ?: ? '(\w+)' : s) +
'\/*' } + '\/*';[/^#{pattern}$/i,route.scan(/\:(\w+)/).flatten] end
def recognize(url, method); method =method.to_s.downcase; @actions.
detect do |m,(pattern,keys),_| method==m&&@path_params=match_route(
pattern,keys,url)end;end;def match_route(pattern,keys,url);matches,
|key,i| params[key]=matches[i]};params;end;end; def method_missing(
method, *args,  &block);  ; if .respond_to?(method) ; send( method, *args, &block);  else; super; end; end



Filed under ruby

RubyFringe == Awesome

RubyFringeNick Sieger though us about Jazz, Giles Bowkett got a standing ovation, Zed Shaw sang “Matz can’t patch” and “Don’t fuck Chad’s community”, Geoffrey Grosenbach was wearing a kilt, Hampton Catlin presented Haml for Javascript, Damien Katz made me cry and Tom Preston-Werner is my new hero.

Better reviews


Filed under conference, ruby