This file contains 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
<? | |
/* | |
generatore di thumbnail | |
copyleft 2008 Stefano Cudini | |
[email protected] | |
utilizzo: | |
<img src="thumb.php?thumb=nomefile.jpg" /> | |
<img src="thumb.php?thumb=nomefile.jpg&tnsize=120&thumbquad=1&tnmargin=2&qualit=90&thumbcut=0&thumbround=1&thumbrad=10" /> | |
*/ |
This file contains 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
<? | |
$host = "127.0.0.1"; | |
$port = !isset($argv[1]) ? die("specifica la porta come primo parametro") : $argv[1]; | |
set_time_limit(0); | |
$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); | |
$result = socket_bind($socket, $host, $port) or die("Could not bind to socket\n"); | |
$result = socket_listen($socket, 3) or die("C'e' qualche altro programma in ascolta su sta porta\n"); |
This file contains 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 randcolor() { | |
function c() { | |
return Math.floor(Math.random()*220+36).toString(16) | |
} | |
return "#"+c()+c()+c(); | |
} |
This file contains 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 isEmpty(obj) { | |
for(var prop in obj) { | |
if(obj.hasOwnProperty(prop)) | |
return false; | |
} | |
return true; | |
} |
This file contains 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
var min=8; | |
var max=18; | |
function increaseFontSize() { | |
var p = document.getElementsByTagName('p'); | |
for(i=0;i<p.length;i++) { | |
if(p[i].style.fontSize) { | |
var s = parseInt(p[i].style.fontSize.replace("px","")); | |
} else { | |
var s = 12; | |
} |
This file contains 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
JSON.stringify = JSON.stringify || function (obj) { | |
var t = typeof (obj); | |
if (t != "object" || obj === null) { | |
// simple data type | |
if (t == "string") obj = '"'+obj+'"'; | |
return String(obj); | |
} | |
else { | |
// recurse array or object | |
var n, v, json = [], arr = (obj && obj.constructor == Array); |
This file contains 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 spins = [ | |
"ββββββββ", | |
"ββββ ββββββ ββ", | |
"βββββββββββββ", | |
"ββββ", | |
"β€ββ΄ββββ¬β", | |
"β’β£β€β₯", | |
"β° β³ β² β±", |
This file contains 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
if(navigator.userAgent.match(/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|pda|treo|ipaq|palm|nokia|blackberry|opera mini|lg|htc|mot|psp|sonyericsson|sgh|android|iphone|ipod)/i)) | |
{ | |
alert('mobile'); | |
} |
This file contains 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 getElementsByClassName(classname, node) { | |
if(!node) node = document.getElementsByTagName("body")[0]; | |
var a = []; | |
var re = new RegExp('\\b' + classname + '\\b'); | |
var els = node.getElementsByTagName("*"); |
This file contains 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
var d = new Date(),T={}; | |
T.Y = d.getFullYear(), | |
T.M = d.getMonth()+1, | |
T.D = d.getDate(), | |
T.h = d.getHours(), | |
T.m = d.getMinutes(), | |
T.s = d.getSeconds(); | |
for(t in T) |