I recently watched David Heinemeier Hansson’s (@dhh) video on code comments and refactoring. While it’s interesting to see how he tackles these code changes, the most interesting thing to me is what he said he does with the codebase.
“I read through the entire codebase of Basecamp 3 and try to make things better that I don’t think are good enough, or revisit decisions that we’ve made earlier that I think now I have a better idea of how to do”
There’s a lot in that statement, so let’s unpack it.
First, he reads through the entire codebase! The…
One common issue that I see with Laravel newcomers is that they have hangups using Eloquent correctly. The most basic reference given in the documentation and tutorials is using the
$users = User::all();
But what happens when you want to sort your users?
As a newcomers to the framework, I feel like most are too excited to “jump in and build something” instead of learning more about it. (But who can blame them, right?!?) So something like this would happen:
$users = User::all()->orderBy('name', 'ASC'); # BadMethodCallException with message 'Method orderBy does not exist.' // or $users = User::orderBy('name'…
Laravel queues allow you to defer long running, or resource intensive, processes until a later time. A queue system is imperative for larger applications, but can be helpful for smaller ones as well. But with so many jobs and queues, how can we prioritize them?
On a current project, I had to figure out how to grab a ton of data from an API (Facebook) that had dependent data — meaning the script cannot proceed to get new data before it’s done with the current data set. …
Image manipulation is hard. Handling images in the long term is even harder. Here at Dose we have a lot of images and a number of ways to serve them. We have Android and iOS apps, as well as completely responsive websites, so each image has the potential of getting manipulated multiple times depending on the device, orientation, and how we optimize an image for a certain platform.
We used to have an internal image service that took an author’s uploaded image and handled some pre-processing. On upload, we’d make sure it’s within a max width and encoded correctly. Animated…