Using Go at The New York Times
https://www.youtube.com/watch?v=bAQ9ShmXYLY
https://www.youtube.com/watch?v=bAQ9ShmXYLY
On using a factory versus just newing an object up:
In cases where an object has no dependencies, creating it locally is less of a concern. For example, a DateTime object has no object dependencies (unless you specify timezone, but that’s another matter entirely).http://www.brandonsavage.net/breaking-the-single-responsibility-principle/
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.
"Freek publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
Go is an open source programming language designed for building simple, fast, and reliable software.https://gobyexample.comGo by Example is a hands-on introduction to Go using annotated example programs.
One of the worst kept secrets about AJAX on the web is that the underlying API for it, `XMLHttpRequest`, wasn't really made for what we've been using it for. We've done well to create elegant APIs around XHR but we know we can do better. Our effort to do better is the `fetch` API. Let's have a basic look at the new `window.fetch` method, available now in Firefox and Chrome Canary.http://davidwalsh.name/fetch
If you're comfortable at the CLI, WPScan is super easy to get going.https://ma.ttias.be/scan-your-wordpress-for-security-vulnerabilities-with-wpscan/The project is open source on Github and uses the WPScan Vulnerability Database, an open dataset of known WordPress vulnerabilities.
Installation on a Mac is a piece of cake. Other methods and operating systems are documented on Github.
While doing some research about other obfuscation techniques I stumbled upon an implementation based on Donald Knuth's integer hash. This unbelievable small and fast algorithm will generate random-like integers with the ability to convert them back to the original value. This technique was so cool that I decided to create a PHP package for it called Optimus.http://jenssegers.be/blog/67/id-transformation-with-optimus
Amazing. Nostalgia awaits you at http://win95.ajf.me/win95.html.
In the last few months various little parts of our custom built CMS were made available as composer installable packages. Though creating a package takes some time, there are many benefits: my colleagues and my future self can benefit from the same documentation that is written for the consumers of…
A few hours ago I tagged version 1.0.0 of a my new package: laravel-newsletter. It provides a very easy way to interact with email marketing services. Or maybe I should simply say MailChimp, as it is currently the only supported supported service. After you install the package (un)subscribing an…
V2.0 of the API was a weird hybrid of RESTful and RPC practices, which required everyone to learn our own special style of API design. With a few minor exceptions, API v3.0 is fully RESTful. This allows us to express in a couple dozen resources what it took the last version 120 distinct endpoints to accomplish.http://devs.mailchimp.com/blog/api-v3-0-officially-launched/
Consuming this API doesn't seem to be that hard but I hope they'll release a PHP wrapper soon.
You might have tried a service like the now defunct OnLive.http://lg.io/2015/04/12/run-your-own-high-end-cloud-gaming-service-on-ec2.html...
Steam recently introduced In-Home Streaming, which basically creates a mini-OnLive in your own home with all the same Steam games I played with my eGPU. But… let’s do it over the Internet!
I've tried it and it works great.
Over at the Fortrabbit-blog grown up graffiti kid Frank Lämmer provides an excellent overview of what your options are when looking for PHP-Hosting.
Let’s face it: web hosting is a market for lemons. There are so many providers. New categories are emerging. Borders blur. Microservices everywhere. It’s complex. It’s noisy. It’s hard.http://blog.fortrabbit.com/php-hosting-possibilities
I used to work with providers that offered sharing hosting that could be administered with tools like Plesk and cPanel. The biggest drawbacks of shared hosting are that these environments don't get updated regularly and you can't really install all the tools you need. We've also had serious troubles with performance in some cases (presumably caused by other users on the same machine).
Thanks to all the excellent resources on server management (like serversforhackers.com and sysadmincasts.com) and tools to provision them (like Forge) I feel confident enough to administer my own boxes. A little over a year ago all new projects at Spatie are hosted on DigitalOcean. We have multiple droplets running and haven't run into any of the problems we faced with the old school hosting providers.
We've moved our logic into a trait, a trait can be shared between many controllers without inheritance and it's more reasonable to do things with views and redirects here (though still not ideal). This in my eyes is the best solution to the problem, it's what traits are good for and it's quite convenient.http://tech.graze.com/2015/04/14/sharing-controller-logic-with-traits-in-php/
The article provides a good overview of how the people at Graze came to this solution.
http://www.dmiller.io/blog/2015/4/26/comparing-the-php7-and-hack-type-systemsAfter writing a couple small programs in Hack I've realized that it's not types themselves that make writing Hack enjoyable: it's the tight feedback loop Hack creates between the machine and myself. Integrating the Hack type checker into my editor means that my entire codebase is analyzed in a split second as soon as I save a file. This immediately surfaces any dumb, or subtle mistakes I made. I find myself writing code fearlessly: when I forget what a function returns, I just write code that calls it with what I think it returns. If I'm wrong, the type checker will tell me immediately. I can fix it quickly, and move on.
PHP has always facilitated a tight feedback loop between the machine and the developer. Save the file, reload the browser, repeat. Hack's type checker makes this even faster. I look forward to being able to build similar tooling on top of PHP 7's strict mode.
Bob Weinand created a new RFC that describes how the anonymous functions could be less verbose.
This function
function ($x) {
return $x * 2;
}
could be written as one of the following
$x ~> $x * 2
$x ~> { return $x * 2;}
($x) ~> $x * 2
($x) ~> { return $x * 2; }
If it gets accepted it'll probably be added in PHP 7.1.
Tesla is not just an automotive company, it’s an energy innovation company. Tesla Energy is a critical step in this mission to enable zero emission power generation.http://www.teslamotors.com/presskit/teslaenergy
Watch Elon Musk announce the Tesla Powerwall.
https://www.youtube.com/watch?v=yKORsrlN-2k
A handy list for when talking with your project manager. An example:
Asymmetric cryptographySharing identical keys works fine among 2 people. What if Alice want to exchange stuff with another guy named Carl, and Alice doesn’t want anybody to see their stuff too? Alice can’t use the same lock and key that she shared with Bob, else Bob can unlock the box easily!
Of course Alice can share a completely new and different lock and key with Carl, but what if Alice wants to exchange stuff with 10 different people? She will need to keep and manage 10 different keys!
So Alice come out with a brilliant solution. Now, she only maintains one key (private key). She distribute the same padlocks (public key) to her friends. Anyone can close the padlocks (encrypt), but only she has the key to open (decrypt) them. Now, anyone can send stuff to Alice using the padlock she distributed, and Alice no longer have to manage different keys for different people.
At Spatie all our greenfield projects are powered by custom built CMS based on Laravel 5. An important part of the CMS is the medialibrary-component. It handles how uploaded files are associated with models. My intern and I recently took the time to release our medialibrary as a package on GitHub.…
Persist your form's data in a browser's Local Storage and never loose them on occasional tabs closing, browser crashes and other disasters!http://sisyphus-js.herokuapp.com
At Spatie, we are using this in our custom built CMS.
After writing a couple small programs in Hack I've realized that it's not types themselves that make writing Hack enjoyable: it's the tight feedback loop Hack creates between the machine and myself. Integrating the Hack type checker into my editor means that my entire codebase is analyzed in a split second as soon as I save a file. This immediately surfaces any dumb, or subtle mistakes I made. I find myself writing code fearlessly: when I forget what a function returns, I just write code that calls it with what I think it returns. If I'm wrong, the type checker will tell me immediately. I can fix it quickly, and move on.http://www.dmiller.io/blog/2015/4/26/comparing-the-php7-and-hack-type-systems