This file contains 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 'rubygems' | |
require 'sinatra' | |
require 'redis' | |
# To use, simply start your Redis server and boot this | |
# example app with: | |
# ruby example_note_keeping_app.rb | |
# | |
# Point your browser to http://localhost:4567 and enjoy! | |
# |
This file contains 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
Patch for jQuery 1.3.2 that makes animations work correctly when | |
working with different window contexts in Adobe AIR (1.5). | |
It causes the interval to be set on the window that belongs to | |
the element the animation is performed on. | |
=== | |
@@ -4049,8 +4049,9 @@ jQuery.fx.prototype = { | |
t.elem = this.elem; |
This file contains 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 SomeJob | |
include Resque::Mixin::Status | |
def self.perform(*args) | |
job_status "foo" | |
end | |
end | |
# versus |
This file contains 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 SomeJob | |
include Resque::Mixin::Async | |
include Resque::Mixin::Status | |
def self.some_long_running_method(*args) | |
resque_status :just_started | |
# ... | |
resque_status :halfway |
This file contains 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 SomeJob | |
include Resque::Mixin::Status | |
def self.perform(*args) | |
resque_status "00/50" | |
# ... | |
resque_status "50/50" | |
end | |
end |
This file contains 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
module Resque | |
class Payload | |
def initialize(klass, &blk) | |
@__klass = klass | |
@__calls = [] | |
instance_eval &blk | |
end | |
def method_missing(method, *args) | |
@__calls << { :method => method, :args => args } |
This file contains 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
# Add config.include(Matchers) to your spec_helper.rb | |
# ability.should allow_to(:manage, Post) | |
# | |
module Matchers | |
class CanCanMatcher | |
def initialize(action, noun) | |
@action, @noun = action, noun | |
end |
This file contains 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
# ARCHFLAGS may or may not matter - I set mine up this way just in case. | |
~$ echo $ARCHFLAGS | |
-arch i386 -arch x86_64 | |
# Be sure to compile ruby with --enable-shared | |
~$ rvm install 1.9.1 --debug --reconfigure -C --enable-shared=yes | |
# Test to ensure that --enable-shared worked | |
~$ ruby -e "require 'rbconfig'; puts Config::CONFIG['ENABLE_SHARED']" | |
yes |
This file contains 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
## | |
# test/spec/mini 3 | |
# http://gist.github.com/25455 | |
# [email protected] | |
# file:lib/test/spec/mini.rb | |
# | |
def context(*args, &block) | |
return super unless (name = args.first) && block | |
require 'test/unit' | |
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do |
This file contains 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
/* | |
* As backward only points to a non-header node, | |
* it would be possible to replace the ternary statement with | |
* simply "x->backwards", because the condition will always be false. | |
* | |
* ...right? | |
*/ | |
static void zslInsert(zskiplist *zsl, double score, robj *obj) { | |
... |
OlderNewer