Popular Tags:

Git Cheatsheet

May 21, 2014 at 12:20 pm

gitHere are some of the git commands I use daily (but still tend to forget from time to time):

push a new branch + create it on server: git push -u origin yourBranch
add a tag to a branch git tag <your tag>
push those tags git push –tags

Print and die, with Laravel

April 15, 2014 at 2:16 pm

laravelFor long time I thought I was the strange programmer that needed something that nobody else could possibly want.

The need arises almost daily for me to see the contents of an object in PHP. XDebug and tracing through code is convenient but often overkill. Sometimes you just want to be able to:

    print '<pre>';
    print_r($someObject);
    die();

Sure, you might think that “var_dump” is the solution to this, but “var_dump” just solves one part of the problem, namely the printing part. So far many projects I would create my own method, called “p”. It would often do the trick:

    function p($object) {
        var_dump($someObject);
        die();
    }

Which I could then call:

    p($object)

It wasn’t until Laravel that I’ve come across a built-in way to get this done quickly and without adding any extra fuzz.

    dd($object)

You can read more about the “dd” function here.

And FYI, Laravel rocks! I’ll be posting more about it in the weeks to come. I’m still learning, but so far it kicks beats Zend and Yii by a long mile.

Finally an easy way to test your .htaccess file

April 1, 2014 at 11:31 am

Ever write a long complicated .htaccess file only to not have it work like you thought it would? Then this tool is for you:

http://htaccess.madewithlove.be/

Posting an Array to a URL using Curl

April 1, 2014 at 8:51 am

Adding this snippet because I often find myself needing this. This will allow you to grab a url using CURL while posting variables to that URL.

    function makeCurlCall($url, $json = array())
    {
	$ch = curl_init();
        curl_setopt($ch, CURLOPT_VERBOSE, false);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_FAILONERROR, 0);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

        if (!empty($json))
        {
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
        }
        return curl_exec($ch);
    }

Explode (split) a string on multiple delimiters

March 20, 2014 at 2:34 pm

This is the most elegant solution I’ve found so far:

function explodeX($delimiters,$string) {
return explode(chr(1),str_replace($delimiters,chr(1),$string));
}

Free WiFi Hotspots in Cape Town

March 19, 2014 at 10:39 am

free-capetown-wifi-hotspotsA friend showed me this digital bundle of joy just a few moments ago. See a map with a complete list of free WiFi hotspots in Cape Town. Check it out here:

https://mapsengine.google.com/map/u/0/edit?mid=zpX-MvdqQIcQ.kxtx-tf5Tu1M

 

Free Stock Photos!

March 17, 2014 at 4:50 pm

Free Stock Photos for your WebsiteEver needed some high quality images for your website or blog? Then check out www.mastersnaps.com. They offer free photos that you can use on any site or blog. Only catch is you must offer a link back to them, but the good news is that the link doesn’t have to be something that gets in the way. You can request that it goes on a “credits” page or anywhere that works for you. Their collection is growing every day and allows for easy searching using keywords.

Need to extract e-mails from a large chunk of text? Try this!

March 3, 2014 at 6:27 pm

You can easily extract e-mail addresses from a big chunk of text using this:

http://emailextract.org/

Facebook Bought Whatsapp…

February 25, 2014 at 6:05 pm

mademelol

How to install PostGIS for Postgres on Ubuntu?

February 21, 2014 at 9:47 am

From the command line:

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install postgresql-9.1-postgis

And then don’t forget to restart Postgres:

sudo service postgresql restart