For a much more elegant way, visit my blog.
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/bash | |
# Usage: license-audit [<project-dir>] | |
# | |
# Scans gems from the current project's bundle, Bower components and npm | |
# packages, and prints their license. | |
# | |
# Requires: | |
# - licensee >= 4.5.0 | |
# - ruby with Bundler (for Gemfiles) | |
set -e |
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
#!/usr/bin/env ruby | |
# for each git repo in a subdirectory ... | |
dirs = Dir['**/.git'].map { |gd| File.dirname(gd) } | |
def prompt | |
print ">> " | |
gets | |
end | |
# ... execute a command given on STDIN |
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
## gets the latest Twitter update from a user | |
require 'rubygems' | |
require 'json' | |
require 'yaml' | |
require 'open-uri' | |
CONFIG_FILE = ENV["HOME"] + "/.twitter" | |
CACHE_FILE = "/tmp/.#{ENV["LOGNAME"]}_TwitterAdium.txt" | |
DEFAULTS = { 'interval' => 300, 'limit' => 3 } | |
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
Xcode | |
http://developer.apple.com/technology/xcode.html | |
[OR] | |
Mac OS X install disc 2 | |
GNU wget | |
http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz | |
Git | |
http://code.google.com/p/git-osx-installer/ |
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
# nginx: redirect secondary domain names to primary | |
server { | |
listen 80; | |
server_name mislav.caboo.se mislavmarohnic.com mislavmarohnic.name mislav.name mislav.info mislav.biz; | |
# ... | |
if ($host != "mislav.caboo.se") { | |
rewrite .* http://mislav.caboo.se$uri permanent; | |
} |
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
require 'haml' | |
module ImplicitTags | |
ALLOWED_NESTING = { | |
'tr' => %w(table thead tbody tfoot), | |
'td' => 'tr', | |
'li' => %w(ul ol), | |
'col' => 'colgroup', | |
'dd' => 'dl', | |
'option' => %w(select optgroup), |
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
YouTubeModel::SingletonMethods.class_eval do | |
include WillPaginate::Finders::Base | |
protected | |
def wp_query(options, pager, args) | |
# dup options and set limit | |
args << options.merge(:max_results => pager.per_page) | |
# carefully add start_index (YouTube goes nuts if it's zero) | |
args.last[:start_index] = pager.offset if pager.offset > 0 |
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
## Capistrano "push strategy", take 2 | |
# | |
# It's based on "remote_cache", but doesn't rely on a central git repository. | |
# It assumes that the code is already pushed to its "cached-copy". | |
# | |
# Usage: | |
# | |
# git remote add origin example.com:/path/to/my-app/shared/cached-copy/.git | |
# cap deploy | |
# |
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
set -e | |
RE="ruby-enterprise-1.8.6-20090520" | |
PREFIX=/opt/$RE | |
VERSION=2.2.2 | |
GEM_PATH="$PREFIX/lib/ruby/gems/1.8/gems/passenger-$VERSION" | |
DOMAIN=example.com | |
APP_ROOT=/u/apps/$DOMAIN | |
# install Apache2 |