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
# make rails 1.2.x work with Ruby >= 1.8.7 | |
unless '1.9'.respond_to?(:force_encoding) | |
String.class_eval do | |
begin | |
remove_method :chars | |
rescue NameError | |
# OK | |
end | |
end | |
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
# or simply: | |
'foobar'.tr 'A-Za-z','N-ZA-Mn-za-m' | |
# rot(x) | |
class String | |
def rot(num = 13) | |
return self.split("").collect { |ch| | |
if /^[a-z]$/ === ch | |
((ch[0] + num - 'a'[0]) % 26 + 'a'[0]).chr |
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
# via http://www.viget.com/extend/html-sanitization-in-rails-that-actually-works | |
# | |
# $Id: sanitize.rb 3 2005-04-05 12:51:14Z dwight $ | |
# | |
# Copyright (c) 2005 Dwight Shih | |
# A derived work of the Perl version: | |
# Copyright (c) 2002 Brad Choate, bradchoate.com | |
# | |
# Permission is hereby granted, free of charge, to | |
# any person obtaining a copy of this software and |
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/sh | |
# | |
# This file echoes a bunch of color codes to the | |
# terminal to demonstrate what's available. Each | |
# line is the color code of one forground color, | |
# out of 17 (default + 16 escapes), followed by a | |
# test use of that color on all nine background | |
# colors (default + 8 escapes). | |
# |
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/sh | |
# Creates a self-signed certificate and configuration files for | |
# rails-SSL-development (with Apache/Passenger) | |
# !!! Important !!! | |
# Some files will be created and deleted in the current working directory | |
# perhaps it is a good idea to execute this in a dedicated tmp-dir. | |
# see the instructions this scripts echos on howto integrate into your system |
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 | |
# File : s3-post-commit.rb | |
# Description : A program to create svn backups using the | |
# Amazons S3 storage service | |
# Copyright : (c) 2007 Maximilian Schoefmann | |
# License : MIT, see the file MIT-LICENSE | |
# Modified : Richard Woeber | |
# | |
# Usage | |
# copty to svnserver:/path/to/svnrepo/hooks/post-commit and change the following constants |
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
# by courtesy of | |
# - http://www.slashdotdash.net/2007/12/03/rails-2-upgrade-notes/ | |
# - http://marklunds.com/articles/one/409 | |
MOVE_COMMAND = "git mv" | |
desc "Checks your app and gently warns you if you are using deprecated code." | |
task :deprecated => :environment do | |
deprecated = { | |
'@params' => 'Use params[] instead', |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.mongodb.mongod</string> | |
<key>UserName</key> | |
<string>mongod</string> | |
<key>GroupName</key> | |
<string>mongod</string> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.postgresql.dbms</string> | |
<key>UserName</key> | |
<string>postgres</string> | |
<key>GroupName</key> | |
<string>postgres</string> |
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
# Solution to PragProg Magazine 8 Quiz | |
# (added Comment into the first line) | |
quiz8 = %q{ | |
-- Vqnbg nm qhg | |
qstgq xhmtunsm Vqneg(uvlu) | |
qstgq wvojsmov = "" | |
qstgq hovw = ouwnmc.hjjvw(uvlu) | |
qstgq hovwSwnc = hovw | |
-- wgmrsfqk ovqvtuvr wvjqnvo nx ms avkiswro |
OlderNewer