Skip to content

Instantly share code, notes, and snippets.

@jorgeguberte
jorgeguberte / helloworld.js
Created July 4, 2011 02:57
Testando o gist do github
alert("Hello world!");
<!doctype>
<html>
<head>
<title>Searchbox</title>
</head>
<body>
<style>
#outerContainer{
width: 350px;
var simpleTitle = "Google+";
var titleWithCount = "(5) Google+";
var titleWithName = "Jorge Guberte - Google+";
var complexTitle = "(5) Jorge Guberte - Google+";
getTrimmedTitle = function(){
var title = $("title").text();
if(parseInt(title.indexOf(')'))>0){
return title.slice(4);
}else{
@jorgeguberte
jorgeguberte / nodeInstallUbuntu
Created October 1, 2011 14:53 — forked from barroso/nodeInstallUbuntu
Instalação nodejs no ubuntu
#caso não tenha
sudo apt-get install git
sudo apt-get install curl python libssl-dev
mkdir ~/nodejs/
cd ~/nodejs/
git clone git://github.com/joyent/node.git
@jorgeguberte
jorgeguberte / gist:1270672
Created October 7, 2011 16:06
date_diff php workaround
/*
* DateTime::diff on PHP has a bug on Windows systems where it always outputs 6015. Here's a workaround]
* that i found on http://acme-tech.net/blog/2010/10/12/php-datetimediff-returns-6015/
*/
function dateDiff($dt1, $dt2, $timeZone = 'GMT') {
$tZone = new DateTimeZone($timeZone);
$dt1 = new DateTime($dt1, $tZone);
$dt2 = new DateTime($dt2, $tZone);
$ts1 = $dt1->format('Y-m-d');
@jorgeguberte
jorgeguberte / gist:1275767
Created October 10, 2011 16:45
Cálculo de diferença de dias javascript
//Substituir por valores reais.
var data1 = new Date('YYYY', 'MM','DD');
var data2 = new Date('YYYY', 'MM','DD');
var diferenca = parseInt((data1-data2)/(24*3600*1000));
@jorgeguberte
jorgeguberte / gist:1443051
Created December 7, 2011 14:43
Download album from Picasa with Python
import urllib
from xml.dom import minidom
'''
Opens an xml and parse it
Could fetch the xml from Picasa instead of fetching from the disk.
'''
print 'Fetching xml...'
sock = open('xml.xml')
/*
* Theme name: SpressoSP Mobile
* Theme URI: http://www.spressosp.com.br
* Description: Tema versão mobile do SPressoSP
* Author: Publisher Brasil
* Author URI: http://publisherbrasil.com.br
*/
img{
max-width: 440px;
@jorgeguberte
jorgeguberte / gist:4169357
Created November 29, 2012 14:13
CSS3 Transitions fallback checker (Javascript)
function cssTransitions() {
m = document.createElement('z');
s = m.style;
function test_props( p ) {
for ( var i in p ) {
if ( s[ p[i] ] ) {
return true;
}
}
return false;
//Source: http://stackoverflow.com/a/476681
function preload(arrayOfImages) {
$(arrayOfImages).each(function(){
$('<img/>')[0].src = this;
// Alternatively you could use:
// (new Image()).src = this;
});
}