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
| =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') |
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 'date' | |
| # Actually doesn't matter WHAT you choose as the epoch, it | |
| # won't change the algorithm. Just don't change it after you | |
| # have cached computed scores. Choose something before your first | |
| # post to avoid annoying negative numbers. Choose something close | |
| # to your first post to keep the numbers smaller. This is, I think, | |
| # reddit's own epoch. | |
| $our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time |
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
| 'use strict'; | |
| /**************************************** | |
| * Chapter 3 Exercises: Functions | |
| ***************************************** | |
| #EXERCISE 1: Minimum | |
| The previous chapter introduced the standard function Math.min that returns | |
| its smallest argument. We can do that ourselves now. Write a function min that |
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
| if ( !class_exists( 'HijackMe' ) ) { | |
| class HijackMe { | |
| public function hijack_menu($objects) { | |
| /** | |
| * If user isn't logged in, we return the link as normal | |
| */ | |
| if ( !is_user_logged_in() ) { | |
| return $objects; | |
| } | |
| /** |
NewerOlder