My name is Sean Behan.

I write about #software, #SaaS, #consulting and #mobile app development

I work with #Python, #PHP, #Swift, #Ruby, #ReactJS and #Postgres

Let's connect on...


PhotoLocationChanger
Easily change the location on your photos and videos
Click here for more info about the app
PhotoDateChanger
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app

From the Archives

How to Time Piped *nix Commands

If you want to time how long a piped bash command take, use the `time` command followed by your commands in parens like so.. time (ls -lha | wc -...


How to Parse Query Strings in PHP

Here is a quick snippet for parsing query strings in PHP. You can use the `parse_url` and `parse_str` methods. `parse_str` will create a variable for...


How to import CSV into SQLite3

To import a CSV file into SQLite is easy. sqlite3 my.db .mode csv .import path/to/file.csv name_of_table And done....


How to Cast an Array to an Object with PHP

It's short and sweet. $obj_from_array = (object)['key'=>'val']; echo $obj_from_array->key;...


How to Tag and Push a Release with Git

Set the `-a` and the `-m` flags like so git tag -a v1.0.0 -m "Note about the release goes here" Then to push the tag to a repository git...


How to Make an iOS App Icon from a File on the Command Line or Web Browser

If you need to make iOS app icon assets from a photo, take a look at the [Make App Icon](https://makeappicon.com/) website and API. They will let you...


Simple Way to Calculate the Odds of Something Happening

Here is a quick way to express a chance of something happening. This is an example in JavaScript that gives you a 1 in 3 chance of being true....


PHP Headers for Sending CSV File Downloads

If you would like to force a file download prompt to the user, instead of just outputting the text to the browser, use the following headers. <?ph...


XPath with HTML in PHP One Liner

Here is a one liner for using XPATH with HTML in PHP $doc = new DOMXPath(@DOMDocument::loadHTML(file_get_contents("https://www.reddit.com/r/PHP/")...


How to Calculate Age with PHP

Calculate age in PHP $your_birthday = '1982-08-29'; $difference = date_diff(date_create(), date_create($your_birthday)); $age = $differe...


How to Use Named Variables with Postgres and PHP PDO Driver

You can write reusable scripts with Postgres by taking advantage of named variables. A named variable starts with a `:` in your sql script. Here i...


How to Get a Random Item from an Array in PHP

Use this snippet for grabbing a random item from an array in php $fruits = ['apple', 'banana', 'carrot', 'date', 'elderberry']; echo array_ran...


Connect to Postgres on Heroku using DATABASE_URL Config Var with PHP and PDO

Unfortunately PHP's PDO constructor doesn't take a database connection url (in a format that Heroku makes available as a config var) as an argument. I...


How to Slugify a String in PHP

Here is a snippet for generating a URL friendly slug in PHP function slugify($string){ return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/...


How to Generate a UUID in PHP

Here is a little snippet for generating a UUID in PHP function uuid(){ $data = random_bytes(16); $data[6] = chr(ord($data[6]) & 0x0f | 0x4...