Skip to content

Instantly share code, notes, and snippets.

👨‍🏫
Teaching

Luiz Picolo ツ luizpicolo

👨‍🏫
Teaching
Block or report user

Report or block luizpicolo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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')
View kaminari.pt-BR.yml
#encoding: utf-8
pt-BR:
views:
pagination:
first: "« Primeira"
last: "Última »"
previous: "‹ Anterior"
next: "Próxima ›"
truncate: "…"
View gist:dbdff3ce8149798b265b
desc "Rolls back the latest release"
task :rollback => :environment do
queue! %[echo "-----> Rolling back to previous release for instance: #{domain}"]
# Delete existing sym link and create a new symlink pointing to the previous release
queue %[echo -n "-----> Creating new symlink from the previous release: "]
queue %[ls "#{deploy_to}/releases" -Art | sort | tail -n 2 | head -n 1]
queue! %[ls -Art "#{deploy_to}/releases" | sort | tail -n 2 | head -n 1 | xargs -I active ln -nfs "#{deploy_to}/releases/active" "#{deploy_to}/current"]
# Remove latest release folder (active release)
View capybara.md

Capybara

save_and_open_page

Matchers

have_button(locator)
View deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
# Repository project
set :repository, 'git@bitbucket.org:agencia-w3case/boletinonline.git'
# Server Production
task :production do
View gist:89dfa140bd185449fd39
def parent_params
params.require(:parent).permit(
:name, :rg, :cpf, :birth_date, :avatar, {:student_ids => []},
:user_attributes => [:email, :password, :password_confirmation]
)
end
View 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')
View rspec_rails_cheetsheet.rb
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)
View railscasts.rb
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@luizpicolo
luizpicolo / responsive_likebox.html
Last active Aug 29, 2015
Responsive Facebook Like Box
View responsive_likebox.html
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container" style="width:100%;">
<div class="fb-like-box" data-href="https://www.facebook.com/adobegocreate" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>
</div>
You can’t perform that action at this time.