# Anchor
click_link 'Save'
# Button
click_button 'awesome'
# Both above
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
require 'sinatra' | |
require 'mongoid' | |
require 'json' | |
require "sinatra/reloader" if development? | |
Mongoid.load!("mongoid.yml") | |
class Price | |
include Mongoid::Document |
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
This is what I would do to backup my old database and restore | |
To back up your database | |
pg_dump --format=c olddb_name > db_dump_file.dump | |
To restore that backup | |
pg_restore -v -d newdb_name db_dump_file.dump | |
Read more on pg_dump and pg_restore |
YARD CHEATSHEET http://yardoc.org
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
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
# install pyhton via brew | |
brew install python3 | |
# Install pip | |
# https://pip.pypa.io/en/stable/installing/ | |
python3 get-pip.py | |
# install virtual env | |
pip install virtualenv |
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
# We have to remove validations on email, as it's no longer needed. | |
# Based on a solution found at http://stackoverflow.com/questions/7545938/how-to-remove-validation-using-instance-eval-clause-in-rails | |
Model.class_eval do | |
_validators.reject!{ |key, _| key == :field } | |
_validate_callbacks.each do |callback| | |
callback.raw_filter.attributes.delete :field | |
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
# Alterar sequencia | |
ALTER SEQUENCE content_builders_id_seq RESTART WITH 37178; |
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
#!/usr/bin/env ruby | |
require "openssl" | |
require "time" | |
begin | |
require "origami" | |
rescue LoadError | |
abort "origami not installed: gem install origami" | |
end |
** Create the plugin without test-unit and specify the path for the dummy application:
rails plugin new $project_name --skip-test-unit --dummy-path=spec/dummy --mountable
** Add rspec-rails as a development dependency to the gemspec file (foobar.gemspec):
Gem::Specification.new do |s|
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
sudo ls -1d */ | sudo xargs -I{} du {} -sh && sudo du -sh |