Welcome To Snipplr
Everyone's Recent Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Escape all special regex characters (.*+?|()[]{}\) from a string. Useful when dynamically building a Regular Expression object based on input text that could hold regex characters.
2
1376
posted 16 years ago by kouphax
similar to php ereg_replace.
You can pass this pattern [^A-Za-z0-9] and "" to remove from string non alphanumerical chars:
s = ereg_replace("[^A-Za-z0-9]","",s)
I use this function to clean input fields...
0
1129
posted 16 years ago by ginoplusio
Based on templates by luxuryluke and Kevin Hale.
Basic XHTML 1.0 layout which includes basic layout structure and is prepared for jQuery. On load a 'js' class is added to the root element in order to nicely handle graceful degradation if JS is dis...
8
1387
posted 16 years ago by nighthawk
Thanks to Matt Farina
This snippet is useful for preloading content with media that has been received via an AJAX request. For simple preloading of known images, see similar snippet.
6
1085
posted 16 years ago by nighthawk
Thanks to Matt Farina
Also see similar snippet for preloading arbitrary content, e.g. media in content received via AJAX.
14
1216
posted 16 years ago by nighthawk
I copied this from my working example and tweaked some lines to make it generic. Thus there MAY be a typo which I haven't checked for, but probably not. This is what's needed to have something change upon selection of an item in a ComboBox.
0
1126
posted 16 years ago by Winkyboy
This code, when placed at the end of the body tag will set focus on the first visible enabled element on the screen. It considers visibility as well as all forms on-screen
0
805
posted 16 years ago by kouphax
Secure, Advanced, Better, Faster... function for remove/strip tags(Anti-XSS).
2
1412
posted 16 years ago by YPY
You will need to download a few things to easily create rounded corners. They are jQuery (http://jquery.com/) and the jQuery rounded corners plug-in (http://www.malsup.com/jquery/corner/).
14
1290
posted 16 years ago by chrisaiv
I needed a quick way to unescape a URL Encoded string. I found 2 chill ways
2
914
posted 16 years ago by chrisaiv
This is a CS3/AS2 Flash file containing a simple particle system. It requires the use of MC Tween (http://hosted.zeh.com.br/mctween/).
0
982
posted 16 years ago by Winkyboy