String.removeCharAt
6
This snippet generates a secure hash string using VB.NET
6
Return object by type. Revision 2.
7
Just a small snippet I discovered when I was tired writing somearrayname\[i\] I thought there was something like foreach in javascript but couldn't find any so why not make one?
For those foreach(){...} lovers.
Hope it makes your life easier.
For those foreach(){...} lovers.

Hope it makes your life easier.
7
The modus operandi for this is similar to that taken by PHP's implementation of such functions. It's comparitively memory-intensive, but is much faster than running a whole bunch of tests.
Basically, you set a mask -- an array of 256 null bytes -- and set those that correspond to characters you wish to trim. Then, rather than having to test if a character is in the set of characters to trim(O(n), or linear time on *ws), you just test once (O(1), or unit time) to see if the byte in question is set.
And of course, to trim(), you just wrap trim() around both ltrim() and rtrim().
One point of caution: these functions trim in place, so copy strings before trimming them. (Of course, if you usually want access to both pre- and post-trimmed strings, you could always make these malloc() a new string and return a pointer to it . . . )
Basically, you set a mask -- an array of 256 null bytes -- and set those that correspond to characters you wish to trim. Then, rather than having to test if a character is in the set of characters to trim(O(n), or linear time on *ws), you just test once (O(1), or unit time) to see if the byte in question is set.
And of course, to trim(), you just wrap trim() around both ltrim() and rtrim().
One point of caution: these functions trim in place, so copy strings before trimming them. (Of course, if you usually want access to both pre- and post-trimmed strings, you could always make these malloc() a new string and return a pointer to it . . . )
7
Turns any string backwards. If you input "Test" it gives out "tseT". Hope it's useful.
The snippet shows how to use it.
The snippet shows how to use it.
7
A websafe colour palette generator in JavaScript. Coded this after looking at http://www.bytemycode.com/snippets/snippet/585/ and wanting to do it differently.
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles
7
Returns an array with all the objects with certain class. tested on IE 6 and Firefox 2
7
I use this function when passing an array to a function being called from setTimeout();
7
mattrmiller
Formats milliseconds into a duration string.
7
Remove newslines from a string.









