This file contains hidden or 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
# Rails template for Rails 2.3. Work in progress. | |
# By Henrik Nyh (http://henrik.nyh.se) 2009-03-29. Public domain. | |
# Usage: rails myapp -m http://gist.github.com/87341.txt | |
META_AUTHOR = "Henrik Nyh (http://henrik.nyh.se)" | |
JQUERY_VERSION = "1.3.2" | |
APP_NAME = File.basename(Dir.pwd) | |
git :init |
This file contains hidden or 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
# Rails template for Rails 2.3. Work in progress. | |
# By Henrik Nyh (http://henrik.nyh.se) 2009-03-29. Public domain. | |
# Usage: rails myapp -m http://gist.github.com/87341.txt | |
META_AUTHOR = "Henrik Nyh (http://henrik.nyh.se)" | |
JQUERY_VERSION = "1.3.2" | |
APP_NAME = File.basename(Dir.pwd) | |
git :init |
This file contains hidden or 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
# A library for downloading issues of Harpers from the archives. | |
# | |
# To use, log in to the archives from your web browser. Then set the | |
# HARPERS_ARCHIVE_COOKIE environment variable to the value of the .harpers.org | |
# "archive" cookie, which you can find by visiting the following URL while on | |
# the Harpers website: | |
# | |
# javascript:prompt("HARPERS_ARCHIVE_COOKIE",document.cookie.match(/(?:;|^)\s*archive=(.+?)(?:;|$)/)[1]) | |
# | |
# Example: |
This file contains hidden or 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
(* | |
Open a new tab in Safari (and move focus to the URL bar) | |
I have this configured as a Quicksilver trigger for ctrl+alt+T | |
*) | |
tell application "Safari" to activate | |
tell application "System Events" | |
tell process "Safari" | |
click menu item "New Tab" of menu "File" of menu bar 1 | |
end tell |
This file contains hidden or 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
# Create a ~/.twitter/credentials.yml file. | |
# Example: | |
# name: twittername | |
# password: password | |
require 'rubygems' | |
require 'rest_client' | |
path = File.join(File.join(ENV['HOME'], ".twitter"), "credentials.yml") | |
user = YAML::load_file(path) |
This file contains hidden or 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
function background(iterator, produceNextValue, callbacks) { | |
var value = {}, hasValue = produceNextValue(value); | |
callbacks = callbacks || Object.extend([], { | |
after: function(callback) { | |
this.push(callback); | |
return this; | |
} | |
}); | |
if (hasValue) { |
This file contains hidden or 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
daily | |
missingok | |
rotate 30 | |
compress | |
delaycompress | |
sharedscripts | |
/Users/deploy/Sites/rails.example.com/shared/log/*.log { | |
postrotate | |
touch /Users/deploy/Sites/rails.example.com/current/tmp/restart.txt |
This file contains hidden or 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
/** | |
* Format any UTC timestamp on the page to the users local timezone. | |
*/ | |
var DateFormat = { | |
autoParse: function(){ | |
$$('span.timestamp').each(function(span) { | |
var utc = Date.parseUTC(span.innerHTML); | |
var rel = span.getAttribute('rel'); | |
span.update(rel == 'words' ? utc.timeAgoInWords() : utc.strftime(rel)) | |
}); |
This file contains hidden or 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
# Generator for valid Swedish personnummer: http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden) | |
# By Henrik Nyh <http://henrik.nyh.se> 2009-01-29 under the MIT license. | |
require 'date' | |
def make_pnr(date=nil, serial=nil) | |
date ||= Date.new(1900+rand(100), 1+rand(12), 1+rand(28)) | |
serial = serial ? serial.to_s : format("%03d", rand(999)+1) # 001-999 | |
date_part = date.strftime('%y%m%d') |