most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
function nestCollection(model, attributeName, nestedCollection) { | |
//setup nested references | |
for (var i = 0; i < nestedCollection.length; i++) { | |
model.attributes[attributeName][i] = nestedCollection.at(i).attributes; | |
} | |
//create empty arrays if none | |
nestedCollection.bind('add', function (initiative) { | |
if (!model.get(attributeName)) { | |
model.attributes[attributeName] = []; |
(function(){ | |
function isFileReady ( readyState ) { | |
// Check to see if any of the ways a file can be ready are available as properties on the file's element | |
return ( ! readyState || readyState == 'loaded' || readyState == 'complete' ); | |
} | |
var p = document.getElementsByTagName('script'), | |
p = p[p.length-1]; | |
" Ctags (patch): http://designtomarkup.com/vim/taglist-ctags-css-patch | |
" Tagbar : https://github.com/majutsushi/tagbar | |
" Screenshot : http://twitpic.com/7zq4d7 | |
"Tagbar | |
noremap <silent> <Leader>t :<C-u>TagbarToggle<CR> | |
let g:tagbar_type_css = { | |
\ 'ctagstype' : 'Css', | |
\ 'kinds' : [ |
var page = new WebPage(), | |
address, output, size; | |
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs | |
capture = function(targetFile, clipRect) { | |
var previousClipRect; | |
var clipRect = {top: 0, left:0, width: 40, height: 40}; | |
if (clipRect) { | |
if (!isType(clipRect, "object")) { | |
throw new Error("clipRect must be an Object instance."); |
source 'http://rubygems.org' | |
gem 'rails3-jquery-autocomplete' |
By default, Rails applications build URLs based on the primary key -- the id
column from the database. Imagine we have a Person
model and associated controller. We have a person record for Bob Martin
that has id
number 6
. The URL for his show page would be:
/people/6
But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6
here, is called the "slug". Let's look at a few ways to implement better slugs.
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence | |
" http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users | |
if exists('$TMUX') | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif |