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
// PasswordValidation.js Tyler Montgomery 3/17/09 | |
// Used to validate a password as you type | |
// Password requires length > 5, numbers, letters, and special characters | |
// Uses prototype.js to update color of password form_field and password_status html element (I use a span) | |
function specials(password){ | |
var specials = !!password.match(/([\@\#\$\&\!\)\(\-\+\=\^])/) | |
return specials | |
} |
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
# Sets up the Rails environment for Cucumber | |
ENV["RAILS_ENV"] = ENV["CI_ENV"] || "test" | |
ENV["DETACH"] = "true" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/rails/world' | |
require 'cucumber/formatters/unicode' # Comment out this line if you don't want Cucumber Unicode support | |
Cucumber::Rails.use_transactional_fixtures | |
require Ci::Sentiment.path("spec", "data", "spec_data") | |
Ci::Sentiment::SpecData.populate |
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
require 'nokogiri' | |
require 'open-uri' | |
def geocode(address_str) | |
# html escape address_str | |
res = Nokogiri::XML(open("http://maps.google.com/maps/geo?q=#{address_str}&output=xml&key=&oe=utf-8")) | |
status = res.search("code").inner_html | |
coords = res.search("coordinates").inner_html.split(",")[0,2] if status == "200" | |
coords << res.search("address").inner_html if status == "200" | |
return coords |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<kml xmlns="http://earth.google.com/kml/2.0"> | |
<Response> | |
<name>1535 pearl st boulder co</name> | |
<Status> | |
<code>200</code> | |
<request>geocode</request> | |
</Status> | |
<Placemark id="p1"> | |
<address>1535 Pearl St, Boulder, CO 80302, USA</address> |
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
require 'twitter' | |
require 'pp' | |
puts 'User', '*'*50 | |
pp Twitter.user('ubermajestix') | |
# {"profile_sidebar_fill_color"=>"ffffff", | |
# "name"=>"Tyler Montgomery", | |
# "status"=> | |
# {"truncated"=>false, |
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
require 'twitter' | |
followers = Twitter.follower_ids('ubermajestix') | |
# => [14073663, 6128392, 6164712, 1438261, 14601522, 15399388, 15446607, 1565501, 9483652, 6272722, 14480362, 6083342, 11582182, 16834727, 16855010, 17429985, 17238404, 14630648, 14522630, 17905197, 16420441, 16857468, 3670341, 5931692, 14381877, 17875219, 6112572, 17241396, 8233892, 18220106, 16582309, 7989792, 4576911, 823615, 15062875, 4374531, 17994702, 16731468, 16797616, 17632945, 5907052, 16474612, 15347089, 12687402, 9980812, 14232173, 13776662, 9667272, 2783151, 14595846, 11738792, 52593, 6319982, 10578, 15626165, 18251154, 15042927, 6655322, 18205144, 6258202, 722793, 8946242, 15695130, 16808886, 17285454, 17218325, 17496502, 1169451, 14217249, 19412819, 19376035, 15730969, 19405541, 19403888, 19696781, 6148812, 18929813, 20076186, 18083235, 20160224, 20121547, 20535356, 4380901, 9808812, 16027073, 20618001, 20727178, 13024992, 20540031, 15220688, 19417951, 7495882, 15301151, 21404171, 21420758, 11046582, 717233, 713263, 15007939, 2 |
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
function specials(password){ | |
var specials = !!password.match(/([\@\#\$\&\!\)\(\-\+\=\^])/) | |
return specials | |
} | |
function letters(password){ | |
var letters = !!password.match(/([a-z]|[A-Z])/) | |
return letters | |
} | |
function numbers(password){ | |
var numbers = !!password.match(/^(?=.*[0-9])/) |
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
# think this is what's fucking us: | |
next if request.path_info =~ %r!/events/[^/]{36}! | |
unless session[:user_id] | |
session[:return_to] = request.path_info | |
throw(:halt, [302, {'Location' => '/about'}, '']) | |
end |
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
require 'rubygems' | |
require 'logging' | |
# only show "info" or higher messages on STDOUT using the Basic layout | |
Logging.appenders.stdout(:level => :info) | |
# send all log events to the development log (including debug) as JSON | |
Logging.appenders.rolling_file( | |
'development.log', | |
:age => 'daily', |
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
module SomeModule | |
class << self | |
def initialize(opts={}) | |
logger.info "Initializing SomeModule" | |
@environment = opts.delete(:environment) | |
logger.info "environment: #{@environment}" | |
establish_database_connection | |
end |