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
| git symbolic-ref HEAD refs/heads/my-branch-name | |
| rm .git/index | |
| git clean -fdx | |
| touch README | |
| git add . | |
| git commit -m "Initial Commit" |
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
| module SoftDelete | |
| extend ActiveSupport::Concern | |
| included do | |
| define_model_callbacks :soft_delete | |
| define_model_callbacks :recover | |
| default_scope where(:deleted_at => nil) | |
| class_eval do | |
| class << self | |
| alias_method :with_deleted, :unscoped |
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
| (rdb:1) text = page.find('.my-class').base.native.content | |
| "5000 ms" | |
| (rdb:1) text.force_encoding("UTF-8") | |
| "5000 ms" | |
| (rdb:1) s = "5000 ms" | |
| "5000 ms" | |
| (rdb:1) s.force_encoding("UTF-8") | |
| "5000 ms" | |
| (rdb:1) text == s | |
| false |
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
| # Other deploy stuff | |
| begin | |
| require 'tinder' | |
| after "deploy", "campfire" | |
| after "deploy:migrations", "campfire" | |
| after "deploy:rollback", "campfire" | |
| desc '[internal] Announces deployments a Campfire room.' |
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
| # Project-specific configuration for CruiseControl.rb | |
| Project.configure do |project| | |
| # ... | |
| project.campfire.config = { | |
| :domain => 'SUBDOMAIN', | |
| :room => 'ROOM_NAME', | |
| :token => 'API_KEY', | |
| :ssl => true |
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
| #!/bin/bash | |
| IFUP=/etc/network/if-up.d/iptables.sh | |
| IFDOWN=/etc/network/if-down.d/iptables.sh | |
| IPTABLES() { | |
| echo iptables $@ >&1 2>&1 | |
| iptables $@ | |
| } | |
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
| module Enumerable | |
| def reject_blanks | |
| reject do |i| | |
| i.blank? || (i.respond_to?(:values) && i.values.all?(&:blank?)) | |
| end | |
| end | |
| 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
| require 'hoptoad_notifier' | |
| require 'resque/failure/base' | |
| module Resque | |
| module Failure | |
| # A Failure backend that sends exceptions raised by jobs to Hoptoad. | |
| # | |
| # To use it, put this code in an initializer, Rake task, or wherever: | |
| # | |
| # require 'resque/failure/simpler_hoptoad' |
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
| # run_test functional/users_controller | |
| run_test() { | |
| ruby -Itest test/$1_test.rb | |
| } | |
| # run_fun_test users | |
| run_fun_test(){ | |
| run_test functional/$1_controller | |
| } |
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
| if rails_env = ENV['RAILS_ENV'] | |
| require 'logger' | |
| RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
| IRB.conf[:IRB_RC] = Proc.new do | |
| # Called after the irb session is initialized and Rails has | |
| # been loaded (props: Mike Clark). | |
| if defined? ActiveRecord::Base | |
| ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER | |
| end |