Skip to content

Instantly share code, notes, and snippets.

View futhr's full-sized avatar
:octocat:

Tobias Bohwalli futhr

:octocat:
View GitHub Profile
@brentertz
brentertz / rails
Created July 11, 2012 22:45
Rack middleware to help avoid SEO duplicate content issues. Removes www and trailing slash and performs a permanent redirect.
config.middleware.insert_before(0, 'Rack::SeoRedirect')
@xypaul
xypaul / tinymce-ember.js
Created May 14, 2014 06:32
TinyMCE 4 Ember Component
App.TinymceEditorComponent = Ember.Component.extend({
// Warning!!! only use tinyMCE not tinymce !!!
editor: null,
data: {},
watchData: true,
didInsertElement: function(){
var _this = this;
// The magic config - http://www.tinymce.com/wiki.php/Configuration
var config = {};
@KevinTriplett
KevinTriplett / capybara_wait_until.rb
Last active December 14, 2015 12:38
Adding back the #wait_until to Capybara v2+ gem. Can probably be adapted for cucumber tests.
# add this file capybara_wait_until.rb to your /test directory
module Capybara
class Session
##
#
# Retry executing the block until a truthy result is returned or the timeout time is exceeded
#
# @param [Integer] timeout The amount of seconds to retry executing the given block
#
@hakanensari
hakanensari / honeybadger.rb
Created January 26, 2013 23:14
Honeybadger initializer
Honeybadger.configure do |config|
config.api_key = '12345678'
config.ignore.push "SignalException::SIGTERM",
"Excon::Errors::ServiceUnavailable",
"Excon::Errors::SocketError",
"Excon::Errors::Timeout"
config.async do |notice|
WorkingBadger.perform_async(notice.to_json) unless notice.ignore?
@JustinLove
JustinLove / heroku_scaler.rb
Created September 28, 2012 01:17
Pieces of a Sidekiq Herkou autoscaler
require 'heroku'
module Background
class HerokuScaler
def initialize(
type = 'worker',
user = ENV['HEROKU_USER'],
pass = ENV['HEROKU_PASS'],
app = ENV['HEROKU_APP'])
@client = Heroku::Client.new(user, pass)
@abhinavguptas
abhinavguptas / ulPickList.css
Created January 3, 2012 06:49
jQuery plugin to draw a multi select picklist
ul.container-list {
border-color: #EEE;
border-style: solid;
border-width: 1px;
overflow-x: auto;
overflow-y: scroll;
display: block;
list-style : none;
color : #444;
padding : 0px;
@markysharky70
markysharky70 / gist:1019289
Created June 10, 2011 17:20
Copy your production database to your staging database hosted on Heroku
1) backup production database:
heroku pgbackups:capture --expire --remote production
2) obtain url string to backup from step 1:
heroku pgbackups:url --app production_app_name --remote production_app_branch_name
3) transfer backup from production to staging app:
heroku pgbackups:restore DATABASE 'production_app_backup_url_string_from_step_2' --app production_app_name --app staging_app_branch_name
@michaelbaudino
michaelbaudino / rails_version_comparison.rb
Last active August 29, 2015 13:56
Rails version matching
def rails_version_matches?(requirement)
Gem::Requirement.new(requirement).satisfied_by? Gem::Version.new(::Rails::VERSION::STRING)
end
def rails_version_matches_any?(*requirements)
requirements.map{ |r| rails_version_matches?(r) }.reduce(:|)
end
def rails_version_matches_all?(*requirements)
requirements.map{ |r| rails_version_matches?(r) }.reduce(:&)