A simple and concise (474 bytes minified, 1KB normal) binary clock in Shoes.
Compatible with Shoes 2 (Raisins) and 3 (Policeman).
Design inspired by The Game of Life on the ShoeBox.
| diff --git a/lib/compiler/ast/transforms.rb b/lib/compiler/ast/transforms.rb | |
| index 19e1cfb..4e52ec2 100644 | |
| --- a/lib/compiler/ast/transforms.rb | |
| +++ b/lib/compiler/ast/transforms.rb | |
| @@ -59,6 +59,71 @@ module Rubinius | |
| end | |
| end | |
| + # Provide an underscore node that allows partial application in Ruby. | |
| + # Instead of doing a method call, we are going to generate a lambda |
| module Developer | |
| extend self | |
| delegate :establish_connection, :clear_all_connections!, :to => ActiveRecord::Base | |
| def delayed_debug(scope) | |
| detach_process do | |
| close_io_objects | |
| establish_connection | |
| setup_process_name | |
| notify_developers |
| A long, long time ago... | |
| I can still remember | |
| How his blog used to make me smile. | |
| And I knew that if he had his chance | |
| That he could make their code enhance | |
| And, maybe, they’d be happy for a while. | |
| But August made me shiver | |
| With every code line I’d deliver. | |
| Bad news on the doorstep; |
A simple and concise (474 bytes minified, 1KB normal) binary clock in Shoes.
Compatible with Shoes 2 (Raisins) and 3 (Policeman).
Design inspired by The Game of Life on the ShoeBox.
In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.
It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.
you might want to take a look at a demo app
| diff --git a/gc.c b/gc.c | |
| --- a/gc.c | |
| +++ b/gc.c | |
| @@ -77,6 +77,41 @@ void *alloca (); | |
| #ifndef GC_MALLOC_LIMIT | |
| #define GC_MALLOC_LIMIT 8000000 | |
| #endif | |
| +#define HEAP_MIN_SLOTS 10000 | |
| +#define FREE_MIN 4096 | |
| + |
| require "rubygems" | |
| require "sinatra" | |
| get "/next" do | |
| tell_itunes "next track" | |
| end | |
| get "/previous" do | |
| tell_itunes "previous track" | |
| end |
| #!/usr/bin/env ruby -wKU | |
| ### A parasitic class | |
| class Parasite | |
| ### Make all future instances of the Parasite actually call | |
| ### methods of the +victim+ instead. | |
| def self.infest( victim ) | |
| victim.methods.each do |m| | |
| meth = victim.method( m ) |
| 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 |
| #!/usr/bin/env ruby | |
| =begin | |
| INSTALL: | |
| curl http://github.com/defunkt/gist/raw/master/gist.rb > gist && | |
| chmod 755 gist && | |
| sudo mv gist /usr/local/bin/gist |