Welcome To Snipplr


Everyone's Recent Snippets Tagged function



1 1450 posted 17 years ago by iTony
it needs the GD2 library
5 1644 posted 17 years ago by iTony
0 1372 posted 17 years ago by stavelin
button function to jump to labeled frame.
0 1377 posted 17 years ago by sebastianassaf
1 1048 posted 17 years ago by iTony
7 2406 posted 17 years ago by taboularasa
This will count sentences that end in . or ? or ! and have a space after them.
1 2810 posted 17 years ago by evanwalsh
YouTube offers a method for users and developers to embed video on their web pages. Unfortunately the code that they use doesn't validate. Use this function to make YouTube's embed code validate.
2 1792 posted 17 years ago by neal_grosskopf
One thing that always bothered me about Classic ASP is that there isn't an easy way to get the entire url. So I devised a function that will get the full path including the query string.
2 6081 posted 17 years ago by neal_grosskopf
Another way of showing long text to end user...
0 1379 posted 17 years ago by skywalker
1 1607 posted 17 years ago by iTony
Small function that returns a random rounded value between two given numbers.
0 1381 posted 17 years ago by Wiederkehr
I notice that a lot of database driven websites make easy mistakes by not checking for plural words. An example might be "2 vote" or "1 votes". Here is an example of a function using ASP to check for plurals.
1 1713 posted 17 years ago by neal_grosskopf
How to use: 1) < script type="text/javascript" src="path-to-file.js"... 2) < body onload="oHW.preMontar('img1_on.jpg','img2_on.jpg','img3_on.jpg');"... 3) < a href="#" onmouseout="oHW.Restore()" onmouseover="oHW.Cambiar('mnind','img1_on.jpg'...
2 1709 posted 17 years ago by hellion
A small function I made to chmod directories and files recursively, with different permissions.
2 1981 posted 17 years ago by Tenzer
Quick example to show how 'this' depends on how the function in which you called it in was being invoked. From jQuery in Action.
1 1134 posted 17 years ago by 1man
Apologies if I haven't explained this to well, I'm still trying to get my head round closures.
0 1076 posted 17 years ago by 1man
This method allows you to call a function as a method of another object. The first argument the call method expects is the object it is to operate on. Any others are part of the function. Note how the this keyword now refers to the comp object, so a...
0 1210 posted 17 years ago by 1man
The important thing to notice is the () operator in a[2]. It is invoking the function inside a[0] with the argument a[1].
1 1319 posted 17 years ago by 1man
Every function has an object called the arguments object. This is an object that contains all the arguments that were passed to the function. The example below shows how to access these. Very rarely used but useful to know. Note: it may look like an...
2 1625 posted 17 years ago by 1man
Simple way of allowing functions to take optional arguments. Always place the optional arguments last, so you don't have to explicitly pass an argument as "undefined".
3 1484 posted 17 years ago by 1man
Add this template before functions in a library, in order to give a good description of what it is and what it does. Replace all in < and > with your values.
2 1693 posted 17 years ago by engel
Pass a user-inputted variable to this function in order to prevent SQL injection. Example: mysql_query("INSERT INTO table VALUES('" . sql_sanitize($_POST["variable") . "')"); Instead of: mysql_query("INSERT INTO table VALUES('" . $_POST["var...
34 10293 posted 17 years ago by engel
Another handy trace snippet
1 1023 posted 18 years ago by ypmits