Skip to content

Instantly share code, notes, and snippets.

Avatar
👾
Pushing keys

Matthew Hutchinson matthutchinson

👾
Pushing keys
View GitHub Profile
View gocardless_get_country_codes.rb
@companies = []
@company_ids = {}
GocardlessSettings.where.not(oauth_access_token: nil).all.each do |settings|
begin
pro = FreeagentGocardlessPro.new(settings.company)
records = pro.send(:client).creditors.list.records.map(&:country_code)
codes = records.map(&:country_code)
if codes.present? && codes.uniq != ["GB"]
@companies << "Company ID: #{settings.company_id} #{codes.uniq.join(", ")}"
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 keybase.md

Keybase proof

I hereby claim:

  • I am matthutchinson on github.
  • I am matthutchinson (https://keybase.io/matthutchinson) on keybase.
  • I have a public key ASAlmD84I8ALwQE6E17On0NCEVtzMgPtq3ZgtwBtDvG1NAo

To claim this, I am signing this object:

View .vimrc
" set this first (avoid use of -N for vi compatibility)
set nocompatible
" tip, write file and fire command into a Tmux window
" :map ,t :w\|:Tmux xcodebuild -scheme videosnap build && /u/code/videosnap/build/products/Debug/videosnap -v<cr>
" :map ,t :w\|:call SendToTmux("ruby ".expand('%')."\n")<cr>
" or just write file, compile and run it (no Tmux)
" :map ,t :w\|:!gcc % -o ./string_reverser; ./string_reverser<CR>
" plugins via Plug - https://github.com/junegunn/vim-plug
You can’t perform that action at this time.