Skip to content

Instantly share code, notes, and snippets.

David Shaffer flanger001

Block or report user

Report or block flanger001

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
@flanger001
flanger001 / development.rb
Last active May 27, 2020
This exists because Paperclip emits a lot of 404 errors if you clone your development db from production. If you do not clone your development db from production, you probably should not use this.
View development.rb
require "middleware/paperclip_middleware"
Rails.application.configure do
# other stuff
config.middleware.use(PaperclipMiddleware)
end
@flanger001
flanger001 / gem_update.rb
Last active Apr 30, 2020
Gem update script. Put this in bin/gem_update and chmod +x bin/gem_update. Thanks to https://www.honeybadger.io/blog/capturing-stdout-stderr-from-shell-commands-via-ruby/
View gem_update.rb
#!/usr/bin/env ruby
require "open3"
puts "Create new branch? (press y to continue)"
print "> "
if gets.chomp.casecmp?("y")
system("git checkout master")
system("git branch -D gems/outdated")
system("git checkout -b gems/outdated")
View adding_a_key.md

Adding a new PGP key

Scenario:

I have a key that is currently on two computers. I want to do these things:

  • Create a new key with better security
  • Sign my old key with my new key
  • Revoke my old key
  • Export both keys
@flanger001
flanger001 / btw.md
Last active Oct 15, 2018
Babel + Typescript + Webpack resources
View btw.md
View spongebob.rb
class String
def spongebob
each_char.map { |c| rand > 0.5 ? c.swapcase : c }.join
end
end
View cycling_background.scss
$animation: MoveBG 100s ease infinite;
body {
background: linear-gradient(240deg,#a24bcf,#4b79cf,#4bc5cf);
background-size: 400% 400%;
-webkit-animation: $animation;
-moz-animation: $animation;
-o-animation: $animation;
animation: $animation;
}
@flanger001
flanger001 / pre-commit
Last active Oct 18, 2017
Rubcop git hook
View pre-commit
#! /usr/bin/env ruby
if system('bundle exec rubocop')
puts 'Rubocop is pleased.'
else
puts 'Rubocop demands penance.'
exit(1)
end
View aliasing.rb
class A
def foo
'hello'
end
alias_method :bar, :foo
end
class B < A
def foo
'bye'
View breakfast.py
# An object-oriented breakfast
class Mug(object):
def __init__(self, article):
self.article = article
print('You put a', self.article.get_name().lower(), 'in the mug')
def heat(self, heater, time):
heater.heat(self.article, time)
def get_article(self):
View keybase.md

Keybase proof

I hereby claim:

  • I am flanger001 on github.
  • I am flanger001 (https://keybase.io/flanger001) on keybase.
  • I have a public key ASAk-Xk1h0680J2gvJ2DHU3IRBOCPrGN-ejC18u2JN19wgo

To claim this, I am signing this object:

You can’t perform that action at this time.