Category: Uncategorized

Devving on Windows is a PITA.

Anyway, ever seen a message like this?

warning: LF will be replaced by CRLF in tests/unit/Del/Console/CommandTest.php.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in tests/unit/Del/Console/CommandTest.php.
The file will have its original line endings in your working directory.

We only want LF. To squelch this crap, run the following:

git config core.autocrlf false


In PHPStorm, you can do a regex find and replace. To upgrade a crappy old site using <?, just use the following regex:


Apple Wireless Mouse on Windows

So I left my work laptop’s PSU in Scotland. Oops! I also left my cheap mouse alongside it (I hate the touchpad thingy). So that left me with my Apple Wireless Magic Mouse, the touch sensitive one.

Once you hook it up with Bluetooth, you’ll notice the touch scroll doesn’t work. 😦
So let’s fix that!

As you know, Mac can run Windows using a thing called Bootcamp, which has the drivers we need. Download either the 32 or 64 bit version depending which Windows you are running.

Using 7-zip or something similar, right click the downloaded exe and and extract it somewhere. Once extracted, go into the BootCamp31ToBootCamp303 folder.

Look for a file called Binary.MultiTouchMouse_Bin. Right click on that, and extract the files somewhere. These are our drivers!

Once you’ve done that, run DPInst.exe, which will install the drivers.

Scroll now works! But ah! Macs scroll the opposite way around, like a touch screen, we push the page up or down. If you’d like to flip the scroll “wheel”, do the following:

  • Open Control Panel > Devices & Printers > Bluetooth Devices
  • Right click and choose Properties
  • Select HID compliant mouse, and click properties
  • Choose the Details Tab
  • Select Device Instance Path, note the value
  • Open regedit (Start > regedit)
  • System
  • Current Control Set
  • Enum
  • HID
  • Now follow the device instance path from the mouse properties
  • Device Parameters
  • Double Click FlipFlopWheel
  • Change 0 to 1 (turn flip flop wheel on)
  • Now disconnect and reconnect your mouse

Your mouse now works exactly the same way in Windows as it does on your Mac. Have fun!

DOMDocuments are cool, and a really nice way of dealing with HTML in an OO fashion. However, sometimes, we have an HTML string element which we need to add to our Document. Here’s how you do it:

    function createNodesFromHTML(DOMDocument $doc,$str) 
        $nodes = array();
        $d = new DOMDocument();
        $child = $d->documentElement->firstChild->firstChild;
        while($child) {
            $nodes[] = $doc->importNode($child,true);
            $child = $child->nextSibling;
        return $nodes;

        $dom = new DOMDocument();
        $icon = '<i class="fa fa-remove"></i>'; // This is our string

        $button = $dom->createElement('a');
        $button->setAttribute('href', '/whatever/delete/12345');
        $button->setAttribute('class', 'btn btn-sm btn-danger');
        // This is us turning the string(s) into nodes we can add
        $nodes = createNodesFromHTML($dom, $icon);
        echo $dom->saveHTML();

Editing CSV’s in PHPStorm

I was looking for a CSV plugin for PHPStorm, but it turns out there is no need. Open your CSV (which you associate with a plain text file), right click, and select edit as table!

Notice how much better that looks!


Now that my VM is completely configured through puPHPet’s puphpet/files/exec-once shell scripts, I had to change PHP settings for the legacy 5.3 install. At first I echoed the setting out and concatenated it onto the end of the string, however the setting was already uncommented above.

The answer is to use sed to find and replace the line of text, like this!

cat /etc/php.ini | sed -e "s/short_open_tag = Off/short_open_tag = On/" >> /etc/php.ini

Git tree view in CLI

Easy. Create an alias:

git config --global alias.tree "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n' --abbrev-commit --date=relative —branches”

then just run

git tree

Screen Shot 2016-02-09 at 15.49.21

cat ~/.ssh/ | ssh user@host ‘cat >> .ssh/authorized_keys’

fix puphpet bind error

The bind command `bindfs --perms=u=rwX:g=rwX:o=rD --user=www-data --group=www-data /mnt/vagrant-vflsf_hshd6x5eenjw /var/www` failed to run!

I still don’t know exactly why it’s happening, it’s like deprecation warnings or something! I am using too new a version of something.

Until I do know for certain, this is what I do to fix it:

sudo bindfs --perms=u=rwX:g=rwX:o=rD --force-user=www-data --force-group=www-data /mnt/vagrant-vflsf_hshd6x5eenjw -o nonempty /var/www


Source: Using LetsEncrypt to get a free SSL Certificate (on VestaCP)