Skip to content

Instantly share code, notes, and snippets.

# Prompt Setup
function minutes_since_last_commit {
now=`date +%s`
last_commit=`git log --pretty=format:'%at' -1`
seconds_since_last_commit=$((now-last_commit))
minutes_since_last_commit=$((seconds_since_last_commit/60))
echo $minutes_since_last_commit
}
@kennyp
kennyp / todo.vim
Created March 29, 2011 06:08
Find todos under current directory.
function! s:ToDoList ()
cclose
let task_list = []
for row in split(system('ack --column "(TODO|CHANGED|FIXME)"'), '\n')
let t = split(row, ':')
let task_dict = {'filename': t[0], 'lnum': t[1], 'col': t[2]}
let task_dict.text = substitute(join(t[3:-1]), '\s\+', ' ', '')
let task_list += [task_dict]
endfor
call setqflist(task_list, 'r')
function! s:JSLint ()
cclose
let out = system('jslint', join(getline(1, '$'), "\n"))
if out != "jslint: No problems found.\n"
let errors = split(out, '[^\n]\n[^\n]\zs')
let error_list = []
for e in errors
let thise = split(e, '|||')
let error_list += [{'filename': expand("%"), 'lnum': thise[0], 'col': thise[1], 'text': thise[2]}]
endfor
@kennyp
kennyp / .tmux.conf
Created March 8, 2012 19:41
My Tmux Config
# Use C-a for the prefix
set -g prefix C-a
bind C-a send-prefix
unbind C-b
# Make the delay a little shorter
set -sg escape-time 1
# Number windows starting with one
set -g base-index 1
@kennyp
kennyp / virtualhosts.conf
Created July 2, 2012 17:53
/etc/httpd/conf.d/
NameVirtualHost *:80
Include conf.d/vihosts.d/*.conf
<VirtualHost *:80>
ServerName cashier-dev.comporium.com
ServerAlias *
DocumentRoot /var/ww/cashier/current
DirectoryIndex index.php index.html
<Directory "/var/www/cashier/current">
@kennyp
kennyp / deploy.rb
Created July 6, 2012 02:08
Capistrano PHP
#################################################################
#################################################################
#
# This is a sample Capistrano deployment recpie for use with
# deploying PHP applications. For more information please visit:
#
# http://www.lengelzigich.com
# http://www.capify.org
@kennyp
kennyp / home.js
Created July 19, 2012 19:32
Main JS file for our setup?
/*jslint browser: true, regexp: true */
/*global define: false */
define(['require'], function (require) {
'use strict';
return {
init: function () {
}
};
@kennyp
kennyp / after.js
Created July 30, 2012 17:57
Pattern match or no?
JobQueue.prototype.nextJob = function () {
var that = this;
match(this.queue.shift(), {
'string': function (url) {
$.ajax(url, function () {
that.nextJob();
});
},
'function': function (callback) {
callback(function () {
@kennyp
kennyp / test.hs
Created July 31, 2012 19:39
Playing with SDL
module TestSDL where
import qualified Graphics.UI.SDL.General as SDLG
import Graphics.UI.SDL.Joystick (countAvailable, tryName)
main = do
SDLG.init [SDLG.InitJoystick]
name <- tryName 0
case name of
@kennyp
kennyp / diff.diff
Created August 9, 2012 16:23
Carzyness
diff --git a/themes/comporium/js/sales.js b/themes/comporium/js/sales.js
index 95e84f6..3c47286 100644
--- a/themes/comporium/js/sales.js
+++ b/themes/comporium/js/sales.js
@@ -201,10 +201,15 @@ var init = function ($, Complete, Cart, queue) {
this.registerEvents();
$('script[type="text/underscore-template"]').forEach(function (t) {
- var pn = $(t).parent(),
+ var parNo = t.parentNode,