Skip to content

Instantly share code, notes, and snippets.

View alexmiddeleer's full-sized avatar

Alex Middeleer alexmiddeleer

  • Wolters Kluwer Health
  • Boston, MA
View GitHub Profile
@rafeca
rafeca / pre-commit.sh
Created November 30, 2012 12:39
Pre-commit hook to alert the committer before committing changes dangerous files. Save it in .git/hooks/pre-commit
#!/bin/sh
FILES="app/config/config.production.yaml\|app/config/application.production.yaml"
if [ "`git diff-index --cached HEAD | grep \"$FILES\"`" ]; then
exec < /dev/tty
echo "You are commiting changes to a live config file. Are you sure? [y/n] "
read -s -n 1 sure
@manasthakur
manasthakur / submodules.md
Last active November 15, 2023 17:58
Using git submodules to version-control Vim plugins

Using git-submodules to version-control Vim plugins

If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need. Thus, you should keep the .vim directory along with your .vimrc version-controlled.

But when you have plugins installed inside .vim/bundle (if you use pathogen), or inside .vim/pack (if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.

Creating the repository

Initialize a git repository inside your .vim directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:

cd ~/.vim
@tlrobinson
tlrobinson / visualize-stacking-contexts.js
Last active January 7, 2022 03:14 — forked from eoinkelly/visualize-stacking-contexts.js
Some console output to help you visualise stacking contexts on a page (no jquery)
/*
Usage:
* Paste this into your dev tools console (or even better as a snippet)
* It will parse the page and find all the things that create a new stacking context
and dump some info about them to the console. It will also outline them on the page.
* This is pretty rough and probably misses heaps of bugs and edge cases.
*/
function highlight(el) {