Skip to content

Instantly share code, notes, and snippets.

View madx's full-sized avatar

François Vaux madx

View GitHub Profile
@madx
madx / highlight_special_chars.vim
Last active December 22, 2015 00:09
Little Vim plugin to highlight some patterns in every language
" Highlight special chars
if exists("highlight_special_chars_loaded")
finish
endif
let highlight_special_chars_loaded = 1
highlight HscWhitespace ctermbg=1 ctermfg=7 guibg=#403c41 guifg=White
highlight HscError ctermbg=1 ctermfg=7 guibg=Red guifg=White
highlight HscWarn ctermbg=3 ctermfg=7 guibg=#ffb964 guifg=#605958
@madx
madx / ParameterizedSubjectBlocks.md
Last active December 20, 2015 06:39
Parameterized subject blocks for MiniTest

This is an example of writing parameterized subject blocks in MiniTest.

It also works with let declarations.

@madx
madx / .gitconfig
Last active August 3, 2022 10:09
Git aliases for a simple tag based Heroku deploy strategy
[alias]
deploy = ! git checkout master && git tag-deploy && git push && git push --tags && git push production master
deploy-staging = ! git checkout develop && git tag-deploy staging && git push && git push --tags && git push staging develop:master
tag-deploy = ! sh -c 'git tag "${0:-production}-`date +%Y%m%d%H%M%S`-$USER"'
var defineClass = function(classDefinition) {
var constructor = function() {
if ("initialize" in this) this.initialize(arguments)
}
if (classDefinition) classDefinition.call(constructor.prototype, constructor)
return constructor
}
@madx
madx / gist:5706650
Created June 4, 2013 15:09
Refresh Firefox from the command line
OLD_WID=`xdotool getactivewindow | head -1`
WID=`xdotool search --name "Mozilla Firefox" | head -1`
xdotool windowactivate $WID
xdotool key F5
xdotool windowactivate $OLD_WID
@madx
madx / .gitconfig
Created March 13, 2013 16:41
Speed up conflict resolution in Git!
[alias]
resolve = !sh -c 'git conflicts && $EDITOR $(git conflicts) +\"/<<<<\"'
conflicts = !sh -c 'git status -sb | grep ^UU | sed "s/UU\\ //"'
@madx
madx / ree-1.8.7-2012.02-tcmalloc-patch
Created March 6, 2013 14:06
Patched REE 1.8.7 install recipe for ruby-build
build_package_tcmalloc_patch() {
patch source/distro/google-perftools-1.7/src/tcmalloc.cc ~/.rbenv/plugins/ruby-build/share/ruby-build/tcmalloc.patch
}
require_gcc
install_package "ruby-enterprise-1.8.7-2012.02" "http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2012.02.tar.gz#8d086d2fe68a4c57ba76228e97fb3116" tcmalloc_patch ree_installer
pidenv() {
local pid="$1"
tr '\000' '\n' < /proc/$pid/environ
}
@madx
madx / mouse-selection.vim
Created February 6, 2013 13:16
Using Alt+Mouse for block selection and Shift+Mouse for line selection in Vim
" Block/Line selection with mouse
noremap <M-LeftMouse> <4-LeftMouse>
inoremap <M-LeftMouse> <4-LeftMouse>
onoremap <M-LeftMouse> <C-C><4-LeftMouse>
noremap <M-LeftDrag> <LeftDrag>
inoremap <M-LeftDrag> <LeftDrag>
onoremap <M-LeftDrag> <C-C><LeftDrag>
noremap <S-LeftMouse> <3-LeftMouse>
inoremap <S-LeftMouse> <3-LeftMouse>