{
"name": "assando-sites",
"require": {
"cakephp/cakephp": ">=2.5.0",
"ext-apcu": "*",
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Inclui o arquivo que faz a conexão ao MySQL | |
| include("conexao.php"); | |
| // Definição das variáveis para montar a query | |
| $titulo = 'Vandalismo mata 10 mil árvores por ano no Rio'; | |
| $texto = 'Não fosse privilegiada pela natureza, com a vasta extensão da Mata Atlântica, a paisagem do Rio seria desértica. | |
| '; | |
| $cadastro = date('Y-m-d H:i:s'); // Formato de data padrão do MySQL | |
| // ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE IF NOT EXISTS `noticias` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `titulo` varchar(255) NOT NULL, | |
| `texto` longtext NOT NULL, | |
| `cadastro` datetime NOT NULL, | |
| PRIMARY KEY (`id`), | |
| KEY `titulo` (`titulo`) | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| print_r($_COOKIE); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Deleta o cookie definido anteriormente | |
| setcookie('usuario'); | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Pega o valor do Cookie 'usuario' definido anteriormente: | |
| $valor = $_COOKIE['usuario']; // Fulano | |
| // Pega o valor do Cookie 'nome' definido anteriormente: | |
| $valor = $_COOKIE['nome']; // Ciclano | |
| ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Cria um cookie chamado 'usuario' com o valor 'Fulano' | |
| setcookie('usuario', 'Fulano'); | |
| // Cria o mesmo cookie acima só que irá durar três dias | |
| setcookie('usuario', 'Fulano', (time() + (3 * 24 * 3600))); | |
| // Cria o novo cookie para durar duas horas | |
| setcookie('nome', 'Ciclano', (time() + (2 * 3600))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file is copied to spec/ when you run 'rails generate rspec:install' | |
| if ENV['coverage'] == 'on' | |
| require 'simplecov' | |
| SimpleCov.start 'rails' do | |
| minimum_coverage 100 | |
| end | |
| end | |
| ENV['RAILS_ENV'] ||= 'test' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'active_support/concern' | |
| module Lockable | |
| @locked = false | |
| def locked? | |
| @locked == true | |
| end | |
| def lock! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| class FakeModelWithPersistenceMethods | |
| include Lockable | |
| attr_accessor :locked | |
| def lock! | |
| @locked = true | |
| end |