Share Your Salary App Part 1

In a previous project, I built “Who’s that person in that thing?,” a JavaScript web app that called The Movie DB’s API to find common actors given two movies. That was fun, but I still wanted to build an API service myself and I wanted to experiment with some new tools. But first I needed a project idea as an excuse to use them.

Project Idea/Application Premise/The Excuse

People are funny about money, especially about their salary. With most people, it’s a taboo to talk about it. But everyone’s been curious at some point to know how they compare to their peers. Some people fear they are getting paid less to do the same work as others, and sometimes that fear is founded in fact. The “Share Your Salary” app is an anonymous salary survey tool to address these kinds of use cases.

Before we get into any of the tools or how-to, feel free to check out the application first or look over the source.

Demo Source on GitHub

New Tools


Well I started to write this section, turned out to be about a thousand words… so I moved it to it’s own separate post. In short, OpenShift is a PaaS hosting service. OpenShift hosts the entire Share Your Salary app, including a MongoDB container, an HAProxy load balancer, and Apache/PHP containers in an auto-scaling group.


MongoDB is a highly scalable NoSQL database. MongoDB is a document database and uses JavaScript Object Notation (JSON) to represent those documents. I really like JSON, but PHP doesn’t ‘speak’ JSON natively, which makes using MongoDB a little less intuitive. I wrote a separate MongoDB and PHP Primer post to go over some of the basics.

I used MongoDB as the backend for the “Share Your Salary” app.

Fat Free Framework

Fat Free Framework (or F3 for short) is a tiny PHP framework (it’s only ~65 KB in total) that provides URL routing, caching, page templating, and built-in database support for MySQL, SQLite, MSSQL/Sybase, PostgreSQL, MongoDB and F3’s proprietary flat-file DB called Jig.

I used F3 for both templating web front-end as well as the API.

Swagger UI

Swagger UI is a must if you are building a RESTful API service – it acts as both a documentation method and a test bed. As the developer, you complete a JSON file that describes your API routes, methods, parameters, etc. Swagger UI transforms that JSON into a web page and API client that uses JavaScript to send HTTP GET/POST/PUT/DELETE requests to your API service and displays the results. Check out the Swagger Petstore Demo.

Read more

MongoDB and PHP Primer

I recently used MongoDB in the Share Your Salary app and had a few hiccups as I tried to blunder my way through learning how to use it. MongoDB, like many NoSQL document databases, uses JavaScript Object Notation or JSON to represent the objects/documents. JSON is great, especially when you’re using JavaScript in conjunction. PHP, however, doesn’t ‘speak’ JSON natively; it uses arrays instead, and this makes for some less than intuitive interactions. This post will go over some of the basic CRUD operations using PHP against a MongoDB.


Connecting is pretty straight-forward:

If you’re using OpenShift, you can simply use the relevant environment variables:

Read more

Introduction to OpenShift

OpenShift is a Platform-as-a-Service offering provided by Red Hat. It’s built on top of Linux containers (which they refer to as ‘gears’) hosted in Amazon’s Amazon Web Services (AWS). They offer many different platforms such as PHP/Apache, JBoss, Tomcat, NodeJS, Python, Ruby-on-Rails, and many more. OpenShift refers to these pre-built platforms as ‘cartridges.’

Beyond the platforms they offer, OpenShift also takes care of DNS (you are given a * subdomain), load balancing via HAProxy, and auto-scaling for your application. Much like Heroku, code deployment is as easy as executing a git push. All of these features, including 3 containers, are all free of charge.

Red Hat has done a good job making OpenShift “cloudy” – for example, database connection strings are handled by environment variables. This is cloud-friendly because:

  1. Your source code can now reference the environment variables instead of storing credentials in your source (preventing you from using public repositories) or having a separate private deployment repository with credentials that you have to manage.
  2. Your source code can now be deployed instantly in another OpenShift environment, no need to change credentials in the code.
  3. You don’t have to worry about passing credentials to new instances during auto-scaling, OpenShift takes care of it for you.
  4. Your application and operations folks can deploy and manage your application without them having access to the database credentials.

This is just one example but I think it does a good job illustrating the foresight Red Hat had when they built OpenShift.

If you’re a developer and don’t want to worry about the infrastructure details yet, OpenShift is really an amazing service. You can set up an application in just a few minutes, I’ll show you how. Let’s get started.

Continue to the setup instructions

“Who’s that person in that thing?” App

I’ve been looking for an API project for awhile now, either to write an API service or a client/app that consumes one. Then I finally thought of a use case – an app that would allow you to find an actor based on two movies they’ve been in, using only JavaScript and APIs. It took me awhile to find a movie API service that was free and suited my purposes, then I found TheMovieDB (which has a pretty sweet API actually and is free to use). Check out the demo and grab the source from GitHub if you want to do something similar.

Demo   Source on GitHub


HTML5 Resume Template


I’ll keep this short since it’s not a proper how-to post or lengthy tutorial. I recently discovered a resurgence in the concept of HTML resumes and was thoroughly impressed. As always, I recklessly decided I should take a stab at it myself even though I knew I was out of my depth. Ended up with a half-decent HTML5/responsive/mobile-friendly resume using Bootstrap 2.3 and wanted to share it with the masses. Check out the demo and if you want to build on it, grab the source. Enjoy.

Demo   Source

1 2 3 9