This file contains hidden or 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
# Faz uma busca no campo e subistitui uma string | |
UPDATE tabela | |
SET campo = REPLACE(campo, 'busca', 'novo') | |
WHERE campo LIKE '%busca%'; |
This file contains hidden or 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
// Não repita a si mesmo - Ajax usando jQuery e enviando input type file | |
// ---------------------------------------------------------------------- | |
var formData = new FormData($('form')[0]); // Cria o objeto com os dados do formulário | |
$('input').click(function(){ | |
$.ajax({ | |
url : 'controle.php', | |
type : 'post', | |
data : formData, // Variável que contem o objeto a ser enviado |
This file contains hidden or 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 | |
echo preg_replace('@<div[^>]*? id="_mcePaste"[^>]*?>.*?</div>@si', '', $minhavariavel); | |
?> |
This file contains hidden or 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
<? | |
/* Lista de favoritos */ | |
// Criador de VagrantFile para VMs PHP | |
echo 'https://puphpet.com/'; | |
?> |
This file contains hidden or 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
$(document).ready(function(){ | |
// fix date validation for chrome | |
jQuery.extend(jQuery.validator.methods, { | |
date: function (value, element) { | |
var isChrome = window.chrome; | |
// make correction for chrome | |
if (isChrome) { | |
var d = new Date(); | |
return this.optional(element) || | |
!/Invalid|NaN/.test(new Date(d.toLocaleDateString(value))); |
This file contains hidden or 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 | |
class Loader{ | |
private $_mod; | |
private $class = array("ModeloTeste"); | |
function __construct(){ | |
//cria o array de objetos | |
foreach ($this->class as $Instancia) { | |
$this->addMod(new $Instancia()); | |
} |
This file contains hidden or 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
$(document).ready(function(){ | |
// faz a leitura do arquivo e atualiza a div | |
function readURL(input,div) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
$(div).css('background-image', 'url(' + e.target.result + ')'); | |
} | |
reader.readAsDataURL(input.files[0]); | |
} |
This file contains hidden or 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
-- Não repita a si mesmo - Pesquisando emails com expressão regular | |
------------------------------------------------------------------- | |
-- Selecionando emails validos no banco de dados | |
SELECT eml_email | |
FROM tb_email | |
WHERE eml_email REGEXP ‘^[a-zA-Z0-9]{1}([\._a-zA-Z0-9-]+)(\.[_a-zA-Z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+){1,3}$’ | |
-- Selecionando emails não válidos no banco de dados | |
SELECT eml_email |
This file contains hidden or 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
// Não repita a si mesmo - Ajax usando jQuery | |
// -------------------------------------------- | |
$('input').click(function(){ | |
$.ajax({ | |
url : 'controle.php', | |
type : 'post', | |
data : {'dado':valor}, | |
beforeSend: function(){ | |
$('#carregando').fadeIn(); |