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
# Support running Whenever cron jobs with Lockrun | |
# Lockrun: http://www.unixwiz.net/tools/lockrun.html | |
# lockrun typically installed at /usr/bin/lockrun | |
# On Mac, install with: brew install lockrun | |
# Lockrun prefix for cronjobs: /usr/bin/lockrun --lockfile=/path/to/tmp/JOBNAME.lockrun -- sh -c "COMMAND" | |
def wrap_with_lockrun command | |
"/usr/bin/env lockrun --lockfile=:path/tmp/:lockfile.lockrun -- sh -c \"#{ command }\"" | |
end | |
#redefine the three default job types to use Lockrun (i.e. just add 'lockrun_' in front of the existing job names) |
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
namespace :assets do | |
task :check => :environment do | |
paths = ["app/assets", "lib/assets", "vendor/assets"] | |
paths.each do |path| | |
dir_path = Rails.root + path | |
if File.exists?(dir_path) | |
dir_files = File.join(dir_path, "**") |
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
## VANILLA RAKE | |
username /data/appname/current $ ruby --version | |
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] | |
username /data/appname/current $ rake hoptoad:test --trace | |
DEPRECATION WARNING: attr_accessor_with_default is deprecated. Use Ruby instead!. (called from block in <module:Configuration> at /data/appname/shared/bundled_gems/ruby/1.9.1/bundler/gems/active_admin-47cab4dd73d6/lib/active_admin/comments/configuration.rb:12) | |
** Invoke hoptoad:test (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
** Invoke hoptoad:log_stdout (first_time) |
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
# Don't load anything when running the gems:* tasks. | |
# Otherwise, hoptoad_notifier will be considered a framework gem. | |
# https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629 | |
unless ARGV.any? {|a| a =~ /^gems/} | |
Dir[File.join(Rails.root, 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier| | |
$: << File.join(vendored_notifier, 'lib') | |
end | |
begin |
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 'net/http' | |
require 'net/https' | |
require 'uri' | |
PINGDOM_API_HOSTNAME = "api.pingdom.com" | |
PINGDOM_API_KEY = "your_api_key_here" | |
PINGDOM_API_VERSION = "2.0" | |
PINGDOM_CHECK_ID = "######" | |
PINGDOM_USERNAME = "[email protected]" | |
PINGDOM_PASSWORD = "password" |
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
# Log any errors to Hoptoad as needed | |
# ** define this before the lib/tasks are included | |
def task_with_hoptoad_notification(options) | |
task(options) do | |
begin | |
yield | |
rescue Exception => msg | |
HoptoadNotifier.notify(msg) | |
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
# Add New Relic instrumentation | |
# ** define this before the lib/tasks are included | |
def task_with_new_relic_and_hoptoad(options) | |
caller_method = options.keys.first | |
task(options) do | |
require 'newrelic_rpm' | |
include NewRelic::Agent::Instrumentation::ControllerInstrumentation | |
NewRelic::Agent.manual_start | |
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
# BETDASH DEVELOPMENT ENVIRONMENT | |
# tab 1: terminal in betdash project | |
# tab 2: Rails console | |
# tab 3: tail -f on development log | |
# tab 4: dev script | |
before { run 'fgb' } | |
tab "BetDash", :selected => true do | |
run "clear" |
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
# to run this file: | |
# gem install rspec | |
# rspec prob_spec.rb | |
class Integer | |
def factorial | |
self.downto(1).inject(:*) | |
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
Configuration: | |
notifier_name: "Airbrake Notifier" | |
http_open_timeout: 2 | |
proxy_host: nil | |
api_key: "<REMOVED>" | |
notifier_url: "http://airbrakeapp.com" | |
http_read_timeout: 5 | |
user_information: "Airbrake Error {{error_id}}" | |
proxy_user: nil | |
notifier_version: "3.0.4" |
OlderNewer