Skip to content

Instantly share code, notes, and snippets.

@micwehrle
micwehrle / index.html
Last active August 29, 2015 14:10 — forked from jfsiii/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;
@micwehrle
micwehrle / .gitignore
Created September 20, 2015 07:24
.gitignore Ignore all files inside direcotry except the directory and the .gitignore file
[^.]*
!.gitignore
@micwehrle
micwehrle / .git-completion.bash
Created September 25, 2015 15:47
Auto completion for git commandline
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@micwehrle
micwehrle / flashpolicy.xml
Created August 5, 2012 06:05 — forked from mattcg/flashpolicy.xml
A simple Flash socket policy server for NodeJS.
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for xmlsocket://socks.example.com -->
<cross-domain-policy>
<!-- This is a master socket policy file -->
<!-- No other socket policies on the host will be permitted -->
<site-control permitted-cross-domain-policies="master-only"/>
@micwehrle
micwehrle / remove-container-by-image.sh
Created November 16, 2015 04:08
Remove docker containers based on image name
#!/bin/bash
IMAGE=$1
docker ps -a | awk '{ print $1,$2 }' | grep $IMAGE | awk '{print $1 }' | xargs -I {} docker rm {}
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
.wrapper {
height: 100vh;
width: 100vw;
background-color: green;
}
@micwehrle
micwehrle / pre-commit.sh
Created October 24, 2017 03:57 — forked from dahjelle/pre-commit.sh
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done

Automatically Prepend a Jira Issue ID to Git Commit Messages

Use a git hook to match a Jira issue ID from the current branch, and prepend it to every commit message

Assuming the current branch contains a Jira issue ID, you can use a git hook script to prepend it to every commit message.

  1. Create an empty commit-msg git hook file, and make it executable. From your project's root directory:

     install -b -m 755 /dev/null .git/hooks/commit-msg
    
  2. Save the following script to the newly-created .git/hooks/commit-msg file:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Git autocomplete stuff. Nifty.
source ~/.git-completion.bash
# Aliases
alias pull='git fetch -v; git merge origin/`echo $(__git_ps1 "%s")`'
alias push='git push origin HEAD'
alias gits='git status'