Skip to content

Instantly share code, notes, and snippets.

View jaydorsey's full-sized avatar
💊
Ruby on Rails

Jay Dorsey jaydorsey

💊
Ruby on Rails
View GitHub Profile
### Keybase proof
I hereby claim:
* I am jaydorsey on github.
* I am jaydorsey (https://keybase.io/jaydorsey) on keybase.
* I have a public key whose fingerprint is 49FE 92BB A9CA 354B E9C5 BBFD 842C 2651 0307 ECA6
To claim this, I am signing this object:
gem install pronto pronto-brakeman pronto-coffeelint pronto-fasterer pronto-flay pronto-haml pronto-jshint pronto-poper pronto-rails_best_practices pronto-rails_schema pronto-reek pronto-rubocop pronto-scss pronto-rails_schema
@jaydorsey
jaydorsey / install.sh
Last active September 20, 2018 17:52
Install bundler version from Gemfile.lock
# Mirror CI/CD version bundler with your Gemfile.lock version
gem install bundler --no-document --version $(tail -n 1 Gemfile.lock) | sed -e 's/^[[:space:]]*//'
@jaydorsey
jaydorsey / ublock
Last active April 21, 2024 21:57
uBlock for LinkedIn
# Block things on LinkedIn with uBlock Origin that LinkedIn won't let you block
# Choose "Options" in uBlock Origin with a right-click, and add these to
# "My filters"
# ADDING YOUR OWN FILTERS
#
# Using Linkedin.com as an example
#
# 1. Open up the webpage
# 2. Find some text you want to block
@jaydorsey
jaydorsey / run_length.rb
Last active June 19, 2018 15:29
Run length encoding in Ruby
"WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW".
chars.
chunk_while { |before, after| before == after }.
reduce(String.new) { |memo, group| memo << "#{group.size}#{group.first}" }
rle = -> (str) { str.chars.chunk_while{ |b, a| b == a }.reduce(""){ |m, g| m << g.length.to_s << g.first } }
rle.call("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW")
@jaydorsey
jaydorsey / .zshrc
Created June 5, 2018 18:27
Guard for exercism
# Append this alias to your .zshrc or .bashrc
#
# Run `guardme` from any exercise directory to start guard
# with your custom Guardfile
alias guardme="guard --guardfile ~/exercism/ruby/Guardfile"
@jaydorsey
jaydorsey / fib.rb
Last active July 5, 2018 18:47
Fibonacci enumerator
fib = -> { Enumerator.new { |y| a = b = 1; loop { y << a; a, b = b, a + b } } }
puts fib.call.take(20)
x = fib.call
x.next => 1
x.next => 1
x.next => 2
...
x.next => 13
@jaydorsey
jaydorsey / update_gems.sh
Created July 12, 2018 20:09
Update all your local gems
# Don't run this unless you know why you're running this
gem outdated | awk '{print $1}' | xargs gem update $1
@jaydorsey
jaydorsey / post-receive
Created November 2, 2018 20:29
Notify of file changed after git pull
#!/bin/sh -eu
# This file goes in .git/hooks/post-receive
if git diff-tree --name-status -t -r --root HEAD | grep -q 'development.sql'
then
echo "Your db/data/development.sql file changed. You may want to run rails gs:load"
fi
@jaydorsey
jaydorsey / remove.js
Created November 19, 2018 03:13
Scummy facebook advertisers
// Automatically clicks the "Remove" button for all the advertisers
// that are showing from this page: https://www.facebook.com/ads/preferences/?entry_product=ad_settings_screen
// under the "Advertisers who you've interacted with" (who I actually have never
// interacted with), "Who use a contact list added to facebook" (that they likely
// bought 2nd hand because I've never done business with them)
//
// Click the "More" button multiple times to display them all, then run this script
var buttons = document.querySelectorAll("[data-tooltip-content='Remove']");for (i = 0; i< buttons.length; i++) { buttons[i].click();};