Skip to content

Instantly share code, notes, and snippets.

View trkoch's full-sized avatar

Tristan Koch trkoch

View GitHub Profile
@trkoch
trkoch / RegExp
Created October 7, 2010 06:37
# Find lists in reST (e.g. to fix them)
(\*\s.*\n){2,}
@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
#!/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 / .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
@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 / 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 / .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 / Vagrantfile
Last active August 29, 2015 14:02
Vagrantfile for ubuntu/trusty with Ansible provisioning
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "rbconfig"
require "fileutils"
VAGRANTFILE_API_VERSION = "2"
# Customize
PROJECT = "app"
@trkoch
trkoch / template.rb
Last active August 29, 2015 14:02
Rails Application Template (rSpec, Capybara, Poltergeist, FactoryGirl)
remove_file("test")
gem_group :development, :test do
gem "rspec-rails", "~> 3.0.0"
gem "spring-commands-rspec"
gem "factory_girl_rails", "~> 4.0"
gem "pry-rails"
gem "pry-byebug"
gem "pry-stack_explorer"
gem "pry-rescue"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.hostname = "modx"