Skip to content

Instantly share code, notes, and snippets.

@jmmastey
jmmastey / gist:cf60d9edfb5b420cd522ece1e5b06f50
Created January 20, 2017 19:12
terrible_recruiter_spam
Dear Joseph
I came across your resume on an online job board and wanted to reach out to you to see if you or someone you know might be interested in a contract opportunity in Roseville, MN.
My client is looking for a Senior Software Engineer to join their team on a contractual basis.
Please carefully read the Job Description below, and if you would like to pursue this opportunity please email me an updated MS Word version of your resume to [email protected] at your earliest convenience. If you're not interested feel free to send me your resume and let me know what type of positions I can help you with. I appreciate your time and look forward to hearing from you.
NOTE- ONLY W-2 CANDIDATES / WE DON'T WORK ON CORP-CORP OR WITH H1B OR OPT-EAD CONSULTANTS FOR THIS OPENING./THIS IS A 100% ONSITE JOB..
nodes
id   code              depth  parent
1    B                 0      {NULL}
2    B-123             1      1
3    B-123-BLAH        2      2
...
6    B-123-BLAH-1-2-3  6      5
@jmmastey
jmmastey / keybase.md
Created April 23, 2018 16:28
keybase.md

Keybase proof

I hereby claim:

  • I am jmmastey on github.
  • I am jmmastey (https://keybase.io/jmmastey) on keybase.
  • I have a public key ASDq1RNE_EZKdZkKp64DNMLnFUlbianPiqRVqZ0iqbQI2go

To claim this, I am signing this object:

opts = {}
str = '{{ options.foo__required }}{{ options.bar__required }}{{ options.baz_9 }}'
# I'm still flattening right now... though just once in this case.
keys = str.scan(/\{\{ options.(\w+) \}\}/).flatten
=> ["foo__required", "bar__required", "baz_9"]
opts.merge!(Hash[keys.product([nil])])
=> {"foo__required"=>nil, "bar__required"=>nil, "baz_9"=>nil}
class Struct
# use the members of this struct to pull out hash keys in the right order
def self.from_hash(hash)
new(
*hash.symbolize_keys
.values_at(*members),
)
end
end
@jmmastey
jmmastey / monkey_patch.rb
Created March 26, 2019 13:39
codebase upgrades
if Gem::Version.new(Rails.version) >= Gem::Version.new("5.0")
raise "Remove this file! You don't need it anymore"
end
class ActiveJob::Base
def self.deserialize(job_data)
# monkey patch goes here
end
end
@jmmastey
jmmastey / .pryrc
Last active January 29, 2021 16:33
# Put this code (or whatever part is useful) in a file in your
# home directory called `~/.pryrc`. Then, every time you load
# a pry console, this code will automatically be executed, giving
# you these tools! I write a lot of little scripts this way.
# see `ar_counts` below
class ArCounter
def initialize
@last_count = 0
@current_count = 0
christmas_movies = {
die_hard: { violence: true, cheer: true },
nightmare: { violence: false, cheer: 'who knows' }
}
# if I'm just digging one layer into the hash, I don't get an error,
# I just get nil.
christmas_movies[:die_hard] # => { violence: true, cheer: true }
christmas_movies[:home_alone_3] # => nil
# Add these to your ~/.zshrc to expose them in any console. Both commands use the same
# general API. Navigate to a project that has a Gemfile (prolly mealhand), and run the command. It'll grab
# the correct version of the gem automatically!
# navigates your shell to the ~/.gem/ruby-2.6.1/whatever path where the gem lives
function bcd() { cd $(bundle info "$@" | grep -e "Path: [^\S]*" | sed -e 's/^[^/]*//') ;}
# opens up the "homepage" for the gem in your browser. typically github
function bweb() {
curl https://rubygems.org/api/v1/gems/"$@".json 2>/dev/null > /tmp/bweb