Archive for the ‘programming’ Category

javascript; sending me insane

>>> [] [] >>> [] == true false >>> [] == false true >>> [] == [] false >>> false == false true

Posted by Matthew on January 19th, 2010

Filed under javascript, programming | 1 Comment »

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)     {   [...]

Posted by Matthew on September 9th, 2009

Filed under mysql, php, programming | No Comments »

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 [...]

Posted by Matthew on September 4th, 2009

Filed under games, programming, python | 2 Comments »

array_unique javascript snippet

function array_unique(a) {     return a.reduce(function(u, e)     {         if(!(e in u))             u.push(e);         return u;     }, []); }

Posted by Matthew on February 23rd, 2009

Filed under javascript, programming | No Comments »

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)];     });         // [...]

Posted by Matthew on January 20th, 2009

Filed under javascript, programming | No Comments »

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) [...]

Posted by Matthew on August 21st, 2008

Filed under php, programming | No Comments »