| Simple templates |
[Apr. 23rd, 2008|12:36 pm] |
Extremely simple yet highly effective PHP templating engine.
include.php:
<?
function content($buffer) {
/* Auto-templating function */
if (@TEMPLATE === false) {
return $buffer;
} else {
include "template.php";
return $template;
}
}
ob_start("content");
?>
template.php:
<?php $template = <<<TEMPLATE
<html>
<head>
<title>title</title>
</head>
<body>
{$buffer}
</body>
</html>
TEMPLATE;
?> |
|
|
| UPC Barcodes |
[Mar. 14th, 2008|08:47 pm] |
Please note that my main site will be down for a while, and thus none of these examples will work.
UPC barcodes are pretty easy to do in Javascript. This particular script takes a product name and 10 digit UPC barcode, adds a prefix, calculates the checksum and draws it.
UPC.draw("Product Name", "1234567890"); Download UPC.zip here. |
|
|
| Experiements with <canvas> |
[Oct. 30th, 2007|10:22 am] |
This is a little something I put together as a test of the <canvas> element. It is derived from the aussie game "Puzzle Quest" and requires either FF or Opera. I'll take it down in a few days.
HappyQuest.
( The XML driving the map/sprites ) |
|
|
| Guitar effects unit |
[Feb. 5th, 2007|09:19 pm] |
This is a couple of circuits in one - a distortion pedal, a wah-wah, an amplifier and a pre-amp (similar to my last post). It's all powered by a couple of sealed lead-acid batteries. I'll install some speakers and an AC power supply on wednesday, and will finish an external wah-wah pedal shortly after.
 I'm trying to get my hands on a few Bakelite knobs and some antique-looking speaker fabric, so that I can get it to look like a 40's era radio. |
|
|
| Pre-amplifier |
[Jan. 27th, 2007|08:23 pm] |
Here's a pre-amp I recently built - I'm particularly happy about how the case came out.
 |
|
|
| Cool login form + effect |
[Aug. 13th, 2006|08:30 pm] |
|
I really like the look of this (mouseOver and mouseOut). Now all I need is something to use it with. |
|
|
| Simple anti-XSS/SQL injection in PHP |
[Aug. 9th, 2006|06:00 pm] |
Here's some more code. A nice, quick and effective way of automatically blocking nearly all XSS/SQL injection in PHP (excluding unquoted SQL query strings, which you shouldn't be doing in the first place). It isn't really suitable for all situations, but certainly makes a nice stopgap.
( Code behind the cut ) |
|
|
| Neftaly's reliable drag & drop elements |
[Aug. 1st, 2006|12:00 pm] |
Just some simple JavaScript I made for myself, but might as well share around. I was hunting for a decent Drag-and-Drop HTML elements scripts that let me have custom drop zone classes (i.e. round pegs and square holes). I found nothing suitable - while extremely functional, Scriptaculous and Rico are both the size of a small moon. My script is way easier to use, and only 3.5KB (quick example).
( Code behind the cut ) |
|
|