Skip to content

Instantly share code, notes, and snippets.

View danielmorrison's full-sized avatar

Daniel Morrison danielmorrison

View GitHub Profile
This is gist.
There are many like it, but this one is mine.
It is my life.
I must master it as I must master my life.
Without me gist is useless.
Without gist, I am useless.
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<%= stylesheet_link_tag 'boilerplate', 'main' %>
</head>
<body>
<div id="main">
<header>
<h1>
# just add a gem dependency for Timecop or require it yourself
Given 'the time is $time' do |time|
Timecop.freeze Time.parse(time)
end
When '$time pass' do |time|
Timecop.travel future_time(time)
Given 'delayed jobs are run' # we use delayed jobs and have some that get scheduled in the future.
end
When /I see wtf is going on/i do
save_and_open_page
end
When /I want to debug/i do
debugger
true # never put debugger at the end of a method
end
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<%= stylesheet_link_tag 'boilerplate', 'main' %>
<%= javascript_include_tag :defaults %>
<!--[if IE]>
<%= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js' %>
<![endif]-->
</head>
require 'test/unit'
require 'book'
class BookTest < Test::Unit::TestCase
def setup
@book = Book.new
end
def test_should_capitalize_the_first_letter
<!DOCTYPE html>
<html lang="en">
<head>
<title>eHarbor</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'application', :media => "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
@danielmorrison
danielmorrison / gist:671304
Last active September 24, 2015 04:57
put inside auctions/new.html.erb
<% if form.object.errors.any? %>
<div id="error_explanation">
<h2>The following errors prohibited this form from being saved:</h2>
<ul>
<% form.object.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
@danielmorrison
danielmorrison / user_steps.rb
Created November 12, 2010 18:17
put in features/step_definitions/user_steps.rb
Given "I am signed in" do
user = User.create!(:email => '[email protected]', :password => 'password', :password_confirmation => 'password')
step 'I go to the homepage'
step 'I follow "Sign In"'
step %Q|I fill in "user_email" with "#{user.email}"|
step 'I fill in "user_password" with "password"'
step 'I press "Sign in"'
end
def csrf_meta_tags
if protect_against_forgery?
[].tap do |tags|
tags << tag('meta', {:name => 'csrf-param', :content => request_forgery_protection_token})
tags << tag('meta', {:name => 'csrf-token', :content => form_authenticity_token})
end.join("\n").html_safe
end
end