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
# | |
# Recurring Job using Delayed::Job | |
# | |
# Setup Your job the "plain-old" DJ (perform) way, include this module | |
# and Your handler will re-schedule itself every time it succeeds. | |
# | |
# Sample : | |
# | |
# class MyJob | |
# include Delayed::ScheduledJob |
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
mysqldump --user=username --password --default-character-set=latin1 --skip-set-charset dbname > dump.sql | |
sed 's/latin1/utf8/g' dump.sql > dump_utf.sql | |
mysql --user=username --password --execute="DROP DATABASE dbname; CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;" | |
mysql --user=username --password --default-character-set=utf8 dbname < dump_utf.sql |
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
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |
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
html, body, .document, #aspnetForm { height: 100%; } | |
.document { display: table; } | |
html.ie7 .document { height: auto; min-height: 100%; } |
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
property pth : (path to preferences folder from local domain) as text | |
property d1name : "WD My Book" | |
property d1 : "com.apple.TimeMachine RF9.plist" | |
property d2name : "AirDisk" | |
property d2 : "com.apple.TimeMachine Home.plist" | |
property active : "com.apple.TimeMachine.plist" |
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
# 2010-10-01 | |
# | |
# Mac OS X 10.6.3 | |
# Homebrew 0.7 | |
# Xcode 3.2.4 | |
# Git 1.7.3.1 | |
# RVM 1.0.12 | |
# Ruby 1.8.7, 1.9.2 | |
# Passenger 2.2.15 | |
# MySQL 5.1.49 |
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
Sets.updateTitle(collection.name, collection.icon); | |
// Sets.highlightActive(link); |
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
<?php | |
$filepath = dirname(__FILE__) . "your_xml_file.xml"; | |
$contents = file_get_contents($filepath); | |
$elements = @new SimpleXmlElement($contents); | |
# do somethings with the elements | |
print_r($elements); | |
?> |
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
# | |
# TextMate command to copy an url to the current file (with line & column) | |
# Input: None | |
# Output "Show as Tool Tip" | |
# | |
url="txmt://open?url=file://$TM_FILEPATH&line=$TM_LINE_NUMBER&column=$TM_COLUMN_NUMBER" | |
echo -n "$url" | pbcopy | |
echo "Copied $url" |
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
Element.addMethods({ | |
getValueOrHTML: function(element) { | |
element = $(element); | |
var tagName = element.tagName.toLowerCase(); | |
if (tagName === 'input') | |
return element.getValue(); | |
else if (tagName === 'form') | |
return element.readAttribute('action'); | |
else |