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

Keybase proof

I hereby claim:

  • I am dukedave on github.
  • I am dukedave ( on keybase.
  • I have a public key ASDIrQmt-uAMZH32h-lsWcVEvO-Jv8tiDLW_d2KvXMh_FAo

To claim this, I am signing this object:

View imagine.png.txt

Before we get started, the violinist subreddit is a fun place to hang out, lots of good questions and other beginners!

I've ended up taking something like a 4 pronged approach, I try to do at least an hour of each twice a week:

Music theory

dukedave / codeclimate-test-reporter.rb
Created Jul 5, 2016
CodeClimate::TestReporter patched to handle the absence of a .git
View codeclimate-test-reporter.rb
require 'simplecov'
require 'codeclimate-test-reporter'
module Extensions
module Git
module ClassMethods
def info
head: head,
committed_at: committed_at_or_now,
dukedave / 0_select_duration.rb
Last active Feb 13, 2016
ActiveSupport::Duration in select
View 0_select_duration.rb
>> @store.start_of_day == 0.hours
=> true
>> options_for_select([['foo', 0.hours]], @store.start_of_day)
=> "<option value=\"0\">foo</option>"
>> options_for_select([['foo', 0.hours]], 0.hours)
=> "<option selected=\"selected\" value=\"0\">foo</option>"
dukedave / page.css
Created Feb 1, 2016
Custom print DOM
View page.css
@media print {
body>:not(.printme) {
display: none;
@media not print{
.printme {
display: none;
dukedave / warn_legacy.rb
Last active Nov 16, 2015
Notify Sentry when legacy attributes are used
View warn_legacy.rb
define_method(attr) do
Raven.capture_message "Read legacy attribute #{attr}", level: 'warning'
read_attribute attr, *opts
define_method("#{attr}=") do |*opts|
Raven.capture_message "Wrote legacy attribute #{attr}", level: 'warning'
write_attribute attr, *opts
dukedave / .ackrc
Created Nov 10, 2015
Dave's ack config
View .ackrc
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
dukedave / delegating_decorator.rb
Created Aug 21, 2015
Rails decorator delegation with method missing
View delegating_decorator.rb
class << self
def method_missing(method, *args)
result = (method == :all) ? Account.scoped : Account.send(method, *args)
result.where(something: true).map { |a| a }
rescue NoMethodError => e
if result.is_a? ActiveRecord::Relation
raise e
raise "Account.#{ method } did not return a relation", method, args
You can’t perform that action at this time.