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
/* objetos */ | |
// literal notation | |
var calendar = { | |
name: "PHP Event", | |
year: 2012 | |
}; | |
// constructor | |
var pets = {}; | |
// OU |
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); |
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
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
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
/** | |
* 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
/* | |
* Faça um programa que dê o conteito do aluno conforme sua nota média. | |
* | |
* Entrada: 3 notas | |
* Saída: média das notas e o conceito | |
* | |
* caso 0 <= média < 4 -> Nota E | |
* caso 4 <= média < 5 -> Nota D | |
* caso 5 <= média < 7 -> Nota C | |
* caso 7 <= média < 8 -> Nota B |
OlderNewer