This will paste your last statement without running it.
Two main memoization patterns I’ve seen are the following Example #1 is shorter, however if you stare at it hard enough you’ll realize if @the_thing is supposed to be false or a falsy value then it would never be memoized. Example #2 of checking if the variable has been defined is a more sure method … Read more
If you need to hit a route from your Rails console and see the output you can use the following pattern. You now have a rails response object much like the integration tests.
Just want to point out a great post by Joyce Echessa talking about the differences between all the nullish state methods for Ruby: Nil? Empty? Present? Blank? #nil? #empty? #blank? #present? 5 false NoMethodError false true “” false true true false ” ” false false true false “\t\n” false false true false  false true … Read more
TL;DR It was hard but worth it. First Job My first developer position was the challenging to find. After having done freelance work for a handful of years and another two teaching myself modern development frameworks, it took roughly 100+ applications to land my first role. The position was a sole developer role for a … Read more
If you want to know how many times your Laravel query is hitting the database you can use this snippet by @Tarasovych from StackOverflow. Pretty handy!
Laravel’s with() is an easy to use query builder tool to fetch relationship. Once you’ve established the relationship in your model file you can do this. But this query has the downside of hitting the database twice, or however many relationships you query. And if you’re running it on a big scale application, it can … Read more
What are some scraper options for Laravel? Well, Dusk works well if you’re just working in dev and testing but the following list can work for various cases. I’ve listed the four from what seems to be most reliable to least reliable depending on your use case. For instance, it seems like only panther and … Read more
Various ways to set value if the value does not exist in PHP. The whole discussion summarized nicely at the end by @ben221199:
I’ve probably tested 30 different snippets of code. Yeah, yeah, I should probably understand what I’m actually doing first. But here’s the one that most reliably worked. Obviously, from css-tricks who writes it in jQuery. Below is the vanilla version with reliable flair.