Skip to content

Instantly share code, notes, and snippets.

View matthutchinson's full-sized avatar
🧐
`¯\_(ツ)_/¯`

Matthew Hutchinson matthutchinson

🧐
`¯\_(ツ)_/¯`
View GitHub Profile
```
What is your FreeAgent email? matthew.hutchinson@freeagent.com
==> Google OAuth 2 Setup
error: Did not recognize your adapter specification (incompatible library version - /Users/matt/.gem/ruby/2.6.3/gems/json-2.2.0/lib/json/ext/parser.bundle).
Traceback (most recent call last):
33: from /Users/matt/.gem/ruby/2.6.3/bin/devkit:23:in `<main>'
32: from /Users/matt/.gem/ruby/2.6.3/bin/devkit:23:in `load'
31: from /Users/matt/.gem/ruby/2.6.3/gems/freeagent-devkit-6.11.0/bin/devkit:64:in `<top (required)>'
@matthutchinson
matthutchinson / fzf_migrations
Last active June 12, 2018 08:33
Run rails migration commands via aliases with auto-completion for version numbers (via fzf)
#!/bin/bash
# TDLR; run rails migration commands via aliases with auto-completion for version numbers (via fzf)
#
# brew install fzf
# curl https://gist.githubusercontent.com/matthutchinson/6c1bc7681b323d4d2ef5d5a55626a5cf/raw/fzf_migrations > ~/.fzf_migrations
# source ~/.fzf_migrations
#
# Then run these commands to migrate:
#
#!/usr/bin/env ruby
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node = nil)
@value = value
@next_node = next_node
end
end
class HomeSerializer < ApplicationSerializer
def _links
{
order_volume_forecasts: { href: order_volume_forecasts_url }
slots: { href: slots_url },
micro_contracts: { href: micro_contracts_url }
}
end
end
@matthutchinson
matthutchinson / archive
Last active July 27, 2016 13:57
clone github repos and zip them
#!/bin/bash
filecontent=( `cat "repo_list" `)
for repo in "${filecontent[@]}"
do
echo $repo " - cloning ..."
git clone -q git@github.com:$repo
done
119006,15849,364397,"",""
287931,25665,1615619,"",""
249087,36798,1421176,"",""
131271,48647,1489200,"",""
207525,53651,1489200,"",""
207556,53812,1489200,"",""
207424,54991,1489200,"",""
243232,55069,1489200,"",""
182615,56985,1489200,"",""
92903,0,20326,"",""
@matthutchinson
matthutchinson / github-key.rb
Last active February 17, 2016 17:02
Send your SSH key to GitHub, with optional OTP auth
# install gems with;
# gem install io-console github_api --no-ri --no-rdoc
require 'github_api'
require 'io/console'
# Bypass annoying deprecation warning between the
# github_api gem and the faraday gem
Faraday::Builder = Faraday::RackBuilder
#!/usr/bin/env ruby
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
self.rank = rank
self.suit = suit
end
@matthutchinson
matthutchinson / thx.sh
Last active August 29, 2015 14:15
THX startup sound :)
# brew install sox
echo '(play -q -n synth sine F2 sine C3 remix - fade 0 4 .1 norm -4 bend 0.5,2399,2 fade 0 4.0 0.5 &)' >> ~/.bash_profile
# via https://twitter.com/climagic/status/467322823631831040
@matthutchinson
matthutchinson / poolsider
Created February 5, 2015 20:32
Grab all http://poolside.fm tracks from SoundCloud with this one weird trick!
#!/bin/sh -x
# no python3 (pip3) or curl? use this
# brew install python3 curl
# https://github.com/flyingrub/scdl
# pip3 install scdl
curl -s http://poolsideapi2.herokuapp.com/tracks?p=2 | grep -o '"scUrl": ".*",$' | sed -E 's/("scUrl": "|",.*$)//g' | xargs -I 'url' scdl -l url --hidewarnings