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 call(env) | |
[200, {}, 'Hello'] | |
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
def foo(options = {}) | |
[options[:bar], options[:baz]] | |
end | |
foo(bar: '12345', baz: 'abcdef') # => ["12345", "abcdefg"] | |
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 times_bought | |
count = 0 | |
orders = Spree::Order.complete | |
orders.each {|o| count+=1 if o.products.include?(self)} | |
count | |
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
def matches?(env) | |
req = @request.new(env) | |
@constraints.each { |constraint| | |
if constraint.respond_to?(:matches?) && !constraint.matches?(req) | |
return false | |
elsif constraint.respond_to?(:call) && !constraint.call(*constraint_args(constraint, req)) | |
return false | |
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
source "https://rubygems.org" | |
gem "sqlite3" | |
gem "rails", :git => 'https://github.com/rails/rails.git', :branch => '3-2-stable' |
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
Motion::Project::App.setup do |app| | |
app.files.insert(-10, "./app/controllers/nav_bar_controller.rb") | |
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
elements = (1..19999999) | |
p elements.class # => Range | |
results = elements.select { |n| | |
n % 2 == 0 | |
}.map { |n| | |
n + 1 | |
}.take(10) |
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/bash | |
# by Artyom Loenko aka dive ([email protected]) | |
# Usage: | |
# - download this script | |
# - open Terminal.app | |
# - goto to Folder where script downloaded | |
# - run 'chmod +x fix_skype_conversation_icons_retina.sh' | |
# - then run './fix_skype_conversation_icons_retina.sh' |
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 'spec_helper' | |
describe Spree::Config do | |
before do | |
ActionController::Base.perform_caching = true | |
# config.cache_store = :dalli_store, { expires_in: 5.seconds } | |
end | |
it "Should fallback to database if cache keys expire" do | |
Spree::Config.featured_sale_id = 10 |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace SG___Code_1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) |