Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️

Nathan L Smith smith

🕶️
View GitHub Profile
View backbone_view.js
/*
* Refs
*
* http://documentcloud.github.com/backbone/
* http://msdn.microsoft.com/en-us/scriptjunkie/hh377172.aspx
* http://arturadib.com/hello-backbonejs/
* http://stackoverflow.com/questions/5629972/integrating-json-feed-with-backbone-js
* http://stackoverflow.com/questions/6048480/backbone-js-fetch-problem-cant-refresh-data-immediately
* http://documentcloud.github.com/backbone/docs/todos.html
*
@smith
smith / gist:959081
Created May 6, 2011 — forked from jtimberman/gist:881058
i can has ruby-1.9.2 package with fpm
View gist:959081
# Commands to build a .deb with ruby 1.9.2
apt-get install libssl-dev
gem install fpm
cd /usr/src
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar -zxvf ruby-1.9.2-p180.tar.gz
cd ruby-1.9.2-p180
./configure --prefix=/usr && make && make install DESTDIR=/tmp/installdir
cd ..
# This builds the package. Replace x86_64 with i386 or the arch you're building
View screening.js
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
View screening.js
// 1: how could you rewrite the following to make it shorter?
foo ? bar.doSomething(el) : bar.doSomethingElse(el);
// 2: what is the faulty logic in the following code?
var foo = 'hello';
(function() {
View dropbox_backup.sh
size=`rsync --delete --delete-excluded -pthrv --exclude-from \
/Users/paul/.backup/exclude /Users/paul/Documents/ \
/Users/paul/Dropbox | egrep -o "total size is (.*)G" | egrep -o "[0-9\.]+"`
if [ "$size" = "" ]; then
size=0
fi
if [ `echo "$size < 1.8" | bc` = 0 ]; then
echo "`date`: WARNING: Size is running out for Dropbox backups.\
(Currently using ${size} GB.)" 1>&2
View Toggle_Submit_Button.js
// Toggle Input Submit based on whether
// there are ANY input fields showing
function toggleInputSubmit() {
var dis, showit = false;
$$(".tag, .field a").each(function (el) {
el.observe("click", function (event) {
$$(".field").each(function (f) {
dis = f.getStyle("display");
if (dis !== "none") {
View commonjs-package-json.vim
" File: commonjs-package-json
" Author: Ash Berlin <ash.berlin@gmail.com>
" Last Change: 23-Feb-2010.
" Version: 1.1
" Usage:
"
" Use by placing something like the following in your .vimrc:
"
" let g:maintainer='{ "name": "Ash Berlin", "web": "http://ashberlin.com" }'
"
View Capistrano runing chunks of shell commands.rb
# Helper to execute blocks of shell commands via capistrano run
def run_chunk(cmd,options={})
run cmd.split("\n").map {|l| l.strip }.join(" "), options
end
# Example
task :revision, :roles => [:app] do
run_chunk %Q{
rm -f #{current_release}/public/REVISION;cp #{current_release}/REVISION #{current_release}/public/REVISION;
cd #{current_release}; git config --list | grep branch\.deploy >> #{current_release}/public/REVISION;