|
I've provided a number of personalised geek hug templates in various forms below, feel free to distribute them as you like--but please note that they're all distributed under the terms of the GPL, so any derivative hugs must be free, as must any second, third (etc.) generation derivative hugs. Chat HugsMSN hug
IRC hug
/me hugs you
Code HugsXML hug<hug> <target>you</target> <intensity>low</intensity> <duration>long</duration> <squeeze>average</squeeze> </hug> SQL hugINSERT INTO hugs (target, intensity, duration, squeeze) VALUES ('you', 'low', 'long', 'average');
PHP "hug" classclass Hug {
var $target;
var $intensity; //
var $duration; // these values are specified on a scale of 1 to 10
var $squeeze; //
function Hug($target='me') { //constructor: if no huggee specified, default to self-hug
$this->target = $target;
$this->intensity = 1;
$this->duration = 5;
$this->squeeze = 1;
}
function intensify($factor) {
$newIntensity = $this->intensity + $factor;
if($newIntensity > 10)
$this->intensity = 10;
else
$this->intensity = $newIntensity;
}
function untensify($factor) {
$newIntensity = $this->intensity - $factor;
if($newIntensity < 1)
$this->intensity = 1;
else
$this->intensity = $newIntensity;
}
function extend($factor) {
$newDuration = $this->duration + $factor;
if($newDuration > 10)
$this->duration = 10;
else
$this->duration = $newDuration;
}
function truncate($factor) {
$newDuration = $this->duration - $factor;
if($newDuration < 1)
$this->duration = 1;
else
$this->duration = $newDuration;
}
function tighten($factor) {
$newSqueeze = $this->squeeze + $factor;
if($newSqueeze > 10)
$this->squeeze = 10;
else
$this->squeeze = $newSqueeze;
}
function loosen($factor) {
$newSqueeze = $this->squeeze - $factor;
if($newSqueeze < 1)
$this->squeeze = 1;
else
$this->squeeze = $newSqueeze;
}
}
Example usage of "hug" class
$myhug = new Hug("you");
$myhug->intensify(1);
$myhug->extend(4);
$myhug->tighten(4);
// now print out the structure of $myhug
print_r($myhug);
which gives the following output (yep, it's real :-P):
Hug Object
(
[target] => you
[intensity] => 2
[duration] => 9
[squeeze] => 5
)
Miscellaneous Geek HugsLinux hugdave@epoch:~$ hug me bash: hug: command not foundOuch! That was uncalled for, I was only trying to be nice. Links |