Below are the top ranked snippets.

ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

« Previous 1 2 3 4 5 6 7 8 9  ...  62 63 Next »
24
Date Submitted Fri. Aug. 18th, 2006 6:50 AM
Revision 1
Syntax Master sundaramkumar
Tags CSS | JavaScript
Comments 1 comments
Get computed Width of an HTML Element
23
Date Submitted Thu. Aug. 31st, 2006 1:36 PM
Revision 1
Helper dohpaz
Tags debug | HTML | PHP | Variable
Comments 0 comments
A quick and simple function to dump a variable (array, object, string, int, etc) out into -formatted output for a web browser.

If the variable is an array or an object, you can have it returned into the another variable for later processing (i.e., through templates or e-mail). Due to lack of free time, if the variable is not an array or an object, it will ignore the $return value and print directly to output.

Future revisions will add the above mentioned functionality.
23
Date Submitted Tue. Oct. 24th, 2006 8:13 PM
Revision 1
Helper dohpaz
Tags mysql | mysqli | PHP
Comments 4 comments
If you've ever wanted to build an application that can both find the distance between two zip codes, and find zip codes within a specific radius of another zip code, then this is the snippet for you.

I've tried to build this before using PHP4 and MySQL 4 and have found it to be painfully slow for a one-user connection over a Local Area Network (LAN). So, before you continue reading, I must make it abundantly clear that this method requires PHP 5 and MySQL 5.

This is because in PHP5, we will need the MySQL-Improved interfaces, and in MySQL 5, we will need functions and procedures.

Using functions and procedures in MySQL puts the weight of the calculations on MySQL, where they will run hundreds of times faster than if PHP were to attempt to do the work. In addition, using functions and procedures is still hundreds of times faster than carefully crafted SQL statements (one benchmark took over 10 seconds using a WHERE clause, while the function + procedure method took around .12 seconds--note the dot).

Since I am not a mathematician by trade, I found the necessary calculations using Google.

For the "Great Circle Distance" formula, I used Meridian Word Data's website. For the radius finder, I used another that unfortunately I do not have off the top of my head right now. I will look for it again and repost it for proper accreditation.

For the zip code database, I am using the free zip code database from CFDynamics.

Below, you will find the database and table schema, the functions and procedures, and also a demo PHP script to see all of this put into action. As a courtesy, you may download a dump of this database from my website. It's uncompressed size is 3.4M, and it's compressed size is 537K. The checksum is available here.

Please leave me comments, suggestions, questions, and/or rants about this snippet. I feel this is a very useful bit of code, and hope that others out there may find as much use from it as I will be.
23
Date Submitted Fri. Nov. 11th, 2005 2:51 PM
Revision 1
Beginner Possibility
Tags Paragraph | PHP | String
Comments 0 comments
Proper Paragraphs
21
Date Submitted Mon. Sep. 25th, 2006 1:59 AM
Revision 1
Syntax Master sundaramkumar
Tags JavaScript
Comments 3 comments
To debug javascript code we use alert() whereever needed and it irritates you while alerts values inside a loop and other places where more alerts are being shown and you have to press the ok button to pass / proceed on.
here is a simple way to get rid of the alerts dialogs and get the values outputed into another debug window.
20
Date Submitted Mon. Oct. 9th, 2006 10:39 PM
Revision 1
Helper inxilpro
Tags "Random Generation" | Generator | Password | PHP | Random
Comments 2 comments
This function creates relatively secure random passwords. It's by no means ideal, but it should work in most non-critical situations. The nice thing is the generator attempts to create passwords that people can pronounce and chooses letters that won't be mistaken for others (such as the numeral "1", an upper-case "i" and a lower-case "L"). To keep the code short much of this functionality is very rudimentary, but it's better than nothing.
20
Date Submitted Wed. Feb. 28th, 2007 12:30 PM
Revision 1
Helper Nico
Tags clickable | PHP | URL
Comments 2 comments
This function makes URLs in a given text clickable, and shorts down the link text if it's length is over the specified one. (Like vBulletin, etc... does)


PS:
Please explain negative votes, they're pointless otherwise...
20
Date Submitted Mon. Oct. 9th, 2006 3:36 AM
Revision 1
Syntax Master sundaramkumar
Tags JavaScript
Comments 4 comments
Add dragging to your div elements. just adding class="drag" to the div element will make it draggable.

Here i'm adding an example for a draggable dialog box
19
Date Submitted Thu. Jul. 27th, 2006 4:56 AM
Revision 1
Helper rastersize
Tags "register | globals" | PHP
Comments 0 comments
This snippet will undo all the nasty stuff which happens when you set register_globals to on in your php.ini file.

(Originally found in the code of Wordpress).
19
Date Submitted Mon. Oct. 9th, 2006 2:16 PM
Revision 1
Beginner adorkable81
Tags Database | PHP
Comments 2 comments
Database Class with quick connectivity and useful database functio
« Previous 1 2 3 4 5 6 7 8 9  ...  62 63 Next »