You'll find the most recent articles listed first.

Make PHP More Useable - Returning Multiple Values from Functions

Use Golang inspired pattern to easily return multiple values from PHP functions.

Thursday Jul 16, 2015 — 2 minute read — 395 words

If you’ve ever used Go it’s hard to not find returning multiple values from functions conspicuously absent in other languages. In this case, we’ll look at a simple way to implement the same design pattern effectively in PHP. Why It’s Useful So why return multiple values from a function anyway? If you’ve never used Golang or a similar language which allows that, it may not be readily obvious. Most use-cases in Golang are centered around errors, so it’s very easy to check if a function encountered a error.

Read More

Golang Hot Code Reloading

Developing golang code with automatic hot reloading on Ubuntu

Saturday Jan 10, 2015 — 3 minute read — 631 words

When developing server code in Go, it can be a bit of a pain to compile and restart the servers constantly. While some frameworks do this for you automatically, you may not be using such a framework. Then what? Thankfully, the solution is quite simple. It should only take a few minutes to get up and running with this, and all your future hacking on Golang powered servers will be a lot easier.

Read More

Redirecting to HTTPS with Nginx and Apache

Ensure communications are secure by redirecting all traffic to https.

Sunday Dec 14, 2014 — 2 minute read — 319 words

Secure, encrypted communications are more important now than ever before. As a result, it’s not uncommon to want to force all website traffic to be sent over an ssl connection. How can this be accomplished? Nginx Configuration This one a bit more difficult to track down, as there seem to be a lot of ideas out there. Here’s what I found works. Obviously, substitute your domain name in the example below.

Read More

Ignoring Symlinks in Git Repos

Keeping unwanted symlinks out of your repositories.

Monday Sep 29, 2014 — 1 minute read — 163 words

While working on a project that does a lot of symlinking by default, the need to keep symlinks out of the Git repository became evident. Fortunately, it’s not too hard. The solution came from this post’s answers. Thanks guys! The Command Just run the following command from the base directory of your Git repository, and it will automagically add all the symlinked files to the base .gitignore file. for f in $(git status --porcelain | grep '^??' | sed 's/^??

Read More

Building Firefox OS for the Flatfish Tablet from Ubuntu

Getting started with the latest builds of Mozilla's Mobile Operating System

Monday Sep 22, 2014 — 3 minute read — 580 words

For reference, this was done using Ubuntu 14.10. If it works for you on other versions, please let me know! First off, make sure to familiarize yourself with the official instructions for building Firefox OS, as we’ll be following them. Start off by following the prerequisites for Ubuntu 13.10 on the MDN site sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git lib32ncurses5-dev lib32z1-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip libxml2-utils sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 1 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 2 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 1 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 2 sudo update-alternatives --set gcc "/usr/bin/gcc-4.6" sudo update-alternatives --set g++ "/usr/bin/g++-4.6" You’ll also need various Android tools as well, so make sure they are installed.

Read More

Time Tracking with Google Analytics

Simplify time tracking by using Analytics software already used by your project

Tuesday Aug 12, 2014 — 2 minute read — 396 words

Note - This post specifically mentions Google Analytics, but the principles would apply equally to any analytics software, like Piwik, for example. Time tracking is a pain. There are apps and services that can help. Nonetheless, it’s not the easiest thing to do. One solution I stumbled across lately is Google Analytics. It requires almost no effort and is quite accurate. How to Use Google Analytics for Time Tracking Simple insert the tracker into all pages and repositories/issue trackers you use.

Read More

Writing Your First Unit Test with the Ionic Framework

A quick primer to get started with hybrid app unit testing.

Friday Jul 18, 2014 — 5 minute read — 865 words

Writing tests - both unit and functional tests, is key to the stability and maintainablity of any piece of software. HTML and JavaScript apps are no different. So we’ll cover a super basic overview of writing your first unit test for apps build with the Ionic Framework. While Ionic is a pretty cool framework, unit testing is mysteriously lacking as of the current release (1.0.0). Let’s hope that it starts shipping with skeleton tests out of the box.

Read More

NodeJS Package Conflicts on Ubuntu 14.04

Fixing issues with installing Cordova command-line tools on Ubuntu

Wednesday Jul 16, 2014 — 1 minute read — 157 words

If you’re developing with Cordova/PhoneGap/Ionic apps on the Ubuntu platform, chances are you’re using the cordova-cli package. For a while now, the nodejs and nodejs-legacy packages have collided around a singe man file. Unfortunately, the simple file collision can break the entire package manager and make it difficult to update anything. Add dkpg --force-overwrite Flag The solution is very simple. Just add the dkpg --force-overwrite flag to your apt-get commands. So this: sudo apt-get install cordova-cli becomes: sudo apt-get -o Dpkg::Options::="--force-overwrite" install cordova-cli Of course, you probably don’t want to type that all the time.

Read More

Anahita Social Custom Development Workflow

Ensure you get the latest code without overwriting custom core changes.

Monday Jul 14, 2014 — 2 minute read — 394 words

Anahita is a cool open-source social networking platoform written in PHP. It has a super-active, helpful community lead by Rastin Mehr. If you’re working on a website that’s powered by Anahita, you’ll want to keep up-to-date with the latest code changes via composer. If you’re not familiar with Composer, visit the project homepage to get up to speed. Updating the Anahita Codebase Updating the Anahita codebase is trivial with composer. Just cd into the root directory and run the following to get the latest and greatest: composer update Before you do that, though, read on.

Read More

Anahita Social HTTP Authentication

Integrating HTTP Authentication into Anahita social core

Monday Jul 14, 2014 — 3 minute read — 560 words

Here’s how to solve another potentially tricky challenge when developing third-party integrations with the Anahita social networking platform. The current version of Anahita (3.0.x) uses Joomla and the Nooku framework to provide an out-of-the-box JSON api. It’s cool and it seems to work well. One neat (but hidden) feature is that it supports standard HTTP authentication. That’s super, as there’s no need to worry about using cookies for authentication, allowing for more or a classic stateless REST experience.

Read More