A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
$(document).mouseup(function (e) | |
{ | |
var container = $("YOUR CONTAINER SELECTOR"); | |
if (!container.is(e.target) // if the target of the click isn't the container... | |
&& container.has(e.target).length === 0) // ... nor a descendant of the container | |
{ | |
container.hide(); | |
} | |
}); |
require "rvm/capistrano" # Load RVM's capistrano plugin. | |
require "bundler/capistrano" | |
set :rvm_ruby_string, '1.9.3' | |
set :rvm_type, :user # Literal ":user" | |
set :application, "blog_test" | |
set :repository, "[email protected]:ryancheung/blog.git" | |
set :scm, :git |
<!--[if IE]> | |
<meta http-equiv="refresh" content="0;url=http://www.google.com/chrome/" /> | |
<![endif]--> | |
/[if IE] | |
<meta http-equiv="refresh" content="0;url=http://www.google.com/chrome/" /> |
curl [url] -F '[param_name]=@[file_path];type=[mime-type]' -F '[other_params](optional)' |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme", | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"use_simple_full_screen": false, |
Each YouTube video has 4 generated images. They are predictably formatted as follows: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg | |
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is: | |
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg | |
For the high quality version of the thumbnail use a url similar to this: |
/* | |
jQuery pub/sub plugin by Peter Higgins ([email protected]) | |
Loosely based on Dojo publish/subscribe API, limited in scope. Rewritten blindly. | |
Original is (c) Dojo Foundation 2004-2010. Released under either AFL or new BSD, see: | |
http://dojofoundation.org/license for more information. | |
*/ |
def options_from_collection_for_select_with_data(collection, value_method, text_method, selected = nil, data = {}) | |
options = collection.map do |element| | |
[element.send(text_method), element.send(value_method), data.map do |k, v| | |
{"data-#{k}" => element.send(v)} | |
end | |
].flatten | |
end | |
selected, disabled = extract_selected_and_disabled(selected) | |
select_deselect = {} | |
select_deselect[:selected] = extract_values_from_collection(collection, value_method, selected) |