The link that could crash Chrome
In this video Tom Scott explains why Chrome couldn't handle http://a/%%30%30 :
https://www.youtube.com/watch?v=0fw5Cyh21TE
In this video Tom Scott explains why Chrome couldn't handle http://a/%%30%30 :
https://www.youtube.com/watch?v=0fw5Cyh21TE
In this excellent post Matthias explains why you can't put all your trust in cat when inspecting a file:
https://ma.ttias.be/terminal-escape-sequences-the-new-xss-for-linux-sysadmins/
Let's all agree to never trust anything that has been posted on the internet without very thorough inspection. And let's especially agree to never run an arbitrary command or script found on the internet, without really close inspection.
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Always fresh, useful tips and articles. Carefully selected community content. My favorite newsletter, which I look forward to every time."
I bet you have a headache when you need to mark some menu item as active. Is there any good way to solve this? Yes, there is – route attributes.http://blog.krucas.lt/2015/07/active-menu-state-using-route-attributes/
I recently had to redirect every single request in a Laravel app. You might think that would be as easy as this: Route::get('/', function() { return redirect('https://targetdomain.com'); }); But that'll only redirect the "/" page. All other requests will return a 404.…
I recently ran into a problem where I had a suite of applications hosted on a set of subdomains that all needed to be able to share a single cookie. Any cookies other than the shared cookie needed to stay specific to their subdomain, but this one shared cookie needed to be accessible to any of them. I also wanted to accomplish this using Laravel's `Cookie` facade.https://gistlog.co/JacobBennett/15558410de2a394373ac
Laravel's native authorization functionality allows you to define abilities a user can have. There are multiple ways to check if a user has a certain ability: via the facade, via the user model, within blade templates and within form requests. What Laravel doesn't provide out of the box is a…
Watch it on Vimeo.In object-oriented development, we are all familiar with design patterns such as the Strategy pattern and Decorator pattern, and design principles such as SOLID.
The functional programming community has design patterns and principles as well.This talk will provide an overview of some of these, and present some demonstrations of FP design in practice.
Like most geeks out there I'm a big fan of Star Wars. Many will agree that the original trilogy is far superior to the prequel triology. Until yesterday I thought Episode II was the worst movie of the entire series. But then I found out about the holiday special.
The Star Wars Holiday Special was made in 1978, a year after the original movie. The storyline (quoted from Wikipedia) sounds quite good:
... Chewbacca and Han Solo visit Kashyyyk, Chewbacca's home world, to celebrate Life Day. They are pursued by agents of the Galactic Empire, who are searching for members of the Rebel Alliance on the planet. The special introduces three members of Chewbacca's family: his father Itchy, his wife Malla, and his son Lumpy, though these names were later explained to have been nicknames, their full names being Attichitcuk, Mallatobuck, and Lumpawaroo, respectively.Luke Skywalker, Han Solo, Chewbacca, Princess Leia are all in there. But their presence absolutely doesn't hide the fact that it is a terrible terrible movie. Episode II is a genius work of art compared to this pile of crap. In it's day the movie received mostly very negative reviews. George Lucas agrees. He said this about the christmas special: "If I had the time and a sledgehammer, I would track down every copy of that show and smash it."During the special, scenes also take place in outer space and in spacecraft including the Millennium Falcon and an Imperial Star Destroyer. The variety-show segments and cartoon introduce a few other locales, such as a cantina on the desert planet of Tatooine and a gooey, reddish ocean planet known as Panna.
See the special for yourself on YouTube. But I recommend you don't.
To restore your faith in Star Wars watch the trailer of episode VII . Very much looking forward to that one.
https://www.youtube.com/watch?v=wCc2v7izk8w
Matt Stauffer wrote another excellent article on Laravel. This time he gives a tour of Laravel Spark.
In case you're still having a bit of trouble understanding what Spark is really about, Spark is a tool designed to make it quicker for you to spin up SaaS applications, and it handles user authentications, plans and payments and coupons, and team logic.https://mattstauffer.co/blog/introducing-laravel-spark-a-deep-diveMost SaaSes have these same components: user accounts, Stripe-based payments, and different payment plans. And many have payment coupons and team payment options.
Rather than re-creating this functionality with every new Laravel app you create, just use Spark, and you'll get all that and a free SaaS landing page to boot.
In plain old JavaScript you can get the data attributes of
[code language="html"]
like this
[code language="javascript"] document.getElementById('test').getAttribute('data-news-item-id');
But did you know there's a alternative way of doing this by reading an element's dataset property?
[code language="javascript"]
document.getElementById('test').dataset.newsItemId;
Notice that the values can be accessed by camelcasing the name of the data attribute. You can also write to datasets to change values of data attributes. Read the informative helpful article on MDN to know more.
If you're going to read one article on ActiveRecord vs Data Mapper let it be this one by Matthew Machuga.
The next time you come across the ActiveRecord vs. Data Mapper argument, or ones like it, be critical of what is being said. If it impacts your work in some way, do some research to find out if what is being said is true or if it has been something lost in translation. Don't feel bad for using a pattern that has spread across multiple languages and ecosystems successfully, and is probably the reason we have most of the web frameworks we do today. While the ActiveRecord existed well before Rails, it was Rails that gave it a beautiful API and made other frameworks like CodeIgniter, Laravel, .NET, Fuel, Django, etc want to have something comparable.http://matthewmachuga.com/blog/2015/activerecord-and-the-beauty-lost-in-translation.htmlIf you use Eloquent, ActiveRecord for Rails, or any other AR ORM, make sure you know that you are not alone. You are in good company of many, many developers who use it successfully day-to-day. However, if one day you choose to use a Data Mapper implementation or something else, then you will still be in good company, and still deserve respect regardless of which side of the fence you fall.
When we built Facebook's mobile applications, we needed a data-fetching API powerful enough to describe all of Facebook, yet simple enough to be easy to learn and use by our product developers. We developed GraphQL three years ago to fill this need. Today it powers hundreds of billions of API calls a day. This year we've begun the process of open-sourcing GraphQL by drafting a specification, releasing a reference implementation, and forming a community around it at graphql.org.https://code.facebook.com/posts/1691455094417024/graphql-a-data-query-language/
There's already a package to use GraphQL with Laravel.
With the release of Laravel 5.1.1 last week the framework gained some nice Authorization features. It provides an easy way to define abilities (aka permissions). Checking if a user has certain abilities is very simple as well. The code powering authorization is a thing of beauty. If you're a…
Jens Segers explains how to use PHP League's shiny new version of Container. The usage of ContainerInterface seems interesting:
League's container now implements the `ContainerInterface`, which is defined by the Container Interoperability group. This is really great as there are a few projects and frameworks which support this interface. For example, the Slim 3 micro framework already allows you to choose your own container flavour, as long as it implements the interface.Read the full article at Jens' blog.
The League's Container seems like a nice alternative to PHP DI that I have been using.
Eric Barnes, the curator of Laravel News, recently decided to publish guest posts. Mike Bronner contributed the first guest post on how to install Z-Ray in Homestead. Today, an article written by me was published.
I have met hundreds of developers. The best ones always have a side project or two that they hack away on at night. As an employer I encourage that, but I have heard that a lot of workplaces ban personal projects.http://david.elbe.me/development/2014/09/26/side-projects.htmlSo let's talk about why I think that side projects is a good thing, how I use them to get better and what you have to look out for.
https://medium.com/brigade-engineering/hacking-the-flow-state-b2451d0bf7baOften, when I’m able to slip into a state of flow while coding, I will produce more in a single afternoon than I could in several days of non-flow. Yet this is often an elusive state to obtain. Luckily, research dedicated to this topic in recent decades offers some help. Here we’ll look into both the stages of flow and how to obtain the prerequisites for flow, making it possible in the first place.
Q: What does this code return?
date('Y-m-d',strtotime('00-00-00'));
A: 1999-11-30
B: 0001-01-01
C: 2001-01-01
The correct answer is A: 1999-11-30.
You'll find the reasoning behind this result as a comment on this bug report.
There is no bug here, 00-00-00 means 2000-00-00, which is 1999-12-00, which is 1999-11-30. No bug, perfectly normal.
Garrett St. John wrote a clear example on how to use UUIDs in Eloquent models. This kind of logic could go in a trait so it can be reused across multiple models.
By default, Eloquent uses an auto-incrementing integer as the primary key for its tables. While most of the time this is totally acceptable, sometimes there is a need for primary keys to be less predictable.http://garrettstjohn.com/entry/using-uuids-laravel-eloquent-orm/
EDIT: Kirk Bushell has made a trait for this functionality. Take a look at his Eloquence package on GitHub.
The Retry library by Igor Wiedler has only 19 lines of code. Line 17 is a goto statement. In this issue on GitHub a user asks why Igor chose to use goto instead of resorting to recursion. Igor took the time to write out the reasoning behind that decision. It's a very interesting read on the PHP compiler and opcodes.
Why hello! Thank you for asking this most excellent question!https://github.com/igorw/retry/issues/3I have indeed considered alternatives to the goto. I have evaluated them to a great extent, and I am happy to present the results to you here.