07. February 2014

Getting Started With Espruino

I was excited yesterday to see that my Espruino, which I backed on Kick Starter, had arrived in the mail. Espruino is micro controller that is controlled via JavaScript. I’ve long wanted to experiment with micro controllers, having visions of working with arduinos or a raspberry pi, but the JavaScript control combined with the reasonable price tipped the scale in favour of Espruino.

more

06. February 2014

Adding Arbitrary Code to your <head> in Magento

Magento’s built in addJs method in the Mage_Page_Block_Html_Head class assumes that files will be hosted locally. This isn’t always desirable. E.g. you may want to use Google’s CDN to host jQuery.

This can be accomplished by adding the following to your layout xml:

<reference name="head">
            <block type="core/text" name="my_head"></block>
        </reference>

Now, in your controller you can add anything into this block that you want, like so:

$google_url = 'http://google.com/jquery.js';
$this->getLayout()->getBlock('my_head')->setText("

            <script src='$google_url'></script>

        ");