Skip to content

Instantly share code, notes, and snippets.

View micahbf's full-sized avatar

Micah Buckley-Farlee micahbf

View GitHub Profile
@micahbf
micahbf / gig.sh
Last active November 5, 2021 14:50
gig - A wrapper script for the gigalixir CLI
#!/bin/zsh
#
# gig
# A wrapper script for the gigalixir CLI
# Dependencies: gigalixir, fzf, jq
# Installation: Make sure dependencies are installed, put this in your $PATH, and chmod +x
# Author: Micah Buckley-Farlee <[email protected]>
set -u
set +C
#!/usr/bin/env ruby
# you must have SoX installed to generate touch tones
# brew install sox
# also, whatever application you run this script from will need to be authorized
# to control your computer, via System Preferences > Privacy > Accessibility
# finally, don't run this with headphones plugged in :)
@micahbf
micahbf / keybase.md
Created February 9, 2017 05:27
keybase proof

Keybase proof

I hereby claim:

  • I am micahbf on github.
  • I am micahbf (https://keybase.io/micahbf) on keybase.
  • I have a public key whose fingerprint is DD28 9E50 CEAD 280E 1E56 C833 E2E8 F47D 0137 0D80

To claim this, I am signing this object:

@micahbf
micahbf / changes_to.rb
Created May 26, 2016 18:01
Find versions where a specific thing was changed
class ActiveRecord::Associations::CollectionProxy::ActiveRecord_Associations_CollectionProxy_PaperTrail_Version
def changes_to
raise ArgumentError, "block required" unless block_given?
result = []
changes = scope.to_a.map do |version|
version_state = yield version.reify
[version_state, version]
end.each_cons(2).select do |old, new|
old.first != new.first
@micahbf
micahbf / transducers.js
Created April 21, 2016 00:34
transducers prezzo source
inc_map = function (ary) {
return ary.reduce(
function(result, input) {
return result.concat(input + 1);
}, []);
};
inc_map([1, 2, 3]);
map = function(transform, ary) {
#!/usr/bin/env ruby
require 'time'
require 'logger'
require 'aws-sdk'
AWS_REGION = "us-east-1"
AWS_KEY_ID = ""
AWS_SECRET_KEY = ""
@micahbf
micahbf / .spacemacs.el
Last active December 15, 2015 04:50
.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration."
(setq-default
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (ie. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()
@micahbf
micahbf / core_ext.rb
Created April 17, 2015 02:55
Hash#deep_assoc
class Hash
def deep_assoc(*keys)
current = fetch(keys.shift, nil)
return current if keys.empty?
return nil unless current.is_a?(Hash)
current.deep_assoc(*keys)
end
end
@micahbf
micahbf / bookmarklet.js
Created September 3, 2014 21:09
A little bookmarklet to remove the annoying attribute lists from RubyProf call stacks
javascript: (function () { var links = document.getElementsByTagName("a"); for(var i = 0; i < links.length; i++) { var link = links[i]; link.innerText = link.innerText.replace(/\([^)]*\)>?#/, "#") }; }());
@micahbf
micahbf / caltrain_departures.rb
Created April 3, 2014 22:43
Realtime Caltrain departures
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
TRANSIT_TOKEN = 'b2b9c476-6788-4a14-857b-fa3e828f99d0'
STOP_CODE = '70091'
# San Mateo NB: 70091
# San Mateo SB: 70092
# Hayward Park NB: 70101
# Hayward Park SB: 70102