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
<?php | |
add_action( 'after_setup_theme', 'bootstrap_setup' ); | |
if ( ! function_exists( 'bootstrap_setup' ) ): | |
function bootstrap_setup(){ | |
add_action( 'init', 'register_menu' ); | |
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
/(youtu(?:\.be|be\.com)\/(?:.*v(?:\/|=)|(?:.*\/)?)([\w'-]+))/i | |
Tested examples: | |
http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo | |
http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel | |
http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub | |
http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I | |
http://www.youtube.com/user/SilkRoadTheatre#p/a/u/2/6dwqZw0j_jY | |
http://youtu.be/6dwqZw0j_jY | |
http://www.youtube.com/watch?v=6dwqZw0j_jY&feature=youtu.be |
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
View | |
<%= form_for image do |f| %> | |
<%= link_to "Pick File", "#", class: 'filepicker' %> | |
<%= f.hidden_field :remote_url %> | |
<%= f.hidden_field :filepicker_url %> | |
<%= f.hidden_field :attachment_file_size %> | |
<%= f.hidden_field :attachment_file_name %> | |
<%= f.hidden_field :attachment_content_type %> | |
<% 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 UserCreator | |
def initialize(listener) | |
@listener = listener | |
end | |
def create(attributes) | |
user = User.new(attributes) | |
if user.save | |
# send email |
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
# put this in your staging.rb file. Obviously you'll need more config than this it's just an example. | |
Rails.application.configure do | |
config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil | |
config.autoload_paths += [config.action_mailer.preview_path] | |
routes.append do | |
get '/rails/mailers' => "rails/mailers#index" | |
get '/rails/mailers/*path' => "rails/mailers#preview" | |
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
# coding: utf-8 | |
require 'rubygems' | |
require 'hpricot' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'safe_yaml' | |
require 'time' | |
require 'uri' | |
require 'open-uri' |