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
BestLovedProducts.Controllers.AffiliateProducts = Backbone.Router.extend({ | |
routes: { | |
"": "index" | |
}, | |
index: function() { | |
var affiliate_products = new BestLovedProducts.Collections.AffiliateProducts(); | |
affiliate_products.fetch({ | |
success: function() { | |
new BestLovedProducts.Views.Index({ collection: affiliate_products}); | |
}, |
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
STORED_PROCEDURE = 'find_the_id' | |
class AddStoredProcedure < ActiveRecord::Migration | |
def self.up | |
sql_statement <<-STORED_PROC | |
DELIMITER $$ | |
CREATE PROCEDURE find_the_id(IN the_id INT) | |
BEGIN | |
SELECT name FROM items WHERE id = the_id; | |
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
curl -o /tmp/skaes-rubypatches-ruby-187-24843.patch https://gist.github.com/raw/2d90a8e61044074bbfe5/6d944ebeb0eaa80e64e167df4537a622d11ac5da/svn-diff-skaes-ruby.patch | |
rvm install 1.8.7-r24843 --patch /tmp/skaes-rubypatches-ruby-187-24843.patch -C --enable-gcdebug | |
rm /tmp/skaes-rubypatches-ruby-187-24843.patch |
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
#!/bin/sh -e | |
process=$1 | |
commands=`mktemp -t gdb.XXXXXXXXXX` | |
cat > $commands << '_EOF_' | |
if during_gc == 1 | |
x/s "cannot backtrace during gc" | |
else | |
set $stack = (VALUE)backtrace(-1) | |
set $count = (int)rb_fix2int(rb_ary_length($stack)) | |
set $index = 0 |
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
#flash | |
- flash.each do |key, value| | |
%div{:class => key, :id => "flash_#{key}"}= value | |
:javascript | |
Event.observe(window, 'load', function() { | |
Effect.Fade('flash_#{key}', { duration: 3.0 }); | |
}); |
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 MyMiddleware | |
def self.call(env) | |
new({:a => 'b'}).call(env) | |
end | |
def initialize(config) | |
@config = config | |
end | |
def call(env) |
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
source :gemcutter | |
gem 'rails', '~> 2.3.5', :require => nil |
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 MessageMailer < Merb::MailController | |
include DataMapper::Validate | |
extend DataMapper::Validate::ClassMethods | |
def attribute_get(sym); @params[sym] end | |
def attribute_set(sym, val); @params[sym] = val end | |
[:from].each { |s| | |
class_eval " | |
def #{s}; attribute_get(:#{s}) 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 Rack | |
class NoIE | |
def initialize(app, options = {}) | |
@app = app | |
@options = options | |
@options[:redirect] ||= 'http://www.microsoft.com/windows/internet-explorer/default.aspx' | |
@options[:minimum] ||= 7.0 | |
end | |
def call(env) |
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
# Throw this into your bash init file for automatic | |
# paging of a few svn commands, a la git. | |
SVN_PATH=`which svn` | |
function svn | |
{ | |
case $1 in | |
cat | diff | help | list | log ) | |
if test -t 1 | |
then |