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
@places = [ | |
{:address=>'Dothan,AL',:description=>'Dothan is awesome'}, | |
{:address=>'Athens,GA',:description=>'Athens is awesome'}, | |
] |
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
[Tue Jan 13 11:59:12 2009] [notice] SELinux policy enabled; httpd running as context user_u:system_r:httpd_t:s0 | |
[Tue Jan 13 11:59:12 2009] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) | |
[ pid=12103 file=ApplicationPoolServer.h:535 time=01/13/09 11:59:12.771 ]: | |
*** WARNING: Could not create FIFO '/tmp/passenger_status.12103.fifo': Permission denied (13) | |
Disabling Passenger ApplicationPool status reporting. | |
[Tue Jan 13 11:59:12 2009] [error] *** Passenger could not be initialized because of this error: Could not connect to the ApplicationPool server: Connection reset by peer (104) | |
[Tue Jan 13 11:59:12 2009] [notice] Digest: generating secret for digest authentication ... | |
[Tue Jan 13 11:59:12 2009] [notice] Digest: done | |
[Tue Jan 13 11:59:12 2009] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads. | |
[ pid=12107 file=ApplicationPoolServer.h:535 time=01/13/09 11:59:12.870 ]: |
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 | |
if [[ -z $1 ]]; then | |
echo "Usage: $0 takes one argument, the project name." | |
exit 0 | |
else | |
project=`basename $1` | |
fi | |
action="cd /srv/websites/$project; sudo -S rake db:migrate" | |
echo $action |
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 | |
if [[ -z $1 ]]; then | |
echo "Usage: $0 takes one argument, the project name." | |
exit 0 | |
else | |
project=`basename $1` | |
fi | |
action="sudo mongrel_rails cluster::restart -C /etc/mongrel_cluster/$project.yml" |
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
def valid_phone | |
[self.home_phone, self.mobile_phone, self.work_phone].each do |phone| | |
if !phone.blank? | |
return phone | |
end | |
end | |
return '' | |
end |
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
# the solution is only this simple since the last row doesn't get padded to fill out the table | |
doc = Nokogiri::XML(open('http://manifesto.softwarecraftsmanship.org')) | |
puts doc.css("#signatory_table td").length |
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
// before: | |
bestScore = Math.max(bestScore, -minimax(child, depth - 1, otherPlayer); | |
// after: | |
otherPlayerScore = minimax(child, depth - 1, otherPlayer); | |
maxOtherPlayerScore = Math.max(otherPlayerScore, maxOtherPlayerScore); | |
bestScore = -maxOtherPlayerScore; |
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
(load "/Users/colin/lib/test-manager/load.scm") | |
(define (factor-list index product factors) | |
(cond ((< product 2) | |
'()) | |
((= 0 (modulo product index)) | |
(cons (cons index factors) (factor-list index (/ product index) factors))) | |
(else | |
(factor-list (+ index 1) product factors)))) | |
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
(load "/Users/colin/lib/test-manager/load.scm") | |
(define (is-proper-factor? product possible-factor) | |
(and | |
(not (= product possible-factor)) | |
(= 0 (modulo product possible-factor)))) | |
(define (has-proper-factors? product test-factor) | |
(and (> product test-factor) | |
(or |
OlderNewer