Get in the zone with me for a good 15 minutes, maybe you’ll catch a few eclipse tricks and you’ll learn a little bit about how I think (and make mistakes along the way of fixing something on FrostWire)
Related Posts
Get a randomly weighted key in a Map/Dictionary/Associative Array
Here’s a very useful function to retrieve a randomly weighted key from an associative array in PHP. Sometimes you need to fetch random elements from a collection but you need some elements to have a little more chance than others to be fetched (business rules or whatever…) [php] srand(time()); //dont call this inside the function […]
Javascript Quicksort implementation with dynamic comparator.
[javascript] Array.prototype.swap=function(a, b) { var tmp=this[a]; this[a]=this[b]; this[b]=tmp; } function quickSort(array,comparator) { qsort(array,0,array.length,comparator); } /** * NOTE: the comparator is a dynamic function you will define like so comparator(a,b) { if (a > b) return 1; else if (a < b) return -1; else { return 0; } } * it is up to you […]