Skip to content

Instantly share code, notes, and snippets.

View bswinnerton's full-sized avatar

Brooks Swinnerton bswinnerton

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bswinnerton on github.
  • I am bswinnerton (https://keybase.io/bswinnerton) on keybase.
  • I have a public key whose fingerprint is B157 7B86 DC69 A3D1 AA57 3178 7274 3B7D E552 E25A

To claim this, I am signing this object:

@bswinnerton
bswinnerton / git-commit-editor.vim
Created February 18, 2017 15:39 — forked from aroben/git-commit-editor.vim
Vim script to show git commit diff in vertical split while writing commit messages
" Put this in your .vimrc and whenever you `git commit` you'll see the diff of your commit next to your commit message.
" For the most accurate diffs, use `git config --global commit.verbose true`
" BufRead seems more appropriate here but for some reason the final `wincmd p` doesn't work if we do that.
autocmd VimEnter COMMIT_EDITMSG call OpenCommitMessageDiff()
function OpenCommitMessageDiff()
" Save the contents of the z register
let old_z = getreg("z")
let old_z_type = getregtype("z")
module SerializableAttributes
extend ActiveSupport::Concern
included do
class << self
attr_reader :serializable_column
end
before_save :update_serializable_column
require 'jwt'
require 'warden'
class JWTStrategy < Warden::Strategies::Base
# All of the below constants would be defined in a configuration initializer
ENCRYPTION_ALGORITHM = 'HS256'
RETRIEVE_USER = Proc.new { |guid| User.find_by(user_guid: guid) }
SHARED_SECRET = 'kittens'
USER_IDENTIFIER_CLAIM = 'guid'
################################################################################
# On Authorization Server #
################################################################################
require 'jwt'
SHARED_SECRET = 'kittens'
SIGNING_ALGORITHM = 'HS256'
# User has authenticated: we know who they are
################################################################################
# On Authorization Server #
################################################################################
require 'openssl'
require 'jwt'
SIGNING_ALGORITHM = 'RS256'
KEY = OpenSSL::PKey::RSA.generate(2048)
MATCH (user)--(connection)
WHERE user:FacebookAccount OR user:GeneralAssemblyAccount
AND user.user_id = 246
RETURN user, connection;
# Toto, we're not in Kansas anymore.
#
# This singleton is used to deeply convert all instances of a String into a
# Symbol given an Array, Hash, or a lonesome String.
module Symbolizer
def self.deep_symbolize(object)
case object
when Array
deep_symbolize_array(object)
when Hash
@bswinnerton
bswinnerton / README.md
Last active August 29, 2015 14:21
Google Maps partial for Rails

Google Maps partial for Rails

In your view:

app/views/cats/index.html.erb

<%= render 'map', collection: @cats %>
sudo apt-get update
sudo apt-get upgrade
exit
sudo apt-get install build-essential git-core curl vim
curl -sSL https://get.rvm.io | bash -s stable --ruby
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
sudo apt-get install zsh
rm -rf ~/.oh-my-zsh/
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
chsh `which zsh`