This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// geo-location shim | |
// currentely only serves lat/long | |
// depends on jQuery | |
;(function(geolocation){ | |
if (geolocation) return; | |
var cache; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mmap import mmap | |
import struct | |
MMAP_OFFSET = 0x44c00000 # base address of registers | |
MMAP_SIZE = 0x48ffffff-MMAP_OFFSET # size of the register memory space | |
CM_PER_BASE = 0x44e00000 - MMAP_OFFSET | |
CM_PER_EPWMSS1_CLKCTRL = CM_PER_BASE + 0xcc | |
CM_PER_EPWMSS0_CLKCTRL = CM_PER_BASE + 0xd4 | |
CM_PER_EPWMSS2_CLKCTRL = CM_PER_BASE + 0xd8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Installs tarsnap client on Debian and Ubuntu | |
# | |
# You'll need to setup an account at | |
# http://www.tarsnap.com | |
# and load it with some funds | |
# | |
# Make sure you run this as root | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function st { | |
title=$1; | |
echo -e "\033];${title}\007"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// backbone.js continues to impress, I needed to get data from a jsonp api | |
// I really wanted to do this the "right" backbone.js way and create a model and call fetch. | |
// But the default backbone synch is not jsonp | |
// Turns out you can override a synch on a per model basis (thanks stackoverflow) | |
// whats nice is backbone.js continue to work as expected with the override | |
// here's a snippet (some changes to protect our privacy). An improvement could be to create a jsonp model class which MyModel inherits | |
// the synch function is most important below, that's what tells backbone it's jsonp | |
MyModel = Backbone.Model.extend({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted the script listed in the following link to maintain git history | |
# Original Script: http://snippets.dzone.com/posts/show/5449 | |
# Usage: | |
# 1) Copy the file to the root of your Rails app | |
# 2) Run the script (i.e., ruby to_haml.rb app/views) | |
class ToHaml | |
def initialize(path) | |
@path = path | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/ [\1$(parse_git_dirty)]/" | |
} | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color) color_prompt=yes;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href^="http"]').on 'click', (e) -> | |
e.preventDefault | |
_gaq.push(['_trackEvent', 'Outbound', 'click', this.href]) | |
callback = -> window.location = arguments[0] | |
setTimeout callback, 200, this.href |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.fn.hint = function (blurClass) { | |
if (!blurClass) { | |
blurClass = 'blur'; | |
} | |
return this.each(function () { | |
// get jQuery version of 'this' | |
var $input = jQuery(this), | |
// capture the rest of the variable to allow for reuse |
OlderNewer