This file contains 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
<BrowserRouter> | |
<div> | |
<Match exactly pattern="/google" component={() => window.location = 'http://google.com'} /> | |
<Match pattern="/store/:storeId" component={App} /> | |
<Miss component={NotFound} /> | |
</div> | |
</BrowserRouter> |
This file contains 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 create | |
if @thing.save | |
redirect_to thing_form_path(@thing), notice: "You saved the thing!" | |
else | |
flash[:error] = @thing.errors.full_messages.to_sentence | |
render :new | |
end | |
end |
This file contains 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 ReportCardMailer < ActionMailer | |
def report(user) | |
@user = user | |
@report_card = user.report_cards.last | |
options = { | |
to: @user.email, | |
from: "[email protected]", | |
subject: "Your Report Card for "@report_card.report_start_time.strftime("%b %d, %Y")" to |
This file contains 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
<!-- Rails flash messages styled for Zurb Foundation. --> | |
<!-- Activate with flash.message = "X", flash.alert = "Y" --> | |
<% flash.each do |name, msg| %> | |
<% if msg.is_a?(String) %> | |
<div data-alert style="text-align" class="alert-box <%= name.to_s == 'notice' ? 'success' : 'alert' %>"> | |
<%= content_tag :div, msg %> | |
<a href="#" class="close">×</a> | |
</div> | |
<% end %> | |
<% end %> |
This file contains 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
<head> | |
<!-- other stuff in your site header like javascript or whatever above here --> | |
<meta name="twitter:card" content="summary_large_image"> | |
<meta name="twitter:site" content="@your_twitter_handle"> | |
<meta name="twitter:creator" content="@your_twitter_handle"> | |
<!-- hardcoding an image here so I don't have to worry about attaching an image to each blog post in the future --> | |
This file contains 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 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
========================================================= | |
I am a subscriber | |
I want to view full articles | |
So that I can get convenient access to the news | |
--------------------------------------------------------- | |
Subscriber Acceptance Requirements: | |
-Subscriber logs in system recognizes him as a subscriber allows full access to articles | |
========================================================= | |
I am a non-subscriber | |
I want to preview the article and be able to subscribe |
This file contains 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
User Stories HW | |
"As a ______, I want to _____ so I can _____." | |
As any visitor, I want to see orderly article layout so I can decide what to read. | |
As a premium subscriber, I want to easily see the premium so I can feel like I am getting my moneys worth. | |
As a premium subscriber, I want to see fewer ads so I can concentrate on and enjoy the content I paid for. | |
As a free visitor, I want to see prominent "membership" opportunities so I can become a paying member if I decide. |
This file contains 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
chris@luna ~ (master*) $ telnet localhost 8080 | |
Trying 127.0.0.1... | |
Connected to localhost. | |
Escape character is '^]'. | |
GET /?name=Chris HTTP/1.0 | |
HTTP/1.1 200 OK | |
Content-Type: text/html | |
Server: WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10) | |
Date: Sat, 13 Apr 2013 00:07:11 GMT |