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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
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
winston.loggers.add('application', { | |
console: { | |
level: 'silly', | |
colorize: true | |
}, | |
file: { | |
level: 'info', | |
filename: path.join(__dirname, 'logs/tmp.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
def num_zeroes_in_fact(n:int):int | |
count = 0 | |
pow = 1 | |
while (Math.pow(5,pow) <= n) | |
den = Math.pow(5,pow) | |
add = n/den | |
count = count + add | |
pow += 1 | |
end | |
count |
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
.rvm/gems/ruby-1.9.3-p125@ww/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault | |
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0] | |
Command terminated |
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
class EmailValidator < ActiveModel::EachValidator | |
# http://fightingforalostcause.net/misc/2006/compare-email-regex.php | |
# Thanks to James Watts and Francisco Jose Martin Moreno | |
EMAIL_REGEX = /^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i | |
def validate_each(object,attribute,value) | |
if value.blank? | |
object.errors[attribute] << (options[:message] || "can't be blank") unless options[:allow_blank] | |
elsif !(value =~ EMAIL_REGEX) | |
object.errors[attribute] << (options[:message] || "is not a valid email address") |