I’ll be presenting Rack this Tuesday at the first Montreal Against Rails (the non-Rails meeting).
I’ll show how to use Rack and then I’d like to try something new (and probably crazy-stupid). Building a web framework with Rack is so easy, I’ll be doing pair programming with anyone from the audience to create our own custom [...]
Entries Tagged as ‘ruby’
September 14, 2008
Presenting Rack at Montreal Against Rails
September 2, 2008
Ruby on V8
Google Chrome looks cool, ok… But what is even cooler for me is V8, the super JavaScript VM.
JavaScript is a dynamic language, just like Ruby.
You can add stuff to objects at runtime, like Ruby.
It’s object oriented, like Ruby.
It has a GC, like Ruby.
…
What if we could run Ruby on V8?
Well, it’s a lot easier that [...]
August 8, 2008
You’re just in a giant Object.class_eval block
>> Object.methods.size
=> 85
>> def i_is_in_ur_Object; "kthxbai" end
=> nil
>> Object.methods.size
=> 86
>> String.new.i_is_in_ur_Object
=> "kthxbai"
Careful what you put in there!
August 5, 2008
The Class and Module love story
In Ruby, Class is a Module which, like any object, has a class.
>> Class.superclass
=> Module
>> Module.class
=> Class
But the crazy thing is, it’s the complete opposite in the implementation.
(Excerpt from ruby.h)
typedef struct {
VALUE super;
struct st_table *iv_tbl;
} rb_classext_t;
struct RClass {
struct RBasic basic;
[...]
July 21, 2008
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={};@helpers=Module.new;@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.
status=options.delete(:status)||200;layout=@layouts[options.delete(
:layout)||:default];assigns={:request=>request,:response=>response,
:params=>params,:session=>session};content=args.last.is_a?(String)?
args.last : Markaby::Builder.new(assigns,@helpers, &(block||@views[
args.last] )).to_s ; content = Markaby::Builder.new( assigns.merge(
:content => content), @helpers, &layout).to_s if layout; @response.
headers.merge!(options);@response.body=content end;def layout(name=
:default, &block); [...]
July 21, 2008
RubyFringe == Awesome
Nick 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
http://globalnerdy.com/2008/07/20/rubyfringe-day-1-notes-part-1/
http://globalnerdy.com/2008/07/20/rubyfringe-day-1-notes-part-2/
http://globalnerdy.com/2008/07/21/rubyfringe-day-2-notes-part-1/
http://www.seanr.ca/tech/?p=27
http://www.seanr.ca/tech/?p=30
April 16, 2008
Ruby to C, a couple snippets
As you might already know, the Ruby interpreter you’re (probably) using (the one at ruby-lang.org) know as MRI, for Matz Ruby Interpreter, is written in C. The VM is entirely written in C and most of the standard libraries too. So it seems that the way to make code run faster is really to dive [...]
February 24, 2008
Staying Alive with Thin!
Thin was the first Ruby server to be able to connect to UNIX domain sockets, giving you a little more speed, so you could spend less time browsing and more time dancing and eating ice creams with the people you love. But only Nginx (that I know of) supports UNIX domain sockets. Non-Nginx users might [...]
February 20, 2008
MoR7 Presentation
Here’s the code and slides of my presentation : http://github.com/macournoyer/mor7/
Hope you liked it!








