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 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(:&) |
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
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 |
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
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; |
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 '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) |
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
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? |
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
# 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 | |
# |
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
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 = {}; |
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
config.middleware.insert_before(0, 'Rack::SeoRedirect') |
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 PostRepresenter | |
include Representer | |
using Representer | |
def basic(post) | |
select(post, :id, :name) | |
end | |
def details(post) | |
basic(post) & comments(post) |
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
The MIT License (MIT) | |
Copyright (c) 2015 Oleg Ivanov http://github.com/morhekil | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
OlderNewer