2015 In Numbers

At the end of every year I like to look back and see what all I accomplished. Since almost everything I create and work on is online, generating stats and data is relatively easy. Plus many services are now sending “year in review” emails so it’s all automated. Here are some of this years numbers for Laravel News and this site.

Laravel News

Here is the break down for this year on Laravel News

  • 1.5 million views with the best day bringing in 27k.
  • 356 new posts, growing the total to 1,053 posts. Down from 679 last year.
  • Longest posting streak of 6 consecutive days. (I typically take the weekends off)
  • Most popular post was the Laravel 5 release announcement because it hit the front page of hacker news.
  • Top referring sites: twitter.com, facebook.com, news.ycombinator.com, laravel.com. Thanks to all the others that linked to the site.
  • Most visitors came from The United States, United Kingdom, & India. 212 countries in all.
  • The Laravel newsletter grew from 3,260 subscribers to 11,650.

Eric Barnes (this site)

For this site which gets almost no love.

  • 230k views with the best day bringing 1,800. Last year total views was 50k.
  • 33 posts published bringing the total to 114.
  • Setting up Gulp, Bower, Bootstrap Sass, & FontAwesome was the most popular post and it wasn’t even published this year. Search engines still reign.
  • Most visitors came from The United States, United Kingdom, & India.

I don’t think there is anything to really learn from these numbers except to show up everyday and eventually something will hit.

How To Teach Your Child To Ride A Bicycle And Be Safe

For almost a decade I was a motorcycle safety instructor and taught a lot of students how to ride and more importantly how to ride safely.

In my teaching experience, I came across two types of students. The first had never ridden a motorcycle before and the second is one with years of experience. The beginner was typically timid but listened well. The experienced knew how to ride but was full of bad habits. Can you guess which one was easiest to teach? It is common to assume that if someone can already ride then explaining to them their mistakes would result in quick correction. That is rarely the case because once a habit becomes ingrained it can take years of constant practice to change. Continue reading “How To Teach Your Child To Ride A Bicycle And Be Safe”

A Trip To Mount Mitchell

Living just outside of Charlotte, NC I have the ability to drive west a few hours and be in some of the most beautiful parts of the Blue Ridge Mountains. A short drive east takes us to the coast. Being in such a unique area, I can take the family on a day trip and experience as much of the outdoors as we want.

Today we decided to drive up to Mount Mitchell as it’s a place I’ve personally never been. What initially surprised me is from Charlotte to the peak is only 128 miles or two and half hours away. We loaded up the minivan and away we went. Continue reading “A Trip To Mount Mitchell”

How to send both HTML and Plain Text Password Reset Emails in Laravel 5.1

Laravel comes with an included Authentication system complete with password resets that saves you from the burden of having to set it manually on all your projects. In one of the apps I built, there have been reports of the password reset not making it to the end users. It just so happens that all email is being sent through a third party system which tracks sends and deliveries.

In this case, the emails were being sent and reported being delivered but the user kept claiming they didn’t receive it, the obvious culprit of it going to spam/bulk mail. In the research process, it was discovered that we only sent an HTML password reset without any text fallback. Maybe that was the reason?

This seemed like a simple improvement and could at least rule out that as a possibility. However, now all the mail is handled inside the Illuminate components and I couldn’t find any documentation on how to send both.

At this point, I started digging to try and see how Laravel is sending the email. Inside PasswordBroker I found an emailResetLink method which is how it is actually sent:

$view = $this->emailView;
return $this->mailer->send($view,

Now it’s just a matter of figuring out where “$view” came from and I didn’t have to look far. Inside the constructor it is injected:

public function __construct(TokenRepositoryInterface $tokens,
                            UserProvider $users,
                            MailerContract $mailer,
                            $emailView)

Next question is, where is the instantiated? Doing a project search for the class name lead me to the registerPasswordBroker in the PasswordResetServiceProvider. This pulls in from the config file:

$view = $app[‘config’][‘auth.password.email’];

Opening `config/auth.php` shows how it’s defined by default:

'password' => [
    'email' => 'emails.password',

Almost there. Going back to the mail documentation it shows you can send both with this call:

send(['html.view', 'text.view'], $data, $callback);

That means it’s just a matter of adjust the auth.password.email to be an array instead of the string:

'password' => [
    'email' => ['emails.password', 'emails.text-password]',
Don’t leave your users stranded–send both for an important email like this.

One of the benefits to Laravel is at almost every turn there is a simple way of solving a given problem and this is just one example. I hope by me outlining the steps I took to solve the problem it gives you insight into finding your own way around the next time you get stumped.

Get The Most Popular Posts From The WordPress API

As of right now the WordPress plugin directory holds 40,367 plugins. Finding the one you need is typically pretty easy with the hardest part choosing which one suits your needs the best.

In my particular use case, I am building a new section on a site that will be completely outside of WordPress. Even though it’s outside WordPress, I still wanted to pull in a list of the most popular posts.

Searching for most popular in the plugin directory returned 614 different plugins, but I couldn’t find any that would work in this context. A lot of them do their calculations by literally storing views for each visit. I see no reason to fill up my database with this data when an external system is already logging it. That is when I remembered WordPress has it’s own API and can be utilized directly from the Stats package.

I went on a mission to implement this and wanted to share how to do it. Continue reading “Get The Most Popular Posts From The WordPress API”

Install ALL Google fonts on your Mac

Lately, I’ve been designing a lot of blog post images and finding a good font from the list of defaults is sometimes hard. I came across the Web Font Load project by Quinton Pike that allows you to install all of the Google Web Fonts onto your local machine.

The only downside is it’s a ton of fonts, 1660+. Wading through all of them in a graphics app can be time-consuming, however, since many blog posts have been written on font pairings and you can easily find the best ones by doing a quick web search.

Passing Referrer data from SSL

Google is now recommending all sites to start moving to HTTPS by installing an SSL certificate. The benefits include a more secure experience and a rumored slight bump in SEO. I implemented Stripe payments on a site which required an SSL certificate and made the decision to go ahead and make the whole site run over HTTPS. One of the downsides to doing this is I noticed that referral data was no longer sent to sites I linked to.

For some, this may not matter but to me I look at referrer data as a form of marketing. When I link to a site and they see traffic from my site then they will not know I appreciate their work, and hopefully be interested enough to visit my site.

Sending Referrer Data

After a bit of research, I found a draft W3C spec on just this issue and it includes a simple fix in the meta section. By simply adding the following to your HTML you can send this data automatically:

<meta name="referrer" content="unsafe-url">

The W3C document outlines all the available options here and if you would like to have this more restricted please look at those options. For the purpose here unsafe-url, or all in older specs, will send a Referer HTTP header to any URL you link to. One thing to note is, “this will leak origins and paths from TLS-protected resources to insecure origins”. So if you are in admin area or something that shouldn’t be known to the outside world you would never want to use this.

In my case, the site is just a blog and I’m not concerned about leaking any information.

As a final caveat, this W3C spec is a draft. Some browsers Chrome and Firefox are already included support for this meta tag, but others might not be. So if that is important to you, then you will need to figure out a more advanced way of passing this data.