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
def convert_to_duration(fixnum) | |
min = (fixnum / 60).to_s.rjust(2, '0') | |
sec = (fixnum % 60).to_s.rjust(2, '0') | |
"00:#{min}:#{sec}" | |
end | |
(1.minute..30.minutes).step(30).collect { |s| convert_to_duration(s) } | |
# 00:01:00 | |
# 00:01:30 |
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
# supposed to be Dash — | |
Hpricot("<p>Dash —</p>").to_plain_text | |
# => "Dash ?" | |
# would like text to convert to | |
#'Dash -' |
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_DEFAULT_LOGGER.debug(caller.join("\n")) if defined? SOME CONSTANT |
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
$ ruby -v | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9] | |
$ rails -v | |
Rails 2.3.0 | |
$ rails testo | |
$ cd testo | |
$ ./script/generate model user name:string | |
$ rake db:migrate | |
$ rake test |
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
# needed to install mysql gem (wasn't bundled in rails 2.2 anymore) | |
sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5/mysql/ --with-mysql-lib=/opt/local/lib/mysql5/mysql/ --with-mysql-config=/opt/local/bin/mysql_config5 |
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
#!/bin/bash | |
# | |
# An example hook script for the post-receive event | |
# | |
# This script is run after receive-pack has accepted a pack and the | |
# repository has been updated. It is passed arguments in through stdin | |
# in the form | |
# <oldrev> <newrev> <refname> | |
# For example: | |
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master |
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
<?php | |
function markup_list($data, $path, $use_links = true) { // can handle 1 or 2d array | |
// array_flip($columns); | |
$output .= "<div class=\"classlist\">\n"; | |
foreach ($data as $var => $val) { | |
$target_kv = explode("=", $var); // break up compound string into key/value | |
if ($use_links) { | |
$output .= '<p><a href="'.$path.'?'.$target_kv[0].'='.$target_kv[1].'">'.$target_kv[1]."</a></p>\n"; | |
} |
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
#!/bin/sh | |
# Clean up whitespace in any modified files. | |
if git-rev-parse --verify HEAD > /dev/null | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
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
gem install passenger | |
passenger-install-apache2-module | |
sed -i 's/passenger-2\.2\.4/passenger-2\.2\.7/g' /etc/apache2/conf.d/passenger.conf | |
apache2ctl restart | |
tail /var/log/apache2/error.log |
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
git update-index --assume-unchanged <filename> |
OlderNewer