A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
/* | |
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. | |
*/ |
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: |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme", | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"use_simple_full_screen": false, |
curl [url] -F '[param_name]=@[file_path];type=[mime-type]' -F '[other_params](optional)' |
<!--[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/" /> |
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 |
$(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(); | |
} | |
}); |
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 |
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
(function($) { | |
$.xpath = function(exp, ctxt) { | |
var item, coll = [], | |
result = document.evaluate(exp, ctxt || document, null, 5, null); | |
while (item = result.iterateNext()) | |
coll.push(item); | |
return $(coll); | |
} |