Understand the Tech Before Getting a Package
How often have you heard this phrase?
How often have you heard this phrase?
The other day I was looking for an image from one of my iMessage chats. When you browse through the attachments on the iPhone, it takes forever to scroll through them. At one point, I kept having the iMessage app crash as well (I think I was maybe 400 or 500 images into the history). Turns out, if you have your iMessage and iCloud accounts configured properly on your Mac, you’ll have duplicate copies of all the attachments (for at least the messages you haven’t deleted) on your Mac as well.
Github is one of the most useful tools I have in my arsenal. With over 100 repositories (some of which are private), it’s the best $7/mo I spend. However, there are a couple things about Github you might not know.
Every mistake comes with a lesson or two…
I’ve made a horrible mistake…
For some API work in Laravel, I wanted to validate that the incoming request parameter was a boolean value. At first I tried using the built in boolean slug validator but it didn’t accept all of the ‘boolean’ values I wanted to use. (Also there were weird scenarios where string values of false were triggering as true - like what I wrote about here.
It’s such a cliche by now - “We need a rockstar programmer” or “only code ninjas should apply” - but this choice in your job want-ad is ruining your business. Let me tell you why.
You can make use of guarded or fillable attributes in Eloquent models in Laravel to help control what values you might allow to be updated via your API. But, I wanted to go a step further and actually stop certain values from being passed in. You could go pretty wild with this and try to block everything, but that’s not what I did. I made this validator.
If you check out array_filter without a callback, you’ll notice that it will basically check each array key to make sure it doesn’t equal false. If you have an object, you get call of the properties as an array using get_object_vars. This quick snippet will allow you to look at an object and verify each property is non-false (or non-empty).
You’ve heard the phrase “The customer is always right” before. I think you’ll find an equal amount of articles online saying that that sentiment is still and always true vs the fact that the customer doesn’t know what’s best for them and they’re not right. (You’ll even hear stories about how some “great” companies like Apple ignore the customer desire and that’s how they became successful.) But they’re not really digging further into the customer relationship.