Skip to content

Instantly share code, notes, and snippets.

View perryqh's full-sized avatar

Perry Hertler perryqh

View GitHub Profile
caches_page:index, :planet_redpoint
def expire_cache
expire_page :action => :index
expire_page :action => :planet_redpoint
end
*/10 * * * * /usr/bin/curl http://feedpoint.hertler.org/home/expire_cache
Scenario: Show Secret
Given a user exists with username: "myuser", password: "secret", password_confirmation: "secret"
And a secret exists with user: the user
And the user is logged in with myuser/secret
When I go to the show page for that secret
Then I should see the secret
Then /^I should see the secret$/ do
secret = model('secret')
response.should contain(secret.title)
response.should contain(secret.user_name)
response.should contain(secret.url)
response.should contain(secret.label)
end
when /the show page for (.+)/
polymorphic_path(model($1))
module UserHelpers
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.user
end
require 'generate_password'
generate_password = PwFoo::GeneratePassword.new(12, PwFoo::GeneratePassword.LOWER_CASE, PwFoo::GeneratePassword.UPPER_CASE, PwFoo::GeneratePassword.NUMBERS, PwFoo::GeneratePassword.SPECIALS )
my_new_password = generate_password.generate_with_min_strength 80
# get ready to generate passwords of length *12* with lower case letters and numbers
generate_password = PwFoo::GeneratePassword.new(12, PwFoo::GeneratePassword.LOWER_CASE, PwFoo::GeneratePassword.NUMBERS )
# generate password with a minimum strength score of 80
my_new_password = generate_password.generate_with_min_strength 80
# generate password with a minimum strength score of 100
my_new_password = generate_password.generate_with_min_strength 100
my_pw = 'secret'
my_pw_score = PwFoo::PasswordStrength.new.calculate_score(my_pw)
# = srand_seed_generator.rb - Random seed generator uses the system time and currently running processes to generate a highly random seed.
#
# Perry Hertler mailto:[email protected]
#
# == Example
#
# my_seed = PwFoo::SrandSeedGenerator.new.get_next_seed
module PwFoo
require 'digest/md5'