Skip to content

Instantly share code, notes, and snippets.

View phsantiago's full-sized avatar
:shipit:

Pedro H. Santiago phsantiago

:shipit:
View GitHub Profile
//funciona com motor do safari e chrome
function getTimestamp(brDate){
return new Date(brDate.split('/').reverse().join("-"));
}
$directory = dir(getcwd());
$directory->$path;
function GetUserIP() {
if (isset($_SERVER)) { if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
{ $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; }
elseif(isset($_SERVER["HTTP_CLIENT_IP"]))
{ $ip = $_SERVER["HTTP_CLIENT_IP"]; }
else { $ip = $_SERVER["REMOTE_ADDR"]; }
}
else { if ( getenv( 'HTTP_X_FORWARDED_FOR' ) )
{ $ip = getenv( 'HTTP_X_FORWARDED_FOR' ); }
elseif ( getenv( 'HTTP_CLIENT_IP' ) )
param = 'KEY_PARAMETRO';
q = location.search.replace('?', '&').split('&');
i = 0;
while(i < q.length){
value = (q[i].split('=')[0] == param? q[i].split('=')[1] : null);
i++;
}
console.log(value);
//need angular. ljs = array de objetos
function getLocation(ljs){
angular.forEach(ljs, function(value, key){
setTimeout(function(){
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address='+value.MAPS+'&sensor=false', null, function (data) {
ljs[key] = $.extend(ljs[key],data.results[0].geometry)
console.log(JSON.stringify(ljs));
});
}, 1000);
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) {
"Esse seu site é uma bosta"
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
preg_replace('/^([\d]{4})-([\d]{2})-([\d]{2})$/', '$3/$2/$1', $date);
$(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')
}