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 Sidekiq | |
module Apns | |
class Worker | |
include Sidekiq::Worker | |
sidekiq_options :queue => :apns_dts | |
def perform(*args) | |
# p args | |
end | |
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
source :rubygems | |
gem "rack", "~> 1.4" | |
gem "rack-rewrite", "~> 1.2.1" | |
gem "thin" |
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
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} |
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 ChurnLogger | |
# include Loggable | |
alias info puts | |
alias error puts | |
def perform_with_log(*args) | |
info 'starting new payments importing' | |
perform_without_log(*args) | |
rescue => exception | |
error exception.to_s |
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
brew install mongo yuicompressor git git-flow git-extras git-multipush git-utils gist libxml2 libiconv imagemagick wget |
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 RaiseExit | |
def raise(msg_or_exc, msg=msg_or_exc, trace=caller) | |
warn msg.to_s | |
exit! | |
end | |
end | |
class Object | |
include RaiseExit | |
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
require 'fiber' | |
class Bot | |
def initialize(color) | |
@position = 1 | |
@color = color | |
@fiber = Fiber.new do |buttons| | |
while next_button = buttons.find{ |c,p| c == @color } | |
if buttons.first == [@color,@position] && !$pushed | |
push_button(@position) |
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
# encoding: utf-8 | |
module ActionView | |
module Renderable #:nodoc: | |
private | |
def compile!(render_symbol, local_assigns) | |
locals_code = local_assigns.keys.map { |key| "#{key} = local_assigns[:#{key}];" }.join | |
source = <<-end_src | |
def #{render_symbol}(local_assigns) |
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 RVM and Ruby 1.9.2 and getting the error: “no such file to load — iconv” | |
rvm package install readline | |
rvm package install iconv | |
rvm remove 1.9.2 | |
rvm install —trace 1.9.2 -C —with-iconv-dir=$HOME/.rvm/usr | |
#Check it works with irb: require ‘iconv’ should return true |
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
#!/usr/bin/env rspec | |
require "spec_helper" | |
describe "The library itself" do | |
def check_for_tab_characters(filename) | |
failing_lines = [] | |
File.readlines(filename).each_with_index do |line,number| | |
failing_lines << number + 1 if line =~ /\t/ | |
end |