Archive for the ‘programming’ Category
javascript; sending me insane
>>> [] [] >>> [] == true false >>> [] == false true >>> [] == [] false >>> false == false true
total mysql rows
Turns out our Mysql server at work is a little bigger than I thought: Databases 75 Tables 1,549 Rows 1,018,085,348 However over the last couple of months, we’ve only averaged 130 queries/second Hacked up PHP to gather stats: class MysqlCounter { public function __construct($host, $username, $password) { [...]
WoW Combat Log Splitter
Something quick I whipped up last night, after noticing that after my log file was > 4GB the WorldOfLogs parser will no longer do real time logging. Edit: Turns out that the WoW client itself stopped logging, even though the log file was a little over expected limit (4,334,806,196 bytes) Note: The code is just [...]
array_unique javascript snippet
function array_unique(a) { return a.reduce(function(u, e) { if(!(e in u)) u.push(e); return u; }, []); }
Javascript map-sort
I’m sure sorting method has a real name, but I’ve had no luck searching for it. function mapSort(array, mapFunction, sortFunction) { // Store both original value, and transformed value var mapData = array.map(function(e) { return [e, mapFunction(e)]; }); // [...]
i hate working with dates
This little snippet gets all the days in a month, and groups them by week. <?php error_reporting(E_ALL); // Return an array of all the days in a month grouped by week number // (Sunday is considered to be the first day of the week) function weeksInMonth($month, $year) [...]
