Skip to content

Instantly share code, notes, and snippets.

View gabebw's full-sized avatar

Gabe Berke-Williams gabebw

View GitHub Profile
@jyurek
jyurek / tm.sh
Last active February 12, 2024 10:37
Create and switch sessions in tmux quickly
#!/bin/sh
tm() {
if [ -z $1 ]; then
tmux switch-client -l
else
if [ -z "$TMUX" ]; then
tmux new-session -As $1
else
if ! tmux has-session -t $1 2>/dev/null; then
TMUX= tmux new-session -ds $1
@Wilto
Wilto / chili.md
Last active August 29, 2015 13:55
Chili.
  • 2 Tbsp vegetable oil
  • Red bell pepper, diced
  • Yellow bell pepper, diced
  • 4 cloves garlic, minced
  • 2 yellow onions, minced
  • 24 oz. can tomatoes, diced (Pastine 4-LYFE)
  • 24 oz. can tomatoes, crushed (See above)
  • 1 can black beans, drained/rinsed
  • 1 can kidney beans, drained/rinsed
  • 1 can vegetable stock
@henrik
henrik / lib-i18n_raise_on_missing_in_action_view.rb
Last active August 29, 2015 13:55
Overwrite `t` helper in Rails views to raise in tests, which it otherwise doesn't do, even if I18n is configured to.
# Overwrite `t` helper in Rails views to raise in tests,
# which it otherwise doesn't do, even if I18n is configured to.
#
# Installation:
# put in lib/i18n_raise_on_missing_in_action_view.rb
# and require "i18n_raise_on_missing_in_action_view" in e.g. config/environments/test.rb
if Rails.env.test?
module ActionView::Helpers::TranslationHelper
def t_with_raise(*args)
@gabebw
gabebw / Calvinbowling.md
Last active January 2, 2016 22:39
It's Calvinbowling

Official Calvinbowling Rules

Teams kind of broke it last time. So did too many rules. Let's strip it down.

Field goal rule

If the ball goes between 2 pins and they're the only ones left, your score for the frame is set to 3 points (not 8). If you get a "field bowl", even if you have more rolls left (i.e. in candlepin, you have three rolls per frame), your turn is over.

Shooting the moon (tentative rule)

If you knock down 1 pin every turn except for your first roll, your score for the game is a perfect 300 points. We ignore the first roll so you can decide whether to shoot the moon based on your first-round score. Your first roll is referred to as the Queen of Spades. Jump shots don't count against shooting the moon, so they can be a good, albeit crazy, source of extra points.

@gabebw
gabebw / its_got_what_developers_need.sh
Last active October 24, 2016 17:47
Upgrayyed your Homebrew experience.
#!/bin/sh
library=/usr/local/Homebrew/Library/Homebrew
mv "$library"/cmd/{upgrade,upgrayyed}.rb
sed -E -i '' 's/def upgrade$/def upgrayyed/' "$library"/cmd/upgrayyed.rb
# No longer exists -- where is the completion?
# sed -i '' 's/upgrade/upgrayyed/' /usr/local/Library/Contributions/brew_zsh_completion.zsh
@bf4
bf4 / Gemfile
Created July 2, 2013 18:36
Rails lograge and logstash request logging
gem 'lograge' # more readable logs
gem 'logstash-event' # for logstash json format
gem 'mono_logger' # threadsafe logging
@christoomey
christoomey / tmux.conf
Created June 21, 2013 14:41
Tmux copy-pipe
# Use vim keybindings in copy mode
setw -g mode-keys vi
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
@jferris
jferris / array_matching.rb
Created May 13, 2013 19:06
Example: custom rspec-mocks argument matcher
module ArrayMatching
class ArrayMatching
def initialize(array)
@array = array
end
def ==(other_array)
Set.new(@array) == Set.new(other_array)
end
@desandro
desandro / bower-logo.md
Last active December 30, 2021 23:11
Bower logo

In addition to awesome docs #228, Bower deserves a proper logo. See below for sketches. I'm curious if you think any of these are worth me putting more effort into.


Take a look at Yeoman right now.

Screen Shot 2013-02-19 at 4 43 10 PM

The other two entities have awesome logos. Bower's got to represent.

@calebhearth
calebhearth / gem_with_dummy.sh
Last active December 12, 2015 08:09
./gem_with_dummy.sh tiberius
gemname=$1
bundle gem $gemname
cd $gemname
git commit -am"bundle gem $gemname"
git checkout --orphan dummy
git rm -rf .
cd ..
rails plugin new $gemname \
--skip-bundle \
--skip-keeps \