Skip to content

Instantly share code, notes, and snippets.

🔥
🚒

Tom Lord tom-lord

🔥
🚒
Block or report user

Report or block tom-lord

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@h3xx
h3xx / AuthUtility.php
Last active Aug 29, 2015
Bad Code for generating a "random" password
View AuthUtility.php
/**
* Generate a random alphanumeric password
* precondition: len must be <= 32
* param len: length of the random password
* param enforce_rules: enforce password security rules
* returns: the random password
**/
public static function generateRandomPassword($len=8, $enforce_rules = false)
{
$count = 0;
View get_completion
helper_method :get_completion
def get_completion(user)
if user.name
done = {}
comp = JSON.parse(user.completion)
if comp.length > 0
comp.each do |catkey,catval|
if catkey
done[catkey] = {}
if catval
View _README.md

What is this?

How do you compare date/times in RSpec?

If you do this

expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i
@JunichiIto
JunichiIto / alias_matchers.md
Last active Nov 21, 2019
List of alias matchers in RSpec 3
View alias_matchers.md

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@shime
shime / _README.md
Last active Apr 22, 2019
comparing dates and times in RSpec
View _README.md

What is this?

How do you compare date/times in RSpec?

If you do this

expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
You can’t perform that action at this time.