Skip to content

Instantly share code, notes, and snippets.

View shkm's full-sized avatar
😵‍💫
Stumbling through life, one exception at a time.

Jamie Schembri shkm

😵‍💫
Stumbling through life, one exception at a time.
View GitHub Profile
@shkm
shkm / README.md
Last active August 27, 2015 07:58
Sets up some tmux basics.

Mappings

Panes

M-\ -- Horizontal split
M-| -- Vertical split
M-= -- Even out splits horizontally
M-+ -- Even out splits vertically
C-h -- Move to left split
C-j -- Move to lower split
C-k -- Move to upper split

@shkm
shkm / private.xml
Last active August 29, 2015 14:06
Hook up MPD (MPC) to work with the CM Storm Ninja (And Filcos?) in Karabiner.
<?xml version="1.0"?>
<root>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_SHELL_mpc_playpause</name>
<url type="shell">
<![CDATA[
MPC=/usr/local/bin/mpc
if $MPC status | grep -q 'playing'
then
@shkm
shkm / some_spec.rb
Created September 12, 2014 19:10
Get text of the main describe block in RSpec. Useful for rendering views with locals.
describe 'shared/some_partial.html.erb' do
before(:all) { layout = self.class.metadata[:description] }
# ...
end
@shkm
shkm / CSGO Scripts
Last active August 29, 2015 14:13
Quick and dirty AHK scripts to set monitor preferences and toggle Dolby audio (for virtual surround sound). Assumes multiple monitors, Display Color being pinned as the first item.
We couldn’t find that file to show.
@shkm
shkm / .zshrc
Last active August 29, 2015 14:25
Suspend or halt all running Vagrant boxes.
# Suspend
vsall() {
vagrant global-status --prune | grep running | awk '{system("vagrant suspend "$1)}'
}
# Halt
vhall() {
vagrant global-status --prune | grep running | awk '{system("vagrant halt "$1)}'
}
@shkm
shkm / gist:1821866
Created February 14, 2012 00:29
Pixel-based Dock Resizing in OS X
defaults write com.apple.dock tilesize -int <SizeInPixels> && killall Dock
@shkm
shkm / gist:1821872
Created February 14, 2012 00:30
Add Seperator to Dock in OS X
defaults write com.apple.dock persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }' && killall Dock
@shkm
shkm / register_post_type.sublime-snippet
Created May 3, 2012 16:49 — forked from ninnypants/cpt.sublime-snippet
register_post_type snippet for Sublime Text 2
<snippet>
<content><![CDATA[
register_post_type('${1:slug}', array(
${2:'labels' => array(
${3:'name' => _x( '${4:Plural Name}', '${5:translation context}', '${6:translation domain}' ),}
${8:'singular_name' => _x( '${9:Singular Name}', '${10:translation context}', '${6:translation domain}' ),}
${11:'add_new' => _x( '${12:Add new}', '$9', '${6:translation domain}' ),}
${13:'add_new_item' => __( '$12 $9', '${6:translation domain}' ),}
${14:'edit_item' => __( 'Edit ${15:$9}', '${6:translation domain}' ),}
${16:'new_item' => __( 'New ${17:$9}', '${6:translation domain}' ),}
@shkm
shkm / ValidatingModel.php
Last active December 16, 2015 12:19
Laravel self-validating model. Child models need only extend `getRules()` and return their own rules array. Loosely based on Jeffrey Way's (https://tutsplus.com/lesson/validating-with-models-and-event-listeners/).
<?php
abstract class ValidatingModel extends \Eloquent
{
public $errors;
public static function boot()
{
parent::boot();
@shkm
shkm / mirror.exclude
Last active December 17, 2015 01:49
Bootable OS X backups with rsync. Based on Nicolas Gallagher's script (http://nicolasgallagher.com/mac-osx-bootable-backup-drive-with-rsync/).
- .Spotlight-*/
- .Trashes
- .DocumentRevisions-*/
- /.dbfseventsd
- .fseventsd/
- /tmp/*
- /Network/*
- /cores/*
- /afs/*
- /automount/*