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
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() == '' || input.val() == input.attr('placeholder')) { | |
input.addClass('placeholder'); |
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
#Em /etc/apache2/sites-avaliable crie o arquivo | |
NameVirtualHost * | |
<VirtualHost *> | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/prime | |
ServerName www.prime.com.br | |
ServerAlias prime.com.br *.prime.com.br |
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
#Inslatar Xdebug | |
sudo apt-get install xdebug | |
#Instalar o pear | |
sudo apt-get install php-pear | |
sudo pear channel-discover pear.phpunit.de | |
sudo pear channel-discover components.ez.no | |
sudo pear channel-discover pear.symfony-project.com | |
sudo pear channel-discover pear.cakephp.org |
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 | |
function filenameGenerator($file){ | |
preg_match("/(\w{3,4})$/i", $file, $matchs); | |
return sha1($file.date('YmdHis', time())).".".$matchs[1]; | |
} | |
?> |
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 | |
//Converte de R$ para decimal(10,2) | |
//$value = 150.000,00 | |
$value = str_replace('.','',$value); | |
$value = str_replace(',','.',$value); | |
echo $value; //150000.00 | |
//Converter de decimal(10,2) para R$ | |
//$value = 150000.00 |
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
#remover todos os arquivos .mp3 de um File Server, por exemplo: | |
find / -type f -iname *.mp3 -exec rm -rf {} \; |
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 | |
/** | |
* Zend Framework | |
* | |
* LICENSE | |
* | |
* Arquivo de livre reprodução | |
* | |
* Utilização: | |
* |
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 | |
$p = new Phar('/var/www/webdesk.phar', 0, 'webdesk.phar'); | |
$p->startBuffering(); | |
$p->buildFromDirectory('/var/www/webdesk'); | |
//Arquivo de output | |
$p->setStub($p->createDefaultStub('criar.php')); | |
$p->stopBuffering(); |
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 | |
// ============ OBTER DADOS DA URL: http://www.mar.mil.br/dhn/chm/tabuas/ ============ | |
$dom = new domDocument; | |
$dom->loadHTML($html); | |
$dom->preserveWhiteSpace = false; | |
$tables = $dom->getElementsByTagName('table'); | |
$rows = $tables->item(0)->getElementsByTagName('tr'); | |
$arMare = array(); | |
$gravando = 0; | |
foreach ($rows as $row) { |
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 'Amanhã: ', strftime('%A', strtotime('tomorrow')); | |
// Amanhã: domingo | |
echo 'Próxima segunda: ', strftime('%d de %B de %Y', strtotime('next monday')); | |
// Próxima segunda: 01 de junho de 2009 | |
echo 'Vencimento: ', strftime('%d/%m/%Y', strtotime('+3 months')); | |
// Vencimento: 30/08/2009 |