Skip to content

Instantly share code, notes, and snippets.

View eltonsantos's full-sized avatar
👨‍💻
Learning and developing

Elton Santos eltonsantos

👨‍💻
Learning and developing
View GitHub Profile
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'cobranca.views.home', name='home'),
<!DOCTYPE html>
%html
%head
%title
MONITOR - PMF
/%meta{'http-equiv' => 'refresh', :content => "15"}
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= javascript_include_tag "application", "data-turbolinks-track" => true
%link{:rel => "shortcut icon", :href => "/assets/favicon.ico" }
= csrf_meta_tags
= simple_form_for('/enviarmail', html: { class: 'form-horizontal' }) do |f|
= f.error_notification
.container-fluid
.form-inputs
.form-group
= label_tag "Nome", nil, class: "control-label"
= text_field_tag :name, nil, class: "string required form-control"
.form-group
= label_tag "Email", nil, class: "control-label"
= text_field_tag :email, nil, class: "string required form-control"
@eltonsantos
eltonsantos / tmp
Created March 15, 2016 21:38
Error tmp
activerecord (4.2.5) lib/active_record/associations/association.rb:218:in `raise_on_type_mismatch!'
activerecord (4.2.5) lib/active_record/associations/belongs_to_association.rb:12:in `replace'
activerecord (4.2.5) lib/active_record/associations/singular_association.rb:17:in `writer'
activerecord (4.2.5) lib/active_record/associations/builder/association.rb:123:in `usuario_pai='
activerecord (4.2.5) lib/active_record/attribute_assignment.rb:54:in `public_send'
activerecord (4.2.5) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
activerecord (4.2.5) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
actionpack (4.2.5) lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
actionpack (4.2.5) lib/action_controller/metal/strong_parameters.rb:185:in `each_pair'
activerecord (4.2.5) lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
<form name="form" action="/refinancings/new" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓">
<input type="hidden" name="search_employee_by_cpf" id="search_employee_by_cpf" value="111111">
<table class="table table-condensed">
<tbody><tr>
<th>Name</th>
<td>Elton</td>
</tr>
<tr>
<th>Matrícula</th>
<td>100000</td>
<h3>Reserve of refinancing</h3>
<table class="table table-condensed table-bordered">
<tr>
<td>Name:</td>
<td><%= @employee.first.person.name %></td>
</tr>
<tr>
<td>CPF:</td>
<td><%= @employee.first.person.cpf %></td>
def portabilizar
@autorizacao = Autorizacao.find(params[:autorizacao])
autorizacao_selecionada = params["autorizacao"].to_i
@nova_parcela = params[:nova_parcela]
@verba_proponente = params[:portabilidade][:verba]
end
secret = {''=>'', "A"=>"N","B"=>"O","C"=>"P","D"=>"Q","E"=>"R","F"=>"S", "G"=>"T","H"=>"U","I"=>"V","J"=>"W","K"=>"X","L"=>"Y","M"=>"Z", "N"=>"A","O"=>"B","P"=>"C","Q"=>"D","R"=>"E","S"=>"F","T"=>"G", "U"=>"H","V"=>"I","W"=>"J","X"=>"K","Y"=>"L","Z"=>"M", "a"=>"n","b"=>"o","c"=>"p","d"=>"q","e"=>"r","f"=>"s", "g"=>"t","h"=>"u","i"=>"v","j"=>"w","k"=>"x","l"=>"y","m"=>"z", "n"=>"a","o"=>"b","p"=>"c","q"=>"d","r"=>"e","s"=>"f","t"=>"g", "u"=>"h","v"=>"i","w"=>"j","x"=>"k","y"=>"l","z"=>"m", "?"=>"?"}
frase = "Por que a galinha atravessou a estrada?"
traducao = String.new
frase.each_char { |char| char == " " ? traducao << "" : traducao << secret[char] }
puts frase
puts traducao
def pairs(a, k)
# a é um array que contém números e k a diferença.
count = 0
a.combination(2).each {
|pair| count += 1 if ( (pair[0] - pair[1] == k) or (pair[1] - pair[0] == k) )
puts pair.inspect
}
puts "contagem: "+count.to_s
end
def pares(a, k)
count = 0
a.combination(2).each{ |par| count += 1 if ((par[0] - par[1] == k) or (par[1] - par[0] == k)) }
count
end
puts "Digite o primeiro valor para N e o segundo valor para K, separados por espaço: (Exemplo: 5 3)"
a = gets.strip.split(" ").map! { |i| i.to_i }
k = a[1]