Skip to content

Instantly share code, notes, and snippets.

Florian Motlik flomotlik

Block or report user

Report or block flomotlik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@flomotlik
flomotlik / capybara.rb
Created Dec 3, 2010
Drop file into spec/support when using rspec and capybara
View capybara.rb
require 'capybara/rails'
require 'capybara/session'
Capybara.run_server = true
Capybara.default_selector = :css
Capybara.default_wait_time = 2
Capybara.ignore_hidden_elements = true
View gist:1162437
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 540 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: /data/github/current/lib/github/config/failbot.rb:5: undefined method `setup' for Failbot:Module (NoMethodError)
remote: from /data/github/current/config/basic.rb:168:in `require'
remote: from /data/github/current/config/basic.rb:168
remote: from hooks/post-receive:13:in `require'
remote: from hooks/post-receive:13
@flomotlik
flomotlik / myapp.rb
Created Feb 24, 2012
Using Thor subcommands
View myapp.rb
require 'thor'
require "sub"
class MyApp < Thor
desc "parentcommand SUBCOMMAND", "Some Parent Command"
subcommand "sub", Sub
end
MyApp.start
@flomotlik
flomotlik / select.rb
Created Mar 16, 2012
Thor select action
View select.rb
def select msg, elements
elements.each_with_index do |element, index|
say(block_given? ? yield(element, index + 1) : ("#{index + 1}. #{element.to_s}"))
end
result = ask(msg, :limited_to => (1..elements.count).map(&:to_s), :print_limits => false).to_i
elements[result - 1]
end
View unicorn.rb
#Base on https://gist.github.com/1401792
worker_processes 4 # amount of unicorn workers to spin up
timeout 30 # restarts workers that hang for 30 seconds
preload_app true
before_fork do |server, worker|
# Replace with MongoDB or whatever
if defined?(ActiveRecord::Base)
ActiveRecord::Base.connection.disconnect!
Rails.logger.info('Disconnected from ActiveRecord')
@flomotlik
flomotlik / Gemfile
Created May 6, 2012 — forked from leshill/Procfile
Unicorn config for cedar stack on Heroku.
View Gemfile
gem 'unicorn'
@flomotlik
flomotlik / application.rb
Created May 6, 2012 — forked from Epictetus/heroku_unicorn_logger_fix.rb
Fix Heroku cedar app logging with Rails 3.1 and Unicorn
View application.rb
config.logger = Logger.new(STDOUT)
@flomotlik
flomotlik / Gemfile
Created May 14, 2012
Asset Pipeline Setup
View Gemfile
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'yui-compressor'
gem 'compass-rails'
end
@flomotlik
flomotlik / development.rb
Created May 16, 2012
Testing Cloudfront
View development.rb
config.assets.debug = false
config.action_controller.asset_host = "https://d1qi4917vekr3d.cloudfront.net"
@flomotlik
flomotlik / railsonfire.yml
Created May 18, 2012
Empty Railsonfire for gh-pages
View railsonfire.yml
---
test:
commands:
setup:
commands:
You can’t perform that action at this time.