Thursday, October 8, 2009

Content-aware resizing of pictures (seam carving)

Go get Seam Carving GUI and have fun, it’s free and available for Windows, Mac OS and Linux.

Wednesday, September 23, 2009

Sunday, September 20, 2009

PHP Syntax Highlighting

highlight_string('<?php phpinfo(); ?>');


will result in give the html required to color the syntax appropriately


<?php phpinfo(); ?>

>



So handy!

Monday, August 10, 2009

Google Voice and its awesomeness

So here is an embedded voicemail from google voice, which manages all my sms, and voicemails. very slick.

Monday, August 3, 2009

self:: vs this->

Here is an example of correct usage of $this and self for non-static and static member variables:
PHP Code:
class X {
private $non_static_member = 1;
private static $static_member = 2;

function
__construct() {
echo
$this->non_static_member . ' '
. self::$static_member;
}
}

new
X();
?>
Here is an example of incorrect usage of $this and self for non-static and static member variables:
PHP Code:
class X {
private $non_static_member = 1;
private static $static_member = 2;

function
__construct() {
echo
self::$non_static_member . ' '
. $this->static_member;
}
}

new
X();
?>
Here is an example of polymorphism with $this for member functions:
PHP Code:
class X {
function
foo() {
echo
'X::foo()';
}

function
bar() {
$this->foo();
}
}

class
Y extends X {
function
foo() {
echo
'Y::foo()';
}
}

$x = new Y();
$x->bar();
?>
Here is an example of suppressing polymorphic behaviour by using self for member functions:
PHP Code:
class X {
function
foo() {
echo
'X::foo()';
}

function
bar() {
self::foo();
}
}

class
Y extends X {
function
foo() {
echo
'Y::foo()';
}
}

$x = new Y();
$x->bar();
?>
The idea is that $this->foo() calls the foo() member function of whatever is the exact type of the current object. If the object is of type X, it thus calls X::foo(). If the object is of type Y, it calls Y::foo(). But with self::foo(), X::foo() is always called.

Friday, July 24, 2009

CSS clutter, resolved

It might be an old trick, but i like it. when you find yourself linking to many CSS files and want to clear up some of them, just link to one, and use:

@import url("common.css");
@import url("links.css");
@import url("content.css");
@import url("buttons.css");
@import url("cp.css");
@import url("forms.css");
@import url("tweaks.css");
@import url("colours.css");

Tuesday, July 7, 2009

ajax + back/forward + bookmark

http://www.equipo24.com/

so, not only does this site do a great job of using ajax in a very pretty way, but it supports a simple back forward bookmarking method, as well as linking.

mootools version

prototype version

Wednesday, June 17, 2009

Useful PHP - jsCheck

I just came accross this PHP class, it is definetly useful for web 2.0 style sites that rely heavily on javascript. Using only PHP it checks to see if javascript is enabled.

This class can be used to check whether Javascript is enabled in the browser.

It can generate a HTML form with Javascript to automatically submit it when the page is load.

The class can set cookies or session variables to avoid the need to generate the form to check again if the browser has Javascript enabled.



check it out here

Thursday, June 11, 2009

<canvas>

wow. just wow....

I cant believe how amazing html's <canvas> tag is.

http://thejit.org/demos/

I can think of a million uses for this, and I've only been looking at it for a few minutes.

Tuesday, June 9, 2009

First Post

First twitter, now blogging, whats happening?!