Skip to content

Instantly share code, notes, and snippets.

View joenoon's full-sized avatar

Joe Noon joenoon

  • SF Bay Area - San Ramon
View GitHub Profile
@joenoon
joenoon / gist:1247348
Created September 28, 2011 08:24
avoid deepening the javascript stack
// the biggest problem i've faced in "big" js apps (one-page RIAs, mobile and web)
// is the javascript stack. avoid diving deep as much as possible. basically
// a function that calls a function that calls a function within a loop is a
// really really bad idea. especially on mobile devices that typically don't have
// a stack limit as big as a normal browser.
var books = [
{ name: "A", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] },
{ name: "B", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] },
{ name: "C", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] },
@joenoon
joenoon / sass_asset_data_url_helper.rb
Created September 11, 2011 08:52
asset-data-url sass helper
# `asset-data-url` sass helper
# quick fix for: https://github.com/rails/sass-rails/pull/46
unless Sass::Script::Functions.method_defined?(:asset_data_url)
module Sass
module Extra
module Helpers
def asset_data_url(path)
data = context_asset_data_uri(path.value)
Sass::Script::String.new(%Q{url(#{data})})
@joenoon
joenoon / gist:1013595
Created June 8, 2011 01:21
quick hack to use vagrant's familiar chef-solo integration to provision a remote server instead of a vm
require 'rubygems'
require 'vagrant'
module Vagrant
class SSH
def rsync(opts={})
if Mario::Platform.windows?
raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,
:ssh_port => port(opts)
end
#!/usr/bin/env bash
set -e
ME=$0
SSH_USER=$1
HOST=$2
SSH_TO="$SSH_USER@$HOST"
PASSWORD="${PASSWORD:-chefchefchef}"
USE_SUDO="${USE_SUDO:-yes}"
#!/bin/bash
# Install VirtualBox Guest Additions
# (change ARCH and VERSION as needed)
# run it as root or with sudo
ARCH="x86"
VERSION="3.2.6"
FILE="VBoxGuestAdditions_${VERSION}.iso"
URL="http://download.virtualbox.org/virtualbox/${VERSION}/${FILE}"
cd /tmp
wget "$URL"