Skip to content

Instantly share code, notes, and snippets.

@pbyrne
pbyrne / ssl_url_replacer.rb
Last active December 15, 2015 11:58
Sample implementation of the SslUrlReplacer that we discussed at the whiteboard.
# Search and replace page elements in the CMS for old SSL URLs and replace with
# a new domain.
#
# Example:
#
# CMS::SslUrlReplacer.new(Site.first, "foo.bar.com", "foobar.example.com").perform
class CMS::SslUrlReplacer
# Public: Initialize a new SslUrlReplacer
#
# site - An instance of Site
@pbyrne
pbyrne / .bashrc
Created July 2, 2013 15:19
Putting the local install of MySQL into your PATH
export PATH=/usr/local/mysql/bin:$PATH
@pbyrne
pbyrne / conditional_array.rb
Last active December 21, 2015 03:18
I'm building a small array dynamically and then picking the maximum value. I have problems with each formulation. Which choice is less evil?
# This option has the most clarity, but I generally hate local variables in a
# method, preferring to use tap.
def calculated_foo
available_foos = []
available_foos << bar
available_foos << baz.qux if baz
available_foos.max
end
# It's a little less clear, unless you know what tap is, and `end.max` is
@pbyrne
pbyrne / gems-for-fun-but-mostly-for-profit.markdown
Created August 29, 2013 02:36
I'm noodling giving a talk at our local Ruby user group (http://ruby.mn). I will discuss some of the less obvious benefits of extracting non-business-logic code out of your application and into gems. Here's my outline so far.

Gems for Fun and Profit. Mostly Profit.

Show of Hands

  • Who has used a gem?
    • Such as Rails, Sinatra, Bundler, Rake
  • Who has written a gem?

Why do We Write Gems?

@pbyrne
pbyrne / madruby13-day0.markdown
Last active December 22, 2015 05:29
Notes from Madison Ruby 2013. Day 0: Rapid Prototyping workshop, Days 1 and 2 were the conference itself.

Madison Ruby 2013 - Rapid Prototyping

Bermon Painter, Charlotte NC @bermonpainter

TOC - Morning

  • Why's of rapid prototyping
  • Using preprocessors (Slim, Sass)
  • (Afternoon) Pair up and do some rapid prototyping
@pbyrne
pbyrne / bullshit.markdown
Created December 11, 2013 17:05
Hint for Day 1 of Cards Against Humanity's 12 Days of Holiday Bullshit.

For reference, the ciphertext from the note included with your first package:

GR QRW WKURZ DZDB DQBWKLQJ ZH VHQG BRX

Hint: This encrypted with a Ceaser cipher.

@pbyrne
pbyrne / strace_parser.rb
Created February 3, 2014 14:52
Stupid Analysis of `strace` Output
#!/usr/bin/env ruby
#
# Usage:
# strace_parser.rb < file.out
# head -n100 file.out | strace_parser.rb
# strace_parser.rb file.out
class StraceEntry
attr_accessor :line
attr_accessor :pid, :timestamp, :command, :args, :result, :runtime
@pbyrne
pbyrne / keybase.md
Created July 14, 2014 17:55
Keybase Proof

Keybase proof

I hereby claim:

  • I am pbyrne on github.
  • I am pbyrne (https://keybase.io/pbyrne) on keybase.
  • I have a public key whose fingerprint is D998 4D66 CC5B 33A9 83B8 51AA 3A2F FA10 BF7A D0CD

To claim this, I am signing this object:

@pbyrne
pbyrne / day-1.markdown
Created July 21, 2014 15:24
My conference notes from DevOpsDays Minneapolis 2014.

Presentations

Opening Keynote

  • Sascha Bates
  • Started Infracoders Minneapolis meetup
@pbyrne
pbyrne / fear-failure-and-imposter-syndrome.markdown
Created September 19, 2014 02:40
A woefully incomplete outline for a talk I'm starting to work on.

Fear, Failure, and Imposter Syndrome

Fear

  • Fear of failure
    • Powerful emotion
    • Stops us from even trying
    • Keeps us on the small potatoes
    • Ignore the big problems, the hard challenges
  • Many of us were "bright kids", and we're not used to failing or tying hard
    • We leave school and enter the real world. Things aren't so easy.