Skip to content

Instantly share code, notes, and snippets.

View tiagodavi's full-sized avatar
🏠
Working from home

Tiago Davi tiagodavi

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
//Armazena dados no banco de dados do navegador
//Pega uma referência de localStorage (no objeto window)
var db = window.localStorage;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<!-- Formas elegantes de esconder elementos-->
<div id="conteudo1" hidden>Esconde!</div>
<div id="conteudo2" hidden=”true”>Esconde!</div>
<script type="text/javascript">
@tiagodavi
tiagodavi / nginx.conf
Created May 1, 2012 22:52
ngnix.conf
location / {
root html;
index index.html index.php index.htm;
}
location ~ .php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#remover o ; (caso exista) do início das linhas citadas.
#definir o path e liberar as extensões do MySQL e Curl.
; On windows:
extension_dir = "C:\nginx\php5.4\ext"
extension=php_curl.dll
extension=php_mysql.dll
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
@tiagodavi
tiagodavi / start-nginx.bat
Created May 1, 2012 23:06
start-nginx.bat
@ECHO OFF
c:\nginx\nginx.exe
c:\nginx\php5.4\php-cgi.exe -b 127.0.0.1:9000 -c c:\nginx\php5.4\php.ini
ping 127.0.0.1 -n 1>NUL
echo Starting nginx
echo .
echo .
echo .
ping 127.0.0.1 >NUL
EXIT
<?php
phpinfo();
@tiagodavi
tiagodavi / phpunit.xml
Created May 8, 2012 01:41
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" stopOnFailure="false" bootstrap="../core/bootstrap_phpunit.php">
<php>
<server name="doc_root" value="../../"/>
<server name="app_path" value="fuel/app"/>
<server name="core_path" value="fuel/core"/>
<server name="package_path" value="fuel/packages"/>
</php>
<testsuites>
<?php
class Test_Soma extends TestCase
{
public function test_soma()
{
$soma = 2 + 2;
$this->assertEquals(4, $soma);
}
@tiagodavi
tiagodavi / redirection.php
Created August 13, 2012 16:43
Exemplo de switch/case com números mágicos
<?php
#EXEMPLO 1 (PÉSSIMO)
class Cliente
{
var $tipo;
}
function redireciona(Cliente $cliente){
@tiagodavi
tiagodavi / estrutura.html
Created November 1, 2012 19:15
Estrutura HTML5
<!DOCTYPE HTML>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="estilo.css">
<title></title>
</head>
<body>
<header>
<!-- Topo aqui -->