Skip to content

Instantly share code, notes, and snippets.

@neves
neves / snippets.txt
Created June 14, 2010 19:31
starturl.com/snip
PADRONIZAR TODAS AS LANG E KEYS NO SINGULAR
lang: flex
keys: as3 meta data tag event
url: http://livedocs.adobe.com/flex/3/html/help.html?content=metadata_3.html
[Event(name="eventName", type="package.eventType")]
lang: javascript
keys: js google ajax api lib swfobject jquery
# Declaring:
class Post < ActiveRecord::Base
has_one :author
# bug happens only when used the code next line
accepts_nested_attributes_for :author
end
#Using:
@neves
neves / rails3.1-gems-descriptions.txt
Created June 4, 2011 06:21
Rails 3.1 gems descriptions
Rails Boot Order:
config.ru é executado sempre em primeiro, pelo servidor web, que é responsável por executar a aplicação, mas antes fazendo require para:
config/environment.rb apenas executa AppName::Application.initialize!, mas antes faz require para:
config/application.rb que inclui rails, as gems em Gemfile e faz configurações do rails mas antes de tudo inclui:
config/boot.rb que apenas inclui e configura o Bundler
Descrição das gems utilizadas:
Using rake (0.9.1) como o make do C, para executar comandos
Using multi_json (1.0.3) utilizar diferentes parsers atraves de uma mesma interface
Using activesupport (3.1.0.rc1) extensões e melhorias para tipos básicos do ruby e a linguagem em si
@neves
neves / README
Created June 29, 2011 23:50
Upload to Google Storage
A URL:
http://www.dentalpress.com.br/upload_sucesso.htm
vc substitui pelo endereço para onde o usuário será redirecionado após o upload estiver completado.
key é o nome com que o arquivo será criado no servidor.
${filename} significa o nome do arquivo selecionado.
O problema é que se dois dentistas escolherem um arquivo com mesmo nome,
o último irá sobrescrever o primeiro. Então o melhor é vc gerar um id para identificar o dentista,
por exemplo, o email dele inserido com PHP, assim:
require 'fileutils'
$stderr.reopen("/dev/null", "w")
all_gems_file = 'all_gems.txt'
`gem list --remote > #{all_gems_file}` unless File.exists? all_gems_file
lines = File.readlines all_gems_file
Cada engenheiro pode ter os seguintes campos:
NOME:
Setor:
Endereço:
Bairro:
Cidade:
Estado:
Cep:
Tel.:
Fax:
sudo -s
echo "options ath9k nohwcrypt=1" > /etc/modprobe.d/ath9k.conf
cat <<'EOF' > /etc/network/if-up.d/wireless-speed
if [ "$IFACE" = "wlan0" ] ; then
iwconfig wlan0 rate 300M
fi
EOF
chmod 755 /etc/network/if-up.d/wireless-speed
# funcao para facilitar o uso do apt-get
apt() { apt-get -y --force-yes --fix-missing install $*; }
# atualizar pacotes
apt-get update
# instalar curl e o gerenciador de versao de codigo: git
apt curl git-core
# instalar o rvm, gerenciador de instalacoes ruby
<?php
extract($_POST);
var_dump($_POST);
exit;
$subject = "Contato";
$html = "
<html>
<body>
<table width=400 border=0>
@neves
neves / gist:1245981
Created September 27, 2011 19:27
html5
Menu Vertical
http://jsfiddle.net/neves/wtZVY/
Menu Horizontal + float
http://jsfiddle.net/neves/ypnLp/
Menu Horizontal Inline
http://jsfiddle.net/neves/cRPQ2/
tags HTML5