Skip to content

Instantly share code, notes, and snippets.

View phsantiago's full-sized avatar
:shipit:

Pedro H. Santiago phsantiago

:shipit:
View GitHub Profile
$('#inputID').on('input',function(){
if($(this).val().indexOf('-')!=-1){
if($(this).val().length==15){
var _value = $(this).val();
_value = _value.split('');
var iTraco = _value.indexOf('-');
var letterAfter = _value[iTraco+1];
_value[iTraco] = letterAfter;
_value[iTraco+1] = '-';
_value = _value.join('');
function Css() {
var regras = [];
function __constructor(){
$('head').append('<style type="text/css" custom></style>');
}
this.addRule = function(regra, conteudo) {
return $('style[custom]').append(regra + ' { ' + conteudo + ' } ');
};
private function ocDownloadImg($url){
$filename = end(explode('/', $url));
$saveIn = DIR_IMAGE . '/downloaded/' . $filename;
$ch = curl_init($url);
$fp = fopen($saveTo, 'wba');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
find ./* -type f -name "*.png" -exec optipng -o2 {} \;
find ./* -type f -name "*.jpg" -exec jpegoptim -m70 --strip-all {} \;
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
//http://blog.shvetsov.com/2013/02/grab-android-screenshot-to-computer-via.html
There is a beauty in simplicity.
“If you can't explain it to a six year old, you don't understand it yourself.”
― Albert Einstein
“Like all magnificent things, it's very simple.”
― Natalie Babbitt
“Life is really simple, but we insist on making it complicated.”
― Confucius
mysqldump -hclubinho.com.br -uclubinho -p clubinhodadidi_com_br > clubinhodadidi_com_br_2408.sql
UPDATE or_postmeta
SET meta_value = REPLACE(meta_value, 'https://www.youtube.com/watch?v=', '') where meta_key like 'yt_video%'
private function validaCPF($cpf = null) {
// Verifica se um número foi informado
if(empty($cpf)) {
return false;
}
// Elimina possivel mascara
$cpf = preg_replace('/[^0-9]/', '', $cpf);
$cpf = str_pad($cpf, 11, '0', STR_PAD_LEFT);
function process_error_backtrace($errno, $errstr, $errfile, $errline, $errcontext) {
if(!(error_reporting() & $errno))
return;
switch($errno) {
case E_WARNING :
case E_USER_WARNING :
case E_STRICT :
case E_NOTICE :
case E_USER_NOTICE :
$type = 'warning';