Skip to content

Instantly share code, notes, and snippets.

View andrerpbts's full-sized avatar

André Rodrigues andrerpbts

View GitHub Profile
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'bin/**/*'
- !ruby/regexp /old_and_unused\.rb$/
@andrerpbts
andrerpbts / Gemfile
Last active August 29, 2015 14:19 — forked from cblunt/Gemfile
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@andrerpbts
andrerpbts / hurl
Last active December 18, 2015 17:29
POST /ws_horarios/atualizaEscala HTTP/1.1
Host: www.myexternalserver.com.br
Accept: */*
Content-Length: 14995
Content-Type: application/x-www-form-urlencoded
Expect: 100-continue
empresa=f3d15ee????????50ca575fa930ce9d&func%5Fescala=%5B%7B%22matricula%22%3A%22100006%22%2C%22data%5Finicio%22%3A%2201042013%22%2C%22data%5Ffim%22%3A%2207042013%22%2C%22jornadas%22%3A%5B%7B%22converter%5Fhora%5Ff%22%3A%22Horas%20A%20Menos%22%2C%22converter%5Fhora%5Fe%22%3A%22Horas%20Excedentes%22%2C%22intervalos%22%3A%5B%7B%22inicio%22%3A%221730%22%2C%22fim%22%3A%221815%22%2C%22nome%22%3A%22Tutoria%20P%5Cu00f3s%2DGradua%5Cu00e7%5Cu00e3o%20a%20Dist%5Cu00e2ncia%22%7D%5D%2C%22batidas%5Fpre%22%3A%5B%5D%7D%2C%7B%22converter%5Fhora%5Ff%22%3A%22Horas%20A%20Menos%22%2C%22converter%5Fhora%5Fe%22%3A%22Horas%20Excedentes%22%2C%22intervalos%22%3A%5B%7B%22inicio%22%3A%221300%22%2C%22fim%22%3A%221400%22%2C%22nome%22%3A%22Assist%2E%2FCoordena%5Cu00e7%5Cu00e3o%20Projetos%22%7D%5D%2C%22batidas%5Fpre%22%3A%5B%5D%7D%2C%7B%22converter%5Fhora%5Ff%22%3
opening connection to www.myexternalserver.com.br...
opened
<- "POST /ws_horarios/atualizaEscala?empresa=f3d15e???????????50ca575fa930ce9d&func_escala=%5B%7B%22matricula%22%3A%22100022%22%2C%22data_inicio%22%3A%2201042013%22%2C%22data_fim%22%3A%2207042013%22%2C%22jornadas%22%3A%5B%7B%22converter_hora_f%22%3A%22Horas%20A%20Menos%22%2C%22converter_hora_e%22%3A%22Horas%20Excedentes%22%2C%22intervalos%22%3A%5B%7B%22inicio%22%3A%220800%22%2C%22fim%22%3A%221200%22%2C%22nome%22%3A%22Supervis%5Cu00e3o%20de%20Est%5Cu00e1gio%22%7D%2C%7B%22inicio%22%3A%221300%22%2C%22fim%22%3A%221700%22%2C%22nome%22%3A%22Supervis%5Cu00e3o%20de%20Est%5Cu00e1gio%22%7D%5D%2C%22batidas_pre%22%3A%5B%5D%7D%2C%7B%22converter_hora_f%22%3A%22Horas%20A%20Menos%22%2C%22converter_hora_e%22%3A%22Horas%20Excedentes%22%2C%22intervalos%22%3A%5B%7B%22inicio%22%3A%221400%22%2C%22fim%22%3A%221800%22%2C%22nome%22%3A%22Supervis%5Cu00e3o%20de%20Est%5Cu00e1gio%22%7D%2C%7B%22inicio%22%3A%221920%22%2C%22fim%22%3A%222005%22%2C%22nome%22%3A%22Aulas%20Gradua%5Cu00
@andrerpbts
andrerpbts / json2
Last active December 18, 2015 17:29
[
{
"matricula": "100006",
"data_inicio": "01042013",
"data_fim": "07042013",
"jornadas": [
{
"converter_hora_f": "Horas A Menos",
"converter_hora_e": "Horas Excedentes",
"intervalos": [
@andrerpbts
andrerpbts / json1
Last active December 18, 2015 17:29
[
{
"matricula": "100022",
"data_inicio": "01042013",
"data_fim": "07042013",
"jornadas": [
{
"converter_hora_f": "Horas A Menos",
"converter_hora_e": "Horas Excedentes",
"intervalos": [
@pdf = Prawn::Document.new(:margin => 0, :skip_page_creation => true)
images.each do |imagem|
geo = Paperclip::Geometry.from_file(imagem)
if geo.height >= geo.width
size = [612, 792]
@pdf.start_new_page(:page_size => "A4", :layout => :portrait)
else
size = [792, 612]
@pdf.start_new_page(:page_size => "A4", :layout => :landscape)
end
@andrerpbts
andrerpbts / ability.rb
Created September 4, 2012 18:11
Menus SGO
#encoding: utf-8
class Ability
include CanCan::Ability
def initialize(user)
user.perfis.each do |perfil|
perfil.permissoes_perfis.each do |permissao|
can permissao.acao.to_sym, Recurso.por_tipo(permissao.recurso, permissao.tipo)
end
end
@andrerpbts
andrerpbts / contato_mailer.rb
Created May 25, 2012 11:15
IMAP Mail Receive Ruby
#encoding: utf-8
class ContatoMailer < ActionMailer::Base
def receive(message)
p message
end
end
@andrerpbts
andrerpbts / gist:2044373
Created March 15, 2012 14:10
refactory
# modo um
def index
@status = params[:status]
if @status == nil
@associados = Associado.all
else
@associados = Associado.find_all_by_status(@status)
end
respond_to do |format|