Skip to content

Instantly share code, notes, and snippets.

View thiagosf's full-sized avatar
🏠
Always working at home

Thiago Silva Ferreira thiagosf

🏠
Always working at home
View GitHub Profile
@thiagosf
thiagosf / database.php
Created August 11, 2010 18:43
Classes para conexão com banco de dados e Modelo para manipulação em PHP
<?php
// Debug
function pr ($array) {
echo '<pre>';
print_r($array);
echo '</pre>';
}
/**
@thiagosf
thiagosf / segue.html
Created August 11, 2010 19:49
Box fundo do menu segue o hover do link.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>jQuery Lab</title>
<link href="http://fonts.googleapis.com/css?family=Cantarell:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
@thiagosf
thiagosf / mousewheel.html
Created August 11, 2010 19:51
Usar o botão de rolagem do mouse em jQuery.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>jQuery Lab</title>
<link href="http://fonts.googleapis.com/css?family=Cantarell:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
@thiagosf
thiagosf / estado.php
Created August 13, 2010 20:39
class Estado extends Model
<?php
/**
*
*/
class Estado extends AppModel
{
var $hasMany = array('Cidade');
function getCidades ($estado) {
@thiagosf
thiagosf / cidade.php
Created August 13, 2010 20:41
class Cidade extends AppModel
<?php
/**
*
*/
class Cidade extends AppModel
{
function getCidade ($id_cidade) {
$cidades = $this->find('list', array(
'conditions' => array('codigo = '.$id_cidade),
@thiagosf
thiagosf / paginator_custom.php
Created August 24, 2010 20:38
Helper para facilitar na exibição da paginação padrão em admin
<?php
App::import('Paginator');
/**
* Helper para facilitar na exibição da paginação padrão em admin
*/
class PaginatorCustomHelper extends PaginatorHelper
{
var $helpers = array('Html');
@thiagosf
thiagosf / lightbox.php
Created August 24, 2010 21:32
Helper para Lightbox
<?php
/**
* Helper para Lightbox
*/
class LightboxHelper extends AppHelper {
var $helpers = array('Html');
function img($thumb, $full, $imgAttributes = array(), $linkAttributes = array()) {
@thiagosf
thiagosf / gist:548450
Created August 24, 2010 22:24
Multi-tarefa para iOS4, colocar no AppDelegate
// This is how i did it:
// To pause:
- (void) applicationDidEnterBackground:(UIApplication *)application
{
[[CCDirector sharedDirector] stopAnimation];
[[CCDirector sharedDirector] pause];
}
- (void)applicationWillResignActive:(UIApplication *)application
{
@thiagosf
thiagosf / gist:570724
Created September 8, 2010 19:54
Array com estados brasileiros.
<?php
$estados = array('AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO');
?>
@thiagosf
thiagosf / gist:612028
Created October 5, 2010 18:10
Múltiplas condições dentro de uma consulta CakePHP
$conditions = array(
'OR' => array(
array('Company.name' => 'Future Holdings'),
array('Company.name' => 'Steel Mega Works')
),
'AND' => array(
array(