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
var ary = ['a', 'b', 'c']; | |
var funcs = []; | |
for (var i = 0; i < ary.length; i++) { | |
var c = ary[i] | |
funcs.push(function() { console.log(c) }) | |
}; | |
for (var i = 0; i < funcs.length; i++) { |
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 'redis' | |
$redis = Redis.new | |
class Request | |
def referrer | |
'http://www.google.com/search?q=Shopify+Store' | |
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
# SmartMta | |
class SmartMta | |
include HTTParty | |
base_uri 'http://smartmta.sendlabs.com/rest/json' | |
cattr_accessor :api_key | |
def self.add_sender(email) |
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
# simple extension to ActiveMerchant for basic support of recurring payments with Express Checkout API | |
# | |
# See http://http://clockobj.co.uk/2008/09/07/ruby-on-rails-paypal-express-recurring-payments-using-active-merchant/ | |
# for details on getting started with this gateway | |
# | |
# | |
module ActiveMerchant #:nodoc: | |
module Billing #:nodoc: | |
class PaypalExpressRecurringNvGateway < Gateway | |
include PaypalNvCommonAPI |
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
..................................................................................................................................................................................................F............. | |
Failures: | |
1) Money allocating money betweeen different interest parties #allocate keeps currencies intact | |
Failure/Error: Money.ca_dollar(0.05).allocate([1]).should == [Money.ca_dollar(0.05)] | |
private method `pretty_print' called for #<RSpec::Mocks::ErrorGenerator:0x1029d8c50> | |
# ./spec/money_spec.rb:1070 |
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
[tobi@i7:~]% irb | |
ree-1.8.7-2010.02 > require 'rubygems' | |
=> true | |
ree-1.8.7-2010.02 > require 'json' | |
=> true | |
ree-1.8.7-2010.02 > JSON.parse([ Time.now ].to_json)[0].class | |
=> String | |
ree-1.8.7-2010.02 > require 'json/add/core' | |
=> true | |
ree-1.8.7-2010.02 > JSON.parse([ Time.now ].to_json)[0].class |
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
<html> | |
<body> | |
<script> | |
var TestCase = function(testcase) { | |
var success = 0; | |
var failure = 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
def self.accelerated_belongs_to(record) | |
klass = record.to_s.camelize.constantize | |
if !klass.respond_to?(:current) | |
raise ArgumentError, "#{record} does not implement the current class method that is needed for accelerated_belongs_to." | |
end | |
self.belongs_to record | |
alias_method :"#{record}_without_acceleration", record |
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
includes = Product.includes_from_params(params) | |
conditions = Product.conditions_from_params(params) | |
@product_count = shop.products.count(:all, :include => includes, :conditions => conditions) | |
@products = shop.products.find(:all, | |
:limit => page_limit, | |
:offset => page_offset, | |
:conditions => conditions, |
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 'fiber' | |
module Rack | |
class Fabric | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
fib = Fiber.new do |