Skip to content

Instantly share code, notes, and snippets.

View Willianvdv's full-sized avatar
🚩

Willian van der Velde Willianvdv

🚩
View GitHub Profile
Spree::Admin::ProductsController.class_eval do
set_callback :load_collection, :after, :show_nothing
private
def show_nothing
@collection = @collection.where '0=1'
end
end
@Willianvdv
Willianvdv / gist:6ecb6537c4cd9b88ab58
Created July 1, 2014 11:45
Execute remote task with Capistrano 3
# Usage: bundle exec cap staging execute:rake task=db:migrate
namespace :execute do
task :rake do
on roles(:all) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, "exec rake #{ENV['task']}"
end
end
end
@Willianvdv
Willianvdv / gist:b5d2fac813ec5397b1f0
Created September 15, 2014 21:44
Elastic search config
network.host: 127.0.0.1
http.host: 127.0.0.1
@Willianvdv
Willianvdv / capybara cheat sheet
Created December 11, 2018 10:15 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=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')
def Organizer(c)=c.select{_1=~/^(?!tom)\w{5}/}
# Modify the solution above. Emojis are free.
# Code below will check correctness.
example_collection = [
'apples',
33,
nil,
'hat',
'tomatoes',