Skip to content

Instantly share code, notes, and snippets.

View luizpicolo's full-sized avatar
👨‍🏫
Teaching

Luiz F. Picolo luizpicolo

👨‍🏫
Teaching
View GitHub Profile
@luizpicolo
luizpicolo / SendObjectsOverSockets.java
Created August 21, 2021 02:47 — forked from chatton/SendObjectsOverSockets.java
Example of how to send an Object over a Socket in Java.
import java.io.Serializable;
// must implement Serializable in order to be sent
public class Message implements Serializable{
private final String text;
public Message(String text) {
this.text = text;
}
@luizpicolo
luizpicolo / git.md
Created June 13, 2021 21:47 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda

@luizpicolo
luizpicolo / IndexedDB101.js
Created February 7, 2021 23:18 — forked from cauerego/IndexedDB101.js
Very Simple IndexedDB Example
// quite untested, adapted from BigstickCarpet's gist, attempt to make it simpler to use
function openIndexedDB (fileindex) {
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
var openDB = indexedDB.open("MyDatabase", 1);
openDB.onupgradeneeded = function() {
var db = {}
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres
@luizpicolo
luizpicolo / Exercicios5
Last active August 11, 2018 15:17 — forked from lrlucena/Exercicios5
Lista de Exercícios 5 da disciplina de Programação de Computadores
#encoding: utf-8
# Escreva um programa que leia um número e mostre se ele é igual a 10.
puts "Digite um número: "
x = gets.to_i
if x==10 then
puts "O valor digitado foi 10."
else
puts "O valor digitado não foi 10."
@luizpicolo
luizpicolo / app.rb
Last active July 16, 2018 05:30 — forked from hendrikswan/app.rb
sample sinatra mongodb service
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
Mongoid.load!("mongoid.yml")
class Price
include Mongoid::Document
@luizpicolo
luizpicolo / Capybara.md
Created July 17, 2017 13:22 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above

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

@luizpicolo
luizpicolo / model_extension.rb
Created January 4, 2017 13:28 — forked from brenes/model_extension.rb
Removing validation of a model declared on a gem
# 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
@luizpicolo
luizpicolo / sign-pdf.rb
Created December 20, 2016 19:01 — forked from matiaskorhonen/sign-pdf.rb
Quick and dirty PDF signing in Ruby (using Origami)
#!/usr/bin/env ruby
require "openssl"
require "time"
begin
require "origami"
rescue LoadError
abort "origami not installed: gem install origami"
end