Skip to content

Instantly share code, notes, and snippets.

View airblade's full-sized avatar

Andy Stewart airblade

View GitHub Profile
@airblade
airblade / gist:10651609
Last active February 20, 2018 22:57
Vim testing frameworks

In no particular order:

  • vroom

    • uses vim as a server
    • implemented in python
    • tests written in custom syntax
  • vimrunner

    • uses vim as a server
  • implemented in ruby

@airblade
airblade / karabiner.json
Last active January 18, 2018 17:24
Karabiner-Elements
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@airblade
airblade / export.rb
Created January 8, 2018 15:34
Exports Photos.app v1.5 albums and their photos to plain directories and files.
#!/usr/bin/env ruby
# Exports albums and their photos to plain directories and files.
#
# Built for Photos.app v1.5 on OS X 10.11.6.
#
# See also:
# https://github.com/koraktor/gallerist
#
# TODO:
@airblade
airblade / private.xml
Last active November 30, 2017 10:14
Karabiner (not Karabiner-Elements)
<?xml version="1.0"?>
<root>
<item>
<name>Change Plus-minus key</name>
<appendix>Plusminus to underscore</appendix>
<identifier>private.plusminus_to_underscore_r</identifier>
<autogen>
__KeyToKey__
KeyCode::UK_SECTION, ModifierFlag::SHIFT_R,
@airblade
airblade / prepare-commit-msg
Created November 3, 2014 14:57
Git prepare-commit-msg hook to extract issue number from branch name and append to commit message.
#!/bin/bash
# Adds reference to GitHub issue if available in branch name.
# The issue number should be at the end of the branch name, following
# a hyphen.
# Only proceed if no second parameter is given to the script.
if [ x = x${2} ]; then
branch=$(git symbolic-ref --short HEAD)
if [[ $branch =~ .*-([0-9]+)$ ]]; then
==== start log session ====
0.000024 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
0.000024 cd /Users/cody && (git ls-files --error-unmatch .vimrc && (git -c "diff.autorefreshindex=0" diff --no-ext-diff --no-color -U0 -- .vimrc | grep --color=never -e '^@@ ' || exit 0))
==== start log session ====
0.000042 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
@airblade
airblade / shuffle.vim
Last active May 13, 2016 11:02
Shuffle a list in VimL
" Shuffles list in place.
function! Shuffle(list)
" Fisher-Yates-Durstenfeld-Knuth
let n = len(a:list)
for i in range(0, n-2)
let j = Random(0, n-i-1)
let e = a:list[i]
let a:list[i] = a:list[i+j]
let a:list[i+j] = e
endfor
@airblade
airblade / gist:2988937
Created June 25, 2012 14:21
Monkey-patch enabling Rails 2.3 to use SMTP over SSL
# config/initializers/email.rb
# Monkey-patch to enable ActionMailer to send STMP email over SSL.
# Necessitated by Fastmail mandating SSL by 30 June 2012.
module ActionMailer
class Base
def perform_delivery_smtp(mail)
destinations = mail.destinations
mail.ready_to_send
@airblade
airblade / private.xml
Created January 6, 2016 15:02
Change § key to # via Karabiner
<?xml version="1.0"?>
<root>
<item>
<name>Change Section key</name>
<appendix>Section to Hash</appendix>
<identifier>private.section_to_hash</identifier>
<autogen>
__KeyToKey__
KeyCode::DANISH_DOLLAR,
@airblade
airblade / private.xml
Created August 8, 2013 09:50
Easier access to umlauts and sharp-s on OSX using KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>Easier umlauts</name>
<appendix>Use left-control + vowel</appendix>
<identifier>private.easier_umlauts</identifier>
<autogen>
__KeyToKey__
KeyCode::A, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L,