Skip to content

Instantly share code, notes, and snippets.

Avatar
👾
Pushing keys

Matthew Hutchinson matthutchinson

👾
Pushing keys
View GitHub Profile
View .envrc
#!/usr/bin/env bash
set -e
# load default envrc
source_up
# auto-switch rubies
use chruby --auto
# node from ~/.nvmrc
View vim help.md

Vim Help

Forgotten shortcuts and mappings

Insert Mode

Ctrl+w Delete word backwards Ctrl+n Ctrl+p Autocomplete word from next found forward or backward in file CTRL+xl Autocomplete entire line (must start with same chars) CTRL+xl Autocomplete to a local file path

View gist:4d5b7eb19508122fcca894b6f033c554
```
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 Jun 12, 2018
Run rails migration commands via aliases with auto-completion for version numbers (via fzf)
View fzf_migrations
#!/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:
#
View linked_list_with_stack_azat.rb
#!/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
View home_serializer.rb
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 Jul 27, 2016
clone github repos and zip them
View archive
#!/bin/bash
filecontent=( `cat "repo_list" `)
for repo in "${filecontent[@]}"
do
echo $repo " - cloning ..."
git clone -q git@github.com:$repo
done
View gist:a876f5b246c12a5d9c66
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 Feb 17, 2016
Send your SSH key to GitHub, with optional OTP auth
View github-key.rb
# 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
View deck.rb
#!/usr/bin/env ruby
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
self.rank = rank
self.suit = suit
end