Category Archives: Programming

Show Number of Facebook Likes in PHP

If you run a Facebook page, and you are starting to build up some good numbers, you may want to show them off on your website. Facebook allows you to embed a Facebook widget on your homepage, but that means you are using third-party scripts, and you can’t control the design. Here is a simple PHP snippet for displaying your Facebook Likes on your website.

$facebook_page_id = "127012630783508";
$results = @simplexml_load_file("${facebook_page_id}");
echo $results->page->fan_count;

setInterval is Bad

I got another reminder today of how bad setInterval can be. You just don’t hear¬†developers talking about the problems with setInterval. In fact, I’ve seen numerous tutorials where good developers are using it in their examples. We need to start addressing this and start talking about the problems with setInterval. Continue Reading

Upload Files to AWS S3 using Laravel

Update: Freek Van der Herten has an updated version of this tutorial, which is better on memorey and supports larger file uploads.

Uploading to Amazon S3 can be a great way to keep your files loading quickly with their CDN, and allow you to work more on your code, rather than your filesystem.

Laravel 5’s new FileSystem makes this easy, but lacks a lot of documentation for how to actually accomplish this. First thing we need to do is tell our controller class to use the Filesystem contract and the Request class. Continue Reading

FireFox Bug using FlexBox and Percentage Based Margins

There seems to be a small bug in FireFox when you are using percentage based margins and Flexbox. If you are using Flexbox, and you have set a percentage based bottom or top margin, they are not applied in FireFox. I have setup a CodePen to demonstrate the problem and you can track the Bugzilla file. The margin is applied correctly in Chrome, Safari and Internet Explorer. Continue Reading

When Random Isn’t Random Enough

I use to play online poker a lot, but lately not so much. Mostly because the sites really took a hit since Black Friday. Getting to see how the original shuffle algorithms work is awesome, albeit a little disturbing when you see how exploitable they used to be. I do believe this has changed, and random shuffles are audited now.

Direct Link