Welcome To Snipplr
Everyone's Recent Snippets Tagged array
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This function will sort an array of DOM elements in order of the DOM position. Useful when using calls such as $$("img.L,img.M") which doesn;t return a sorted element array.
It uses prototype but you can replace the Prototype.Browser stuff with a...
0
1103
posted 16 years ago by kouphax
Repeatable Fisher Yates Array Shuffle based on given random string. If no seed is provided the current second will be used (not to use as a pure random shuffle... based on microseconds)
0
1043
posted 16 years ago by digdan
This was taken out of a presentation by eZ systems on PHP Best Practices
0
750
posted 16 years ago by luizlopes
ASP does not have a built in function to reverse or sort array like other languages. Find out how to do it.
1
1183
posted 16 years ago by neal_grosskopf
This function can validate and parse UK postcode like SW1A 1AA in to formated array.
2
1401
posted 16 years ago by naz
/* ---===[ EXAMPLE ]===--- */
var TT = new AssociativeArray();
TT.add("k-1", "Value 1");
TT.add("k-2", "Value 2");
TT.add("k-3", "Value 3");
TT.add("k-4", "Value 4");
alert(TT.to_string());
1
637
posted 16 years ago by vbert
/* --==[ EXAMPLE ]==--
var colors = new AArray();
colors.add("k01", {bk:"#fff",tk:"b",it:"hello"});
var oC = colors.get("k01");
var tT = '';
for(K in oC) tT += "[" + K + "]: " + oC[K] + "\n";
tT += "\n\n";
tT += oC.bk + "\n";
tT += oC...
1
975
posted 16 years ago by vbert
Returns the cartesian product of the receiver and the arrays given as arguments.
1
940
posted 16 years ago by ishikawa