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 | |
//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
<?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
#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
#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
$('[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
<?php | |
function xml2array($contents, $get_attributes=1, $priority = 'tag') { | |
if(!$contents) return array(); | |
if(!function_exists('xml_parser_create')) { | |
//print "'xml_parser_create()' function not found!"; | |
return array(); | |
} | |
//Get the XML parser of PHP - PHP must have this module for the parser to work |
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
<html> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> | |
<script src="http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js?v=2.1.4"></script> | |
<link rel="stylesheet" type="text/css" href="http://fancyapps.com/fancybox/source/jquery.fancybox.css?v=2.1.4" media="screen" /> | |
<style type="text/css"> | |
#imgPreview {width: 100px;} | |
</style> | |
<script> | |
var reader = new FileReader(); | |
reader.onload = onLoadFile; |
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
(function() { | |
var script, | |
scripts = document.getElementsByTagName('script')[0]; | |
function load(url) { | |
script = document.createElement('script'); | |
script.async = true; | |
script.src = url; | |
scripts.parentNode.insertBefore(script, scripts); |
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() { | |
var alturaMenu = $("#menu_vertical").height(), | |
alturaUltimasNoticias2 = $("#ultimas_noticias_2").height(), | |
alturaNoticiasDetalhe = $("#noticias_detalhe").height(); | |
var alturas = new Array(alturaMenu, alturaNoticiasDetalhe, alturaUltimasNoticias2); | |
alturas = alturas.sort(function(a,b){return b-a}); | |
console.log(alturas); | |
}); |