Programming




Mozilla Developer Edition

I recently discovered Mozilla Developer Edition. {.alignnone width="832" height="456"} So far I've love it's inline ability to edit css. It's an entirely natural way to tweak the css on the fly.



LessPHP

Why would I want to use the php version of a native node.js project? Well, for starters not all projects are deployed on servers that have node.js installed. Second, well, the first one is pretty much the only reason. So with that out of the way, I ran …



Using Zend to retrive wikipedia api content

function getWikipediaContent( \$wikiUrl ) { // initialize HTTP client \$client = new Zend_Http_Client(); // Set it for wikipedia \$client->setUri( \$wikiUrl ); // Set url params for get request \$client->setParameterGet('action','query'); \$client->setParameterGet('prop','revisions'); \$client->setParameterGet('rvprop','content'); \$client->setParameterGet('format','xml'); \$client->setParameterGet('titles', \$urlSlug); // Get the wiki page via a get request …



JS logging

I've been doing a fair about of js development lately and console.log has been my friend. However, writing console.log() is a bit heavy. So instead I've been adding this to my files as a quick way to log in javascipt. function log() { if (window.console && console.log) console …



Remove empty values from an array.

I developed this little one liner to remove empty values from an array in php. \$tags = array( 'testtag', 'testtag2', ' ' ); \$tagsCleaned = array_filter( array_map( 'trim', \$tags ), create_function( '\$a', 'return \$a!="";' ) ); Breaking that down inside out. array_map( 'trim', \$tags ) Array map the trim function to all of the values within the array, removing …



Using the + sign to merge arrays in php

Today came across code that used the + sign to merge two associative php arrays. At first I thought it was broken but turns out you can indeed merge two arrays with the + sign. \$album = array( 'title' => 'King of Limbs', 'band' => 'Radiohead', ); \$album_meta_data = array( 'upc' => '486898161589', 'price' = '11.98' ); \$output = \$album …