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...


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

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...


Apache Rewrite Rule for Mapping to index.php in Sub Folders

Below is an example URL structure with rewrite rules using an Apache .htaccess file. GET /a/ => a/index.php GET /a/b/ => a/b/index.php...


Manual ManyToMany Through with Django's ORM

Here is a code snippet that demonstrates how to set up a __ManyToMany through__ relationship in Django. In Rails, the equivalent would be called a __h...


How to Read Response Body HTML with Javascript Fetch Method with React Native

In React Native you see a lot of tutorials and articles using the `fetch` method when interacting with `JSON` APIs. It's great for this and the the pa...


How to Fix Raw query must include the primary key with Django ORM

When running raw SQL queries in Django you must include a primary key otherwise an invalid query exception is raised. Normally this is fine but when r...


Simple SQL for Counting New Signups

Here is a little snippet that will return new signups (or new records) for today select id, email, created_at::date date from signups where ema...


How to Find An SQLite Database with React Native and the iPhone Simulator.

I spent a few hours digging around my file system using `find` and `grep` hunting for my SQLite database that the iPhone Simulator was using for my Re...


Active Admin Rails 5 undefined method per_page_kaminari

If you run into this error in development, using Rails 5 and Active Admin NoMethodError - undefined method `per_page_kaminari' Try the followin...


Regex for Extracting URLs in Plain Text

Here is a Regex for extracting URLs from text. However, these links will not already be hyperlinked or source attribtues from images or iframes. T...