Skip to content

Instantly share code, notes, and snippets.

@stilist
stilist / Default (OSX).sublime-keymap
Last active October 6, 2015 15:18
Sublime Text 2 preferences
[
// Drawn from http://www.sublimetext.com/forum/viewtopic.php?f=2&t=7477#p31755
// Kills the annoying default of cmd-left jumping to the start of a line's
// code, rather than column 0.
{ "keys": ["super+left"], "command": "move_to", "args": {"to": "hardbol", "extend": false} },
{ "keys": ["super+right"], "command": "move_to", "args": {"to": "hardeol", "extend": false} }
]
@stilist
stilist / console-log.sublime-snippet
Created July 16, 2012 22:59
console.log snippet for Sublime Text 2
<!-- save to ~/Library/Application Support/Sublime Text 2/Packages/User -->
<snippet>
<content><![CDATA[console.log($1);$0]]></content>
<tabTrigger>log</tabTrigger>
<scope>source.html,source.javascript</scope>
</snippet>
@stilist
stilist / gist:3179287
Created July 25, 2012 23:17
.bash_profile
export SHELL=/bin/bash
# system paths
export PATH=/usr/local/bin:/bin:/usr/sbin:/sbin:$HOME/bin:$PATH
# MySQL
export PATH="/usr/local/mysql/bin:$PATH"
# node.js
export NODE_PATH="$HOME/local/node:$HOME/local/node/lib/node_modules"
@stilist
stilist / gist:3752151
Created September 19, 2012 20:45
If you’re ever curious about your setTimeout calls…
var oldTimeout = setTimeout;
window.setTimeout = function(callback, timeout) {
var date = new Date();
console.log(("** " + timeout + "ms"), callback);
oldTimeout(function() { callback(); }, timeout);
}
@stilist
stilist / .bash_profile
Last active October 13, 2015 10:08
Bash stuff!
export EDITOR=nano
# http://git-blame.blogspot.com/2012/02/anticipating-git-1710.html
export GIT_MERGE_AUTOEDIT=no
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
###############################################################################
@stilist
stilist / .bash_profile
Last active October 13, 2015 12:58
Natural-language git commands
# [...]
function parse_git_branch () {
local git_status="`git status -unormal 2>&1`"
# fatal: Not a git repository (or any of the parent directories): .git
if [[ $git_status == fatal* ]] ; then
echo ""
# On branch master
#
require 'sinatra'
require 'action_mailer'
class Mailer < ActionMailer::Base
def contact
mail(
:to => "[email protected]",
:from => "[email protected]",
:subject => "Test") do |format|
format.text
@stilist
stilist / sinatra_json_api.rb
Last active December 10, 2015 06:18
How I run Backbone.js applications on Sinatra.
require "sinatra/base"
module Sinatra
# = Sinatra::JsonApi
#
# <tt>Sinatra::JsonApi</tt> is an extension meant for use with Backbone-style
# apps that use the backend strictly as an API. It assumes that full page
# loads should serve only to bootstrap the frontend application.
#
# == Usage
@stilist
stilist / Gemfile
Last active December 15, 2015 06:49
Flickr backup script
source "https://rubygems.org"
ruby "1.9.3"
gem "flickraw"
@stilist
stilist / .bash_profile
Last active December 24, 2015 06:29
`bundle exec rake` shorthand
function be () {
bundle exec $@
}
function ber () {
bundle exec rake $@
}