Skip to content

Instantly share code, notes, and snippets.

👨‍🏫
Working

Luiz Picolo ツ luizpicolo

👨‍🏫
Working
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 .railsrc
# .railsrc
-B #Skip Bundle
-T #Skip Test-Unit
-d postgresql #Use postgres
View gist:6255a525b44de36e9684ed9e25b135c4
const storage = multer.diskStorage({
destination: function(req, file, cb){
cb(null, 'public/uploads/');
},
filename: function(req, file, cb){
cb(null, `${file.filename}-${Date.now()}.${path.extname(file.originalname)}`);
}
})
View server.js
const http = require('http');
const port = 3000;
const ip = '10.10.1.96';
const server = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<h1>Instituo Federal de Mato Grosso do Sul!</h1>')
})
server.listen(port, ip, function() {
View aula_sobre_IO_serializacao.rb
class Livro
attr_accessor :titulo, :categoria, :autor, :isbn
def initialize(titulo, categoria, autor, isbn)
@titulo = titulo
@categoria = categoria
@autor = autor
@isbn = isbn
end
end
View aula_sobre_IO.rb
def salvar_livro(livro_attrs = {})
File.open('livros', 'a') do |livro|
livro_attrs.each {|k, v| livro.puts "#{k}: #{v}" }
end
end
def condicional_para_saida(condicional)
return false if condicional == 2
return true
end
@luizpicolo
luizpicolo / Exercicios5
Last active Aug 11, 2018 — forked from lrlucena/Exercicios5
Lista de Exercícios 5 da disciplina de Programação de Computadores
View Exercicios5
#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 Jul 16, 2018 — forked from hendrikswan/app.rb
sample sinatra mongodb service
View app.rb
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 Jul 17, 2017 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet
View Capybara.md

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
View PG Dump Dokku
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
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
You can’t perform that action at this time.