Tag: php.

Duplicating a Database Record in Laravel.

As I prepare to take my terrifying leap into hackademia, I’ve been freelancing a lot more lately—both as a way to freshen up some of my more rusty skills (Directing leaves little room for slinging code or technical writing), and as a way to offset some of the lost income...

MIME Type Validation Sucks.

An uncomfortable majority of companies that offer high storage limits for specific file types have a major problem: MIME type validation isn’t good enough. If you’ve ever had to implement file validation for user uploads, you’ve probably relied heavily on MIME type validation to ensure that the files you are...

Setting Up CloudFlare SSL for Laravel on Heroku.

CloudFlare. Laravel. Heroku. Despite being the keywordiest article title I’ve ever written, I really did have to solve this exact problem recently, and it took me longer than I’m proud to admit. Let’s face it: SSL is a pain in the ass. At least it is when it comes to...

PHP Binary Search Tree Implementation.

A Binary Search Tree is an ordered binary tree that has the following rules: The left subtree always contains nodes that have a value less than the current node. The right subtree always contains nodes that have a value greater than the current node. Each subtree must also be binary...

PHP Queue and Stack Implementations.

Continuing on my job interview study session binge, the next two data structures I have built using PHP are the traditional queue and stack. In computer science, stacks and queues typically go hand in hand, however they are opposite implementations of each other. A queue is a first-in-first-out data structure....

Quickly Determine If Two Strings Are Anagrams in PHP.

When interviewing with tech companies, there are a LOT of questions involving anagrams. While there are many different approaches to solving these questions, here is a simple one-line function that can determine whether or not two strings are anagrams in PHP. This approach utilizes the built-in PHP function, count_chars(). When...

A Linked List Implementation in PHP.

For the past few weeks, I have been going through the process of applying and interviewing with some amazing companies, the most exciting of which has been Facebook. Interviewing with Facebook has been an incredible experience which has challenged my knowledge of software development and computer science in so many...

Anonymize Your cURL Requests Using Tor.

Note: This post assumes that you already have Tor installed and configured on your server. If not, visit the Tor Project Homepage for instructions on how to set it up. I love writing web crawlers and data aggregators in PHP. They say knowledge is power, and I find it exciting...

Custom CodeIgniter Model Class.

For the past year, I have been an adamant CodeIgniter developer. The one thing that I have found lacking, however, is CodeIgniter’s model class. I am a big fan of the simplicity of CakePHP’s ORM structure, and wrote this model class to (slightly) mimic it. Some of the functionality in...