Skip to content

Instantly share code, notes, and snippets.

link_to
image_tag
link_to image_tag(“rails.png”, alt: “Rails logo”), “#”
<%= debug(params) if Rails.env.development %>
Because we used theimage_tag helper in Listing 5.2, Rails will automatically find any images in theapp/assets/images/ directory using the asset pipeline (Section 5.2).
```ruby
assert_no_difference 'User.count' do
post users_path, user: { name: "",
email: "user@invalid",
password: "foo",
password_confirmation: "bar" }
end
```
Here we’ve included the params[:user] hash expected by User.new in the create action (Listing 7.24). By wrapping the post in the assert_no_difference method with the string argument ’User.count’, we arrange for a comparison between User.count before and after the contents of the assert_no_difference block. This is equivalent to recording the user count, posting the data, and verifying that the count is the same:
```ruby
user && user.authenticate(:password)
```
flash.now, which is specifically designed for displaying flash messages on rendered pages. Unlike the contents of flash, the contents of flash.now disappear as soon as there is an additional request,
# This scripts merges subtitles (if present) and transcodes video files
# to H.264 mp4 video files with similar quality level.
# This will be applied to all video files found under the directory passed
# as an argument to the script or the current working directory otherwise.
# The script will also check if the ffmpeg binaries are present and located
# in unrestricted directory. It will also check for the presence of fonts
# configuration file and copy it to the right place if they are absent.
#
# This code is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
@rocLv
rocLv / README.md
Created February 27, 2016 14:50 — forked from karmadude/README.md
San Francisco Contours
@rocLv
rocLv / index.html
Created May 1, 2016 02:31 — forked from anonymous/index.html
JS Bin redex react todo list example add todo // source http://jsbin.com/wivuyi
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="redex react todo list example add todo">
<script src="https://fb.me/react-0.14.7.min.js"></script>
<script src="https://fb.me/react-dom-0.14.7.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
@rocLv
rocLv / index.html
Created May 2, 2016 04:48 — forked from anonymous/index.html
JS Bin redux react todo list example <filter todos> // source http://jsbin.com/gigihur
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="redux react todo list example <filter todos>">
<script src="https://fb.me/react-0.14.7.min.js"></script>
<script src="https://fb.me/react-dom-0.14.7.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.0.4/redux.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
@rocLv
rocLv / awesome_report_test.rb
Created June 12, 2016 11:26 — forked from sideshowcoder/awesome_report_test.rb
Helper for testing rake tasks in rails using minitest.
require 'test_helper'
# testing rake task app:awesome_report
# defined in file lib/tasks/app/awesome_report.rake
describe 'App::AwesomeReportTaskTest' do
it 'generates the awesomeness report' do
subject.invoke
assert File.exists?('awesomeness_report.csv')
end
@rocLv
rocLv / country-code-to-currency-code-mapping.csv
Created June 17, 2016 09:55 — forked from HarishChaudhari/country-code-to-currency-code-mapping.csv
Country, Country Code, Currency code mapping in CSV format Taken from https://gist.github.com/304261 Contains 249 countries.
Country CountryCode Currency Code
New Zealand NZ New Zealand Dollars NZD
Cook Islands CK New Zealand Dollars NZD
Niue NU New Zealand Dollars NZD
Pitcairn PN New Zealand Dollars NZD
Tokelau TK New Zealand Dollars NZD
Australian AU Australian Dollars AUD
Christmas Island CX Australian Dollars AUD
Cocos (Keeling) Islands CC Australian Dollars AUD
Heard and Mc Donald Islands HM Australian Dollars AUD