Get the most recommended games from steam (because steam does not tell...) this is an example and no invitation to DDos steam ;)
This file contains hidden or 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
| Rails::Initializer.run do |config| | |
| #....... | |
| config.middleware.use 'ResqueWeb' | |
| end |
This file contains hidden or 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 ResqueGenericJob | |
| def self.perform(options={}) | |
| options = options.with_indifferent_access | |
| klass = options[:class] | |
| method = options[:method] | |
| if options.has_key?(:args) | |
| klass.constantize.send(method, *options[:args]) | |
| else | |
| klass.constantize.send(method) | |
| end |
This file contains hidden or 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 ruby | |
| require 'rubygems' | |
| require 'rake' | |
| sh "git status | grep 'nothing to commit'" # ensure we are not dirty | |
| sh "git fetch origin" # get current branch info | |
| current_branch = `git branch | grep '*'`.split.last | |
| def sync(branch) | |
| sh "git checkout #{branch}" |
This file contains hidden or 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
| # drop this in a ruby file in my_rails_app/config/initializers | |
| # restart your rails and app you're good to go! | |
| class String | |
| # remove middle from strings exceeding max length. | |
| def ellipsize(options={}) | |
| max = options[:max] || 40 | |
| delimiter = options[:delimiter] || "..." | |
| return self if self.size <= max | |
| remainder = max - delimiter.size |
This file contains hidden or 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
| # https://gist.github.com/1214052 | |
| require 'sinatra/base' | |
| class ResqueWeb < Sinatra::Base | |
| require 'resque/server' | |
| use Rack::ShowExceptions | |
| if CFG[:user].present? and CFG[:password].present? | |
| Resque::Server.use Rack::Auth::Basic do |user, password| | |
| user == CFG[:user] && password == CFG[:password] |
This file contains hidden or 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
| # extracted from https://github.com/grosser/project_template | |
| rule /^version:bump:.*/ do |t| | |
| sh "git status | grep 'nothing to commit'" # ensure we are not dirty | |
| index = ['major', 'minor','patch'].index(t.name.split(':').last) | |
| file = 'lib/GEM_NAME/version.rb' | |
| version_file = File.read(file) | |
| old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a | |
| version_parts[index] = version_parts[index].to_i + 1 | |
| version_parts[2] = 0 if index < 2 |
This file contains hidden or 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
| @command = ARGV.join(' ') | |
| if system @command | |
| raise "Everything is fine here..." | |
| end | |
| def sh(cmd) | |
| puts cmd | |
| IO.popen(cmd) do |pipe| | |
| while str = pipe.gets |
This file contains hidden or 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
| # js-request tests cannot use transactions, since they happen in another process | |
| # so if we are in js request tests, use the real test database and then clean it afterwards | |
| module ActiveRecord | |
| module TestFixtures | |
| def run_in_transaction_with_js? | |
| return false if $disable_transactions | |
| run_in_transaction_without_js? | |
| end | |
| alias_method_chain :run_in_transaction?, :js |