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 parse_word(file) | |
buffer = "" | |
File.open(file, 'rb').each_line { |x| buffer = buffer + x + " " if x.include?(0.chr) } | |
return buffer.gsub!(/[^a-zA-Z0-9\s\,\.\-@\/\_]/, '').sub!(/[,\.\-\\\/@\_]/, ' ').split(' ') | |
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 'open-uri' | |
require 'erb' | |
# Build seperate config files for each db type | |
CONFIG_URLS = [:mysql, :oracle, :sqlite2, :sqlite3, :postgresql, :frontbase, :ibm_db] | |
BASE_URL = "http://github.com/rails/rails.git/railties/configs/databases/" | |
app_name = "app" | |
socket = false | |
CONFIG_URLS.each do |c| |
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
acceptedRegEx = "^[0-9]{0,3}[\.,]?[0-9]{0,2}$"; | |
... | |
input.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true); | |
... | |
private function handleTextInput(event:TextEvent):void { | |
var newText: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
public class ObjectUtils { | |
public static function mergeObjects(resultObject:Object, toMergeObject:Object):Object { | |
var setting:String; | |
for(setting in toMergeObject) | |
resultObject[setting] = toMergeObject[setting]; | |
return resultObject; | |
} | |
} |
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
mysql --database=db -B -N -e "SHOW TABLES" -u root | awk '{print "ALTER TABLE", $1, "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;"}' | mysql --database=db -u root |
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
find . -name .svn -print0 | xargs -0 rm -rf | |
find . -name .svn -exec 'rm -rf {}\;' | |
git init |
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
class Person | |
include ActiveModel::Validations | |
include ActiveModel::Conversion | |
extend ActiveModel::Naming | |
attr_accessor :first_name, :last_name | |
def persisted? | |
false | |
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
rvm install 1.9.2-head -C "--with-openssl-dir=$HOME/.rvm/usr --with-libyaml-dir=/opt/local --with-readline-dir=$HOME/.rvm/usr --with-iconv-dir=$HOME/.rvm/usr" |
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
function rvm_version { | |
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') | |
[ "$gemset" != "" ] && gemset="@$gemset" | |
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') | |
[ "$version" != "" ] && version="@$version" | |
local full="$version$gemset" | |
[ "$full" != "" ] && echo "$full " | |
} | |
export PS1="\$(rvm_version)$PS1" |
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
class HtmlEmailSanitizer < HTML::WhiteListSanitizer | |
self.allowed_tags = Set.new(%w(strong em b i p code pre tt samp kbd var sub | |
sup dfn cite big small address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr | |
acronym a img blockquote del ins html head body title)) | |
self.allowed_protocols = Set.new(%w(http https mailto cid)) | |
end |
OlderNewer