Skip to content

Instantly share code, notes, and snippets.

It's great in Phoenix 🚲

Dave Tapley dukedave

It's great in Phoenix 🚲
Block or report user

Report or block dukedave

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dukedave /
Last active Aug 29, 2015
Substring Replacement in Bash
# 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
View hash.rb
> 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
dukedave / 85004_fm_free.txt
Created Jun 26, 2015
Free FM channels at 85004
View 85004_fm_free.txt
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!
dukedave / pending_fail.rb
Created Jan 23, 2015
Pending failing rspec tests
View pending_fail.rb
require 'pty'
cmd = ARGV.first
PTY.spawn( cmd ) do |stdin, stdout, pid|
stdin.each do |line|
View rvm_get_stable_fail.log
$ rvm get stable
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' - ''!
View token.hbs
Token {{id}}
{{view 'translation-list' contentBinding='translations'}}
View magento_1045
I, [2014-09-16T13:53:52.616946 #17989] INFO -- : SOAP request:
I, [2014-09-16T13:53:52.617093 #17989] INFO -- : SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction", Content-Type: text/xml;charset=UTF-8, Content-Length: 583
D, [2014-09-16T13:53:52.617162 #17989] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="" xmlns:xsi="" xmlns:typens="urn:Magento" xmlns:env=""><env:Body><typens:shoppingCartCustomerSet><sessionId>f64157706ed396c47e3ed0c461498c30</sessionId><quoteId>2</quoteId><customerData><firstname>testFirstname</firstname><lastname>testLastName</lastname><email></email><mode>guest</mode><website_id>0</website_id></customerData></typens:shoppingCartCustomerSet></env:Body></env:Envelope>
D, [2014-09-16T13:53:52.617332 #17989] DEBUG -- : HTTPI POST request to (net_http)
I, [2014-09-16
dukedave / regex.rb
Created Aug 18, 2014
\a \A \z \Z in Ruby regexes
View regex.rb
irb(main):001:0> 'derp' =~ /derp\Z/
=> 0
irb(main):002:0> 'derp' =~ /derp\z/
=> 0
irb(main):003:0> 'derp' =~ /\Aderp\z/
=> 0
irb(main):004:0> 'derp' =~ /\aderp\z/
=> nil
dukedave / sequel_pk_in_module.rb
Created Jul 22, 2014
Explicitly declaring Sequel PK in module
View sequel_pk_in_module.rb
def self.included(o)
o.extend ClassMethods
o.set_primary_key [:user_id, :period]
dukedave / indexes.sql
Created Jul 22, 2014
Implicit primary key index is redundant
View indexes.sql
"events_pkey" PRIMARY KEY, btree (user_id, period)
"events_user_id_period_excl" EXCLUDE USING gist (user_id WITH =, period WITH &&)
You can’t perform that action at this time.