Skip navigation.
Home

JavaScript

Terse Javascript Alternations, and the Frameworks' Problem with SQL

Cool

Here's a snippet of javascript that breaks up a phone number into its parts, if it's formatted in the common formats.


	var cell = namesArray[rownum]['Cell'];

Sarah Palin Pork Barrel Calculator

Vice Presidential candidate Sarah Palin has recently been criticized for her pork-barrel spending. This web-calculator helps you figure out how extreme she is. (Calculator is on the full story.)

How Much Money Can You Save on Gas by Riding the Bus?

This is a javascript calculator that will estimate if taking a bus will cost less than what you pay in gasoline. Surprisingly, for short commutes, commuting by car is cheaper than getting a bus pass. (Calculator is on the full article.)

Future Web App Development

Things to read and research:

Adobe Flex
qooxdoo
Silverlight
OpenMocha
Backbase
Google Web Toolkit
Authenteo
WebKit

More info - Ajaxian

Not a framework - Scriptaculous which uses Prototype. (That and JQuery are in another post.)

Email Obfuscation and Shielding Script

Here's a perl script that takes email addresses as arguments, and returns javascript code that hides your email address from web spiders. The email address is also linked so it's clickable.

#! /usr/bin/perl

foreach my $email (@ARGV) {

        $email =~ s/@/ @ /;
        $email =~ s/\./ . /;

        @parts = split( ' ', $email );

        print "\n";
        print "document.write('');";
        foreach my $word (@parts) {
                print "document.write('".$word."');\n";
        }
        print "document.write('');\n";
        print "\n\n";
}

Hiding Email Addresses from Spiders and Spammers

Here's a bit of PHP code that emits javascript. The javascript emits an email link, but coded in Javascript, so that most spiders won't be able to get your email address for spamming.

<?php
function printEmailAddress( $email )
{
     $parts = explode( '@', $email );
     echo '<script type="text/javascript"> var d = document;';
     echo 'd.write("<a href=\'mailto:");';
     echo 'd.write("'.$parts[0].'");';
     echo 'd.write("@");';
     echo 'd.write("'.$parts[1].'");';
     echo 'd.write("\'>");';
     echo 'd.write("'.$parts[0].'");';
     echo 'd.write("@");';
     echo 'd.write("'.$parts[1].'");';
     echo 'd.write("</a>");</script>';
}

printEmailAddress("fake@mail.com");
?>

Novice's Notebook

This is a repository of "novice" articles, written with the intent of driving more traffic to the site, and getting more ad clicks. It's pretty crass, I know, but the information may be very useful. Some of the content is adapted from the diy notes, and other notebooks, which are a bit rougher than these.

Most of these articles are not authoritative, because they're based on what I'm learning, as I'm learning it.

Password Quality Evaluator

This is an up-and-coming feature on some sites. It measures the quality of a password, and gives the user immediate feedback about how good it is.

The JavaScript below does that. It calculates the score by grouping the keyboard into uppercase, lowercase, punctuation, and numbers. You get points for length, for diversity in using keys from different groups, for switching groups often, and extra for using punctuation.

The HTML part was intended for creating an .htaccess password.

Here's a demo:

Password
Quality:

Syndicate content