Skip to content

Instantly share code, notes, and snippets.

View trkoch's full-sized avatar

Tristan Koch trkoch

View GitHub Profile
@trkoch
trkoch / .tmux.conf
Created May 21, 2014 16:41
Basic tmux config
# Inherit current path in new window
bind-key c new-window -c "#{pane_current_path}"
# Enable mouse scrolling
set-window-option -g mode-mouse on
# Remap window navigation to vim
unbind-key j
bind-key j select-pane -D
unbind-key k
@trkoch
trkoch / model.js
Last active August 29, 2015 13:57
Simple file upload from script (e.g. Backbone model) for modern browsers supporting FormData and XMLHttpRequest Level 2
/*
* Update field of a server-side resource expecting a file.
*
* Backbone's default JSON serialization does not cover file objects. Make sure to trigger this
* method after the user has selected a file.
*
* *srcAttr*: Attribute holding file handle provided by input[type=file], e.g. 'selectedImage'
* *targetAttr*: Attribute on server-side expecting a file, e.g. 'image'
*/
upload: function (srcAttr, targetAttr) {
@trkoch
trkoch / java.yml
Created February 18, 2014 11:17
Install Oracle Java 7 with Ansible
- name: Java | add java repository
apt_repository: repo='ppa:webupd8team/java'
- name: Java | auto accept license
action: shell echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
- name: Java | install Java 7
action: apt pkg=oracle-java7-installer state=installed update-cache=yes
- name: Java | set env
@trkoch
trkoch / .vimrc
Last active December 15, 2015 15:28
Basic vim config: curl -L http://git.io/kochvim > .vimrc
" Basic
syntax on
set nocompatible
set encoding=utf-8
set vb
" Buffers and windows
set hidden
set autoread
set shortmess+=IA
#!/bin/bash
# hashapass.com based method for generating passwords
#
# Based on script by Simon Elmir
#
if ! args=$(getopt -o s -l silent -- "$@")
then
exit 1
fi
@trkoch
trkoch / sass-vs-less.md
Created October 14, 2011 12:49
SASS vs. LESS

SASS vs. LESS

What they have in common

SASS (.scss) and LESS share most of the features. The syntax is very similiar.

Key Features:

  • Variables
  • Nesting
@trkoch
trkoch / RegExp
Created October 7, 2010 06:37
# Find lists in reST (e.g. to fix them)
(\*\s.*\n){2,}