Skip to content

Instantly share code, notes, and snippets.

View mattjmorrison's full-sized avatar

Matthew J Morrison mattjmorrison

View GitHub Profile
https://prod.liveshare.vsengsaas.visualstudio.com/join?92958712B9BAD8E07882D1F7685402ECB840
https://prod.liveshare.vsengsaas.visualstudio.com/join?4295D7B6B11C30FC576B97E9DDFB3687E9ED
https://gist.github.com/AndreasChristianson/f5b4797ec1f55f1fbc6aa3b0533ef6c6
https://prod.liveshare.vsengsaas.visualstudio.com/join?0533C896A7153586E8B45F68144F59D100E6
@mattjmorrison
mattjmorrison / caps_lock.md
Last active February 26, 2025 14:56
Caps Lock

How to use Caps Lock as both Ctrl and Esc on OS X

  1. Get [Homebrew][homebrew]
  2. Get [Homebrew Cask][cask]
  3. Install Seil using brew cask install seil
  4. Install Karabiner using brew cask install karabiner
  5. Disable Caps Lock
    • Open System Preferences
    • Open Keyboard Preferences
  • On the Keyboard Tab click "Modifier Keys..."
@mattjmorrison
mattjmorrison / mixin.py
Created September 22, 2011 00:32
Python Mixin Recipe
# http://littletutorials.com/2008/06/23/inheritance-not-for-code-reuse/
def mixin(mixin_cls):
def mixin_decorator(cls):
if not hasattr(cls, '__mixed__'):
cls.__mixed__ = []
for name, val in mixin_cls.__dict__.items():
if not name.startswith('__') and not name.endswith('__'):
if not hasattr(cls, name):
setattr(cls, name, val)
@mattjmorrison
mattjmorrison / crop_and_resize.py
Created April 20, 2011 19:03
Resize and Crop images with Python and PIL
from PIL import Image, ImageChops
def trim(im, border):
bg = Image.new(im.mode, im.size, border)
diff = ImageChops.difference(im, bg)
bbox = diff.getbbox()
if bbox:
return im.crop(bbox)
def create_thumbnail(path, size):
@mattjmorrison
mattjmorrison / .vimrc
Last active August 1, 2020 14:28
Vimfiler Config
set nocompatible
if !1 | finish | endif
if has('vim_starting')
set nocompatible " Be iMproved
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
let neobundle_readme=expand($HOME.'/.vim/bundle/neobundle.vim/README.md')
if !filereadable(neobundle_readme)
silent !curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh
endif
@mattjmorrison
mattjmorrison / .gitignore
Last active January 3, 2019 15:33
Tool Instructions
.vagrant/
*.swp
@mattjmorrison
mattjmorrison / test_django_q.py
Created April 28, 2011 19:35
How to mock django's Q object
@patch('quote_options.models.LiabilityLimit.objects.filter')
@patch('quote.models.Q')
def should_filter_with_q_object_in_get_liability_limits(self, q_object, limit_filter):
manager_instance = Mock(spec=quote_models.LiabilityManager())
policy = mock.Mock()
q_instance = mock.Mock()
q_or_method = mock.Mock()
q_or_method.return_value = q_instance
q_instance.__or__ = q_or_method
@mattjmorrison
mattjmorrison / setup.sh
Created December 4, 2013 05:39
New imtapps macbook setup
curl https://raw.github.com/toranb/osx-workstation/master/installer | bash
git clone https://github.com/JarrodCTaylor/imt_dotfiles.git
cd ~/imt_dotfiles/Mac
bash symlink.sh