Skip to content

Instantly share code, notes, and snippets.

View billthompson's full-sized avatar

Bill Thompson billthompson

View GitHub Profile
@ncancelliere
ncancelliere / prune_git_branches.sh
Created March 25, 2015 14:11
Remove local git branches that have been merged
# Credit to http://snippets.freerobby.com/post/491644841/remove-merged-branches-in-git for the script on which this is based
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
git remote prune origin
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$")
if [ -z "$local_branches" ]; then
@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 12, 2025 21:24
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@charrisbc
charrisbc / organizer_visitor.rb
Created August 25, 2015 15:16
OrganizerVisitor debugging helper. Include in an Interactor::Organizer to wrap each interactor in binding.pry calls.
module OrganizerVisitor
extend ActiveSupport::Concern
included do
def call
self.class.organized.each do |interactor|
binding.pry
''
interactor.call!(context)
binding.pry
@charrisbc
charrisbc / interactor_visitor.rb
Created August 25, 2015 15:18
Interactor Visitor debugging helper. Include in an Interactor to wrap with calls to binding.pry
module InteractorVisitor
extend ActiveSupport::Concern
included do
around do |interactor|
binding.pry
''
interactor.call
binding.pry
''
@paulirish
paulirish / what-forces-layout.md
Last active January 18, 2026 17:14
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@splittingred
splittingred / gist:606c6b6b07c8e536dcd7
Last active February 28, 2018 19:37
Things Nick Hates
Things Nick Hates
0) Ann Kitchen
1) non-shallow tests
2) `if !`
3) ants
4) rock stars
5) sunlight off porch windows when drinking coffee
6) people who feed the meter
7) using floats for money
@ldez
ldez / gmail-github-filters.md
Last active October 10, 2025 09:53
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@jaymcgavren
jaymcgavren / blog.rb
Created October 26, 2017 22:48
Set up Active Record with an in-memory database and model classes, all in a single file.
# Instead of loading all of Rails, load the
# particular Rails dependencies we need
require 'sqlite3'
require 'active_record'
# Set up a database that resides in RAM
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)