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
LEGACY_PROCESSOR_ATTRS.each do |*attr| | |
define_method(attr) do | |
Raven.capture_message "Read legacy attribute #{attr}", level: 'warning' | |
read_attribute attr, *opts | |
end | |
define_method("#{attr}=") do |*opts| | |
Raven.capture_message "Wrote legacy attribute #{attr}", level: 'warning' | |
write_attribute attr, *opts | |
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
--type-set=coffee=.coffee | |
--type-set=haml=.haml | |
--type-set=sass=.sass | |
--type-set=minifiedjs=.min.js | |
--nocss | |
--nominifiedjs | |
--ignore-dir=coverage | |
--ignore-dir=dragonfly | |
--ignore-dir=javascripts/lib |
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/sh | |
{ | |
echo "This script requires superuser access to install apt packages." | |
echo "You will be prompted for your password by sudo." | |
# clear any previous sudo permission | |
sudo -k | |
# run inside sudo | |
sudo sh <<SCRIPT |
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
class << self | |
def method_missing(method, *args) | |
result = (method == :all) ? Account.scoped : Account.send(method, *args) | |
result.where(something: true).map { |a| self.new a } | |
rescue NoMethodError => e | |
if result.is_a? ActiveRecord::Relation | |
raise e | |
else | |
raise NoMethodError.new "Account.#{ method } did not return a relation", method, args |
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
# Works okay: | |
FILE=something.txt; echo ${FILE/txt/log} | |
# Works okay: | |
find . -name \*.txt -exec sh -c 'FILE={}; echo ${FILE}' \; | |
# Fails with 'sh: 1: Bad substitution': | |
find . -name \*.txt -exec sh -c 'FILE={}; echo ${FILE/txt/log}' \; | |
# Works |
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
> event.context | |
=> {"meridien"=>"pm", "contact"=>"jennifer", "contact_id"=>954} | |
> event.context.class | |
=> Hash | |
> event.context['works'] = 'normally' | |
=> "normally" | |
> event.context | |
=> {"meridien"=>"pm", "contact"=>"jennifer", "contact_id"=>954, "works"=>"normally"} | |
> | |
> # Now trying HashWithIndifferentAccess |
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
# http://radio-locator.com/cgi-bin/vacant?select=city&city=54004&state=&x=0&y=0 | |
89.1 FM BEST! | |
89.5 FM BEST! | |
89.9 FM BEST! | |
90.1 FM BEST! | |
90.5 FM BEST! | |
91.5 FM BEST! | |
91.7 FM BEST! | |
93.3 FM BEST! |
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
#!/usr/bin/ruby | |
require 'pty' | |
cmd = ARGV.first | |
begin | |
PTY.spawn( cmd ) do |stdin, stdout, pid| | |
begin | |
stdin.each do |line| |
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
$ rvm get stable | |
Downloading https://get.rvm.io | |
Downloading https://github.com/wayneeseguin/rvm/archive/1.26.9.tar.gz | |
Downloading https://github.com/wayneeseguin/rvm/releases/download/1.26.9/1.26.9.tar.gz.asc | |
gpg: Signature made Wed 07 Jan 2015 04:55:10 AM MST using RSA key ID BF04FF17 | |
gpg: Can't check signature: public key not found | |
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. | |
Assuming you trust Michal Papis import the mpapis public key (downloading the signatures). | |
GPG signature verification failed for '/home/dave/.rvm/archives/rvm-1.26.9.tgz' - 'https://github.com/wayneeseguin/rvm/releases/download/1.26.9/1.26.9.tar.gz.asc'! |