Skip to content

Instantly share code, notes, and snippets.

View luizcarvalho's full-sized avatar
🟢
Dev and beer

Luiz Carvalho luizcarvalho

🟢
Dev and beer
View GitHub Profile
== 20080725214621 CreateMapas: migrating ======================================
-- create_table(:mapas)
-> 0.0183s
== 20080725214621 CreateMapas: migrated (0.0187s) =============================
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<%= GMap.header %>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Mapas: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= javascript_include_tag 'ym4r-gm' %>
</head>
<body>
class BuscaSeq
def initialize
end
def busca_sequencial(vetor,elemento)
@result = {:pos=>0,:iter=>0, :valor=>elemento}
vetor.each do |el|
@result[:iter]+=1
el == elemento ? (return @result) : @result[:pos]+=1
end
<div id="content">
<div id="header">
<div id=tobase><h1> TITULO PORRAA!</h1> <br><hr>
</div>
def format_number!
if self.instance_of? Cpf
@numero =~ /(\d{3})\.?(\d{3})\.?(\d{3})-?(\d{2})/
@numero = "#{$1}.#{$2}.#{$3}-#{$4}"
else
@numero =~ /(\d{2})\.?(\d{3})\.?(\d{3})\/?(\d{4})-?(\d{2})/
@numero = "#{$1}.#{$2}.#{$3}/#{$4}-#{$5}"
end
end
<dl>
<dt><label for="localidade_cidade">Cidade:</label></dt>
<dd><%= select "rotas","cidades",@localidades,:size=>"1" %>
<%=link_to_remote "Adicionar Cidade",{:url=>{:id=>1,:action=>"add_locate_in_route",:with =>"'thing='+$('#rotas_cidades option:selected').text()"}}.merge(loading_tag)%>
</dl>
@res = ActiveRecord::Base.establish_connection(:password=>"xxx", :port=>5432, :username=>"postgres", :adapter=>"postgresql", :encoding=>"utf8", :min_messages=>"warning", :database=>"transat", :host=>"000.000.000.000")
con = ActiveRecord::Base.connection
attrs = con.columns("tr_veiculo")
attrs.each do |attr|
puts attr.name
end
end
id
veiculo
ano
modelo
conservacao
pasta
combustivel
placa
chassis
renavan
>> usuario = Usuario.create(:nome=>"Dextter",:endereco=>"Al 2",
:cpf=>12312312323,:nascimento=>"2009-01-01",
:descricao=>"Usuario")
=> <Usuario id: 4>
>> projeto = Projeto.create(:nome=>"Segundo Projeto")
=> <Projeto id: 2>
>> usuario.projetos << projeto
=> [<Projeto id: 2>]
@luizcarvalho
luizcarvalho / AndroidOnCreate.java
Created February 21, 2011 12:57
Android - OnCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.expenses_list);
dbAdapter = new DbAdapter(this);
try {
dbAdapter.open();
} catch (SQLiteException e) {
e.printStackTrace();
} catch (FileNotFoundException el) {