Skip to content

Instantly share code, notes, and snippets.

View TiuTalk's full-sized avatar

Thiago Belem TiuTalk

  • Assando Sites
  • Arraial d'Ajuda, BA - Brazil
  • 20:23 (UTC -03:00)
View GitHub Profile
@TiuTalk
TiuTalk / 0_reuse_code.js
Created March 15, 2014 04:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
// Conecta ao MySQL usando MySQLi
$MySQLi = new mysqli("localhost", "root", "Digue2013", "alternativa");
// Recebe os dados do formulário
# $chNFe = $_GET['chNFe']; // Não é usado?
$identidade = $_POST['Id'];
$COD_BARRAS = $_POST['COD_BARRAS'];
$DT_LANCAMENTO = $_POST['DT_LANCAMENTO'];
$DT_DEVOLUCAO = $_POST['DT_DEVOLUCAO'] ;
<?php
$sql = sprintf("SELECT * FROM `NFE_ENTRADA` WHERE `CHAVENFE` = '%s'", $CHAVENFE);
$query = mysql_query($sql);
$i = 0;
while ($produto = mysql_fetch_object($sql)) { ?>
<tr>
<td height="17" bgcolor="#FFFFFF" class="style7" align="center"><?php echo $produto->cProd ?></td>
<td width="35%" bgcolor="#FFFFFF" class="style7" align="center"><?php echo $produto->xProd . ' / ' . $produto->infAdProd ?></td>
// adicionando e removendo a class "OPEN" para os submenus com click no link
$('html').click(function() {
$('#top .open').removeClass('open');
});
$('.with-submenu > a').click(function(event) {
event.preventDefault();
event.stopPropagation();
var $this_parent = $(this).parent();
$('html').click(function() {
$('#top .open').removeClass('open');
});
$('.categories').click(function(event) {
event.preventPropagation();
});
$('.with-submenu a').click(function(event) {
event.preventDefault();
@TiuTalk
TiuTalk / Client.php
Created April 7, 2012 17:26 — forked from waltergalvao/Client Model
Client Model
<?php
class Client extends AppModel {
public $validate = array(
'responsavel'=> array(
array(
'rule' => 'maiorDeIdade',
'message' => 'Campo deve ser preenchido'
)
@TiuTalk
TiuTalk / Core.php
Created April 4, 2012 19:49 — forked from patrickmaciel/Core.php
FrontEndController.php
<?php
/**
* This is core configuration file.
*
* Use it to configure core behavior of Cake.
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
@TiuTalk
TiuTalk / FrontEndController.php
Created April 4, 2012 19:47 — forked from patrickmaciel/Core.php
FrontEndController.php
<?php
App::uses('AppController','Controller');
class FrontEndController extends AppController {
public $uses = array('Categoria', 'Modelo', 'Cliente', 'Marca', 'Anuncio');
public $components = array('Buscas');
public $helpers = array('Imagem', 'Number', 'Media', 'Cache');
<?php
/**
* This file is loaded automatically by the app/webroot/index.php file after core.php
*
* This file should load/create any application wide configuration settings, such as
* Caching, Logging, loading additional configuration files.
*
* You should also use this file to include any files that provide global functions/constants
* that your application uses.
*
@TiuTalk
TiuTalk / rotas.php
Created March 11, 2012 22:43 — forked from gabrielslau/rotas.php
Exemplo de uso de Rotas com o CakePHP
<?php
Router::connect(
'/projetos/:categoria' ,
array('controller' => 'projetos', 'action' => 'index'), // Local à ser redirecionado
array('pass' => array('categoria'), 'categoria' => '[a-zA-Z-0-9_]*')
);
Router::connect(
'/projetos/:categoria/:codigo:titulo' ,
array('controller' => 'projetos', 'action' => 'view'), // Local à ser redirecionado
array('pass' => array('codigo'), 'categoria' => '[a-zA-Z-0-9_]*', 'codigo' => '[a-zA-Z-0-9_]{7}', 'titulo' => '(-[a-zA-Z0-9_-]*)?')