Skip to content

Instantly share code, notes, and snippets.

View TiuTalk's full-sized avatar
🌴
Tropical Developer

Thiago Belem TiuTalk

🌴
Tropical Developer
  • Assando Sites
  • Arraial d'Ajuda, BA - Brazil
  • 16:25 (UTC -03:00)
View GitHub Profile
@TiuTalk
TiuTalk / gist:1021306
Created June 12, 2011 06:30
Install/update Apache 2, MySQL 5 and PHP 5
sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql php-pear php5-suhosin
@TiuTalk
TiuTalk / gist:1034492
Created June 19, 2011 17:12
Página de boas vindas
<h2>Seja bem vindo!</h2>
<p>Este é o site do maior evento de <strong>CakePHP</strong> do Brasil!</p>
<p>As inscrições abrirão no dia 01 de julho de 2011... Aguardem!</p>
<p>Para mais informações, entrem em contato através do e-mail <a href="mailto:[email protected]">[email protected]</a></p>
@TiuTalk
TiuTalk / gist:1045708
Created June 24, 2011 21:17
Habilitando GZIP em servidores Nginx
# Habilita o gzip
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
# Mime-types que serão compactados
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
@TiuTalk
TiuTalk / gist:1047194
Created June 26, 2011 03:30
Layout padrão (default.ctp)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>CakePHP Brasil</title>
</head>
<body>
<?php echo $content_for_layout; ?>
</body>
</html>
@TiuTalk
TiuTalk / inscricoes.sql
Created July 2, 2011 20:17
Tabela SQL para armazenar as inscrições
CREATE TABLE `inscricoes` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`nome` VARCHAR(50) NOT NULL,
`email` VARCHAR(100) NOT NULL,
`telefone` CHAR(10) NOT NULL,
`endereco` VARCHAR(100) NOT NULL,
`created` DATETIME NOT NULL,
`updated` DATETIME NOT NULL,
UNIQUE (`email`)
) ENGINE = MYISAM;
@TiuTalk
TiuTalk / inscricao.php
Created July 2, 2011 23:20
Model de inscrições
<?php
class Inscricao extends AppModel {
public $name = 'Inscricao';
public $useTable = 'inscricoes';
}
@TiuTalk
TiuTalk / inscricao.php
Created July 2, 2011 23:46
Model de inscrições com outros atributos
<?php
class Inscricao extends AppModel {
// Nome do model
public $name = 'Inscricao';
// Nome da tabela
public $useTable = 'inscricoes';
// Cacheia consultas
public $cacheQueries = true;
@TiuTalk
TiuTalk / inscricoes_controller.php
Created July 3, 2011 14:33
Controller de Inscrições
<?php
class InscricoesController extends AppController {
public $name = 'Inscricoes';
public $use = array('Inscricao');
}
@TiuTalk
TiuTalk / inscricoes_controller.php
Created July 3, 2011 15:08
Controller de Inscrições + action de inscrição
<?php
class InscricoesController extends AppController {
public $name = 'Inscricoes';
public $uses = array('Inscricao');
public function inscrever() {
// Carrega a view /views/inscricoes/inscrever.ctp
}
}
@TiuTalk
TiuTalk / gist:1062339
Created July 3, 2011 16:02
Formulário de login
<h3>Login</h3>
<?php echo $this->Form->create('Usuario', array('action' => 'login')); ?>
<?php echo $this->Form->input('login'); ?>
<?php echo $this->Form->input('senha', array('type' => 'password')); ?>
<?php echo $this->Form->submit('Entrar'); ?>
<?php echo $this->Form->end(); ?>