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 yardoc_cheatsheet.md

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.

Modules

# Namespace for classes and modules that handle serving documentation over HTTP
View install_python.sh
# 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
@luizpicolo
luizpicolo / model_extension.rb
Created Jan 4, 2017 — forked from brenes/model_extension.rb
Removing validation of a model declared on a gem
View model_extension.rb
# 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
View lambrete.rb
# Alterar sequencia
ALTER SEQUENCE content_builders_id_seq RESTART WITH 37178;
@luizpicolo
luizpicolo / sign-pdf.rb
Created Dec 20, 2016 — forked from matiaskorhonen/sign-pdf.rb
Quick and dirty PDF signing in Ruby (using Origami)
View sign-pdf.rb
#!/usr/bin/env ruby
require "openssl"
require "time"
begin
require "origami"
rescue LoadError
abort "origami not installed: gem install origami"
end
@luizpicolo
luizpicolo / gemproject.md
Created Dec 6, 2016 — forked from blackjk3/gemproject.md
Creating a gem project with rspec
View gemproject.md

** 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|
View size_dirs.sh
sudo ls -1d */ | sudo xargs -I{} du {} -sh && sudo du -sh
View gist:ee4ee73c41b1ae98e74911de0d471e5c
Estes dias fiquei pensando o motivo que levava uma árvore binária a ser um estrutura de dados perfeita para o armazenamento e
busca de dados. Isso me levou a criar um algoritmo simples para demostrar a quantidade de passos para a busca de um
elemento mediante a quantidade de dados. O(log(n)). Logo, como o crescimento é exponencial, ao dobrar a quantidade de dados o
passo so é acrescido de mais 1.
i = 16
n = 1
for j in (0..i)
puts j
puts n
@luizpicolo
luizpicolo / install-docker.sh
Created Oct 13, 2016 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
View install-docker.sh
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
View bash.sh
#!/usr/bin/env bash
cp config/database.example.yml config/database.yml &&
cp config/application.example.yml config/application.yml &&
cp config/secrets.example.yml config/secrets.yml &&
value=`cat .ruby-gemset` &&
sed -i "s/db/$value/g" config/database.yml &&
gem install bundle &&
bundle install &&
rake db:create &&
You can’t perform that action at this time.