Generate random hex color with PHP

By Josh Sherman
1 min read
development
php
graphic design

There’s many ways to skin a cat, or generate a color. You could randomize a number between 0 and 16777215 then convert it to hex: $rand_color = '#' . dechex(mt_rant(0, 16777215)); Or you could do what I like to do, just md5 a random string and grab the first 6 […]

Run a block of PHP code a certain percentage of the time

By Josh Sherman
1 min read
development
php

Sometimes, you may want to run code all of the time. Other times, you may want to run code some of the time. This is how garbage collection in PHP works. Based on your configuration for gc_probability and gc_divisor, garbage collections runs a fraction of the time (defaulting to 1/100 […]

CSS `:not` issue in Safari on iOS9

By Josh Sherman
1 min read
development
css
safari
apple
ios

Seems that every time that Apple releases a new version of iOS I encounter some weird rendering issue. This time around with iOS9 I encountered an issue where the full / desktop version of the site looked like it still using some of the mobile / smaller device stylings. After […]

My experience with the Mandela effect

By Josh Sherman
2 min read
health

Remember that time I was bit by a dog? I sure as hell do. It was a choatic ordeal where I was living in fear of potentially contracting rabies as we waited to see if the dog that bit me ended up dying in quarantine. The doctor assured me that […]

It’s never too late to start tracking metrics

By Josh Sherman
1 min read
development
marketing

Dashboard-driven development, metrics-driven development, whatever you may call it, it’s super important. I’m embarassed to that this, but after running a successful site for over four years, I didn’t have a dashboard with even the most basic of metrics like new users per day or anything insightful about the site’s […]