This file contains 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 | |
session_start(); | |
$_SESSION['count'] = time(); | |
$image; | |
?> | |
<title>demo.php</title> | |
<body style="background-color:#ddd; "> | |
<?php |
This file contains 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
// DO NOT FORGET TO ADD A #tf_container DIV WHERE YOU WANT THE FORM TO APPEAR | |
var div=document.createElement('div'); | |
div.setAttribute("class", "typeform-widget"); | |
div.setAttribute("data-url", "https://bitfalls.typeform.com/to/tZ8wBZ"+location.search); | |
div.setAttribute("data-text", "Best PHP IDE for 2014"); | |
div.setAttribute("style", "width:100%;height:600px;"); | |
var tid = setInterval( function () { | |
if ( document.readyState !== 'complete' ) return; |
This file contains 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
# Dump to gzipped file | |
mysqldump -u user -p database | gzip > database.sql.gz | |
# Import from gzipped file | |
gunzip < database.sql.gz | mysql -u user -p database |
This file contains 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 | |
$oParser = new Parser(); | |
// Here we give values to the tags the parser can expect in the content. | |
$aTagValues = array( | |
'name' => 'Bruno', | |
'title' => 'M.A.' | |
); | |
$sContent = "Dear {{title}} {{name}}, we are spamming you to sell you canned beans."; |
This file contains 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
function myErrorHandler($errno, $errstr, $errfile, $errline) | |
{ | |
if (!(error_reporting() & $errno)) { | |
// This error code is not included in error_reporting | |
return; | |
} | |
echo "<b>ERROR!</b> [$errno] $errstr<br />\n"; | |
echo " Fatal error on line $errline in file $errfile"; | |
echo ", PHP " . PHP_VERSION . " (" . PHP_OS . ")<br />\n"; | |
echo "Aborting...<br />\n"; |
This file contains 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
/** | |
* Remove acentos de caracteres | |
* @param {String} stringComAcento [string que contem os acentos] | |
* @return {String} [string sem acentos] | |
*/ | |
function removerAcentos( newStringComAcento ) { | |
var string = newStringComAcento; | |
var mapaAcentosHex = { | |
a : /[\xE0-\xE6]/g, | |
e : /[\xE8-\xEB]/g, |
This file contains 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
function Slider( containerSlider ){ | |
this.container = document.querySelector( containerSlider ); | |
this.botoesSlider = this.container.querySelectorAll( '.slider-navegacao-botao' ); | |
this.tagImagem = this.container.querySelector( '.slider-imagem' ); | |
this.listaImagens = this.tagImagem.attributes['data-images'].value.split(','); | |
this.areaClicavelImagem = this.container.querySelector( '.area-clicavel-imagem' ); | |
this.botaoRetroceder = this.areaClicavelImagem.querySelector( '.botao-retroceder' ); | |
this.botaoAvancar = this.areaClicavelImagem.querySelector( '.botao-avancar' ); | |
this.posicaoSlider = 0; | |
this.quantidade = this.listaImagens.length; |
This file contains 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
package emporium; | |
// Esta classe modela o caixa do "emporium". Ela deve receber o nome do | |
// cliente e a lista de produtos (conteúdo do "carrinho"). | |
public class Caixa | |
{ | |
// atributos: variáveis que armazenam os dados de um objeto, após este | |
// ser instanciado. | |
private Cliente cliente; | |
private Carrinho carrinho; |
This file contains 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
var codigoSujo = prompt('Digite o número do código de barras'); | |
var codigoLimpo = ''; | |
// mantem somente letras e numeros | |
codigoLimpo = codigoSujo.replace(/\W/g, ''); | |
alert('Aqui está o código de barras limpo: ' + codigoLimpo); |
OlderNewer