Skip to content

Instantly share code, notes, and snippets.

View warmwaffles's full-sized avatar
🛠️
Code Wrestling

Matthew Johnston warmwaffles

🛠️
Code Wrestling
View GitHub Profile
# A basic null object that can be used in place of a `nil`.
class NullObject
def initialize(*); end
def method_missing(*); self; end
def respond_to?(*); true; end
def to_s; ''; end
def to_str; ''; end
def to_i; 0; end
def to_f; 0.0; end
def to_c; 0.to_c; end
class BaseConnection
# @return [Faraday::Connection]
def connection
raise(NotImplementedError, 'not implemented')
end
def get(path, args={}, &block)
request(args.merge(method: :get, url: path), &block)
end
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
class Routing
include Rails.application.routes.url_helpers
attr_reader :uri, :host, :port
def initialize(args={})
if args[:url]
parsed = URI.parse(args[:url])
configure({
host: parsed.host,
port: parsed.port,
#!/bin/bash
echo "REMOVING MERGED BRANCHES..."
git branch --merged | grep -v "\*" | grep -v "master" | xargs -n 1 git branch -d
echo "PRUNING REMOTE BRANCHES..."
git remote | xargs -n 1 git remote prune
echo "EXPIRING REFLOG..."
git reflog expire --expire-unreachable=now --all
#!/bin/bash
# For all your sub project ducttape needs
# Usage: ./tape client build
CARGO=$(which cargo)
PROJECT=$1
COMMAND=$2
@warmwaffles
warmwaffles / Rakefile.rb
Created April 28, 2015 05:57
A way to have multiple rust projects in one directory and work with them in a Rakefile
def run(cmd)
puts "===> #{cmd}"
system cmd
end
projects = %w(client editor server)
projects.each do |project|
namespace(project) do
desc "Cleans the #{project} project"

Bin Helpers

This is a list of all my bin helper files that I have at the moment. It's not much but they'll do.

Installation

Move these files to somewhere in your path. I put them in ~/bin and have that be the last place to look on my $PATH

Keybase proof

I hereby claim:

  • I am warmwaffles on github.
  • I am warmwaffles (https://keybase.io/warmwaffles) on keybase.
  • I have a public key whose fingerprint is 8D46 2C38 8B69 473E 3007 F0C3 91DE 1226 B783 7808

To claim this, I am signing this object:

#!/bin/bash
#
set -eo pipefail
[[ "$TRACE" ]] && set -x
usage() {
echo "Usage: notes [help|edit|ls|show] <name>"
echo "Show any notes / cheat notes you have"
}