Skip to content

Instantly share code, notes, and snippets.

View thisivan's full-sized avatar

Ivan Torres thisivan

View GitHub Profile
@koshigoe
koshigoe / mount-ram.sh
Created February 11, 2011 14:57
Like tmpfs in Mac OSX
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@scottwb
scottwb / assets.rake
Created January 28, 2011 06:08
Rake task to rebuild all JS/CSS assets with Compass/Jammit, including workaround for the bugs within.
namespace :assets do
task :rebuild do
# Config the base names of all the jammit CSS packages you have defined
# in assets.yml. Could probably parse assets.yml to get this if
# we wanted to.
packages = ['common']
# This is because on OS X, you have to put an explicit empty string to the
# required extension argument with the -i parameter, but on Linux you
# do not.
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))