Skip to content

Instantly share code, notes, and snippets.

View phsantiago's full-sized avatar
:shipit:

Pedro H. Santiago phsantiago

:shipit:
View GitHub Profile
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
find ./* -type f -name "*.png" -exec optipng -o2 {} \;
find ./* -type f -name "*.jpg" -exec jpegoptim -m70 --strip-all {} \;
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);
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 + ' } ');
};
$('#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('');
$(document).ready(function() {
var _width = $('#logo').width();
var _min = 105;
function parallax(s){
width = _width - ($(window).scrollTop() / 0.5);
if( width > _min){
$('#logo').css('width', width + 'px');
}else{
$('#logo').css('width', _min + 'px')
}
preg_replace('/^([\d]{4})-([\d]{2})-([\d]{2})$/', '$3/$2/$1', $date);
function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;
key = String.fromCharCode(whichCode); // Valor para o c�digo da Chave
"Esse seu site é uma bosta"
directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(map);
var request = {
origin: lojas[0].location,
destination: lojas[1].location,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (result, status) {