A Guide to Claude Code 2.0 and getting better at using coding agents
A good guide to get started with Claude Code. If you haven't jumped on that train yet, this might be a good entry point for you.
Read more [sankalp.bearblog.dev]
Posts tagged with coding
A good guide to get started with Claude Code. If you haven't jumped on that train yet, this might be a good entry point for you.
Read more [sankalp.bearblog.dev]
Claude Code has considerably changed my relationship to writing and maintaining code at scale. I still write code at the same level of quality, but I feel like I have a new freedom of expression which is hard to fully articulate.
Read more [blog.puzzmo.com]
Join 9,500+ smart developers
Every month I share 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.
We've converted our PHP and Laravel coding guidelines into AI-friendly instructions so Claude Code and other AI agents can generate code that matches our established programming style.
Read more [spatie.be]
Frederick Vanbrabant recorded a new cool video, this time on EditorConfig.
EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
Sebastiaan Luca, a freelance Laravel developer from Antwerp, coded up a couple of functions that mimic a pipe operator.
An interesting RFC proposal by Sara Golemon submitted in April 2016 suggested the use of a pipe operator to enable method chaining for any value and method. Yet as of today, it's still being discussed and there's no saying if it will ever make its way into PHP. So in the meantime, here's a solution!
https://blog.sebastiaanluca.com/enabling-php-method-chaining-with-a-makeshift-pipe-operator
Let's hope a real pipe operator will land someday in PHP.
I'm hopeful. Done well, I think it needs partial function application first, so that no additional syntax is required for the rhs.
— SaraMG (@SaraMG) February 21, 2018
At last years Istanbul Tech Talks conference Kevelin Henney gave this great talk on how to improve the readability of your code.
Here are the slides of this talk.
Stefan Koopmanschap argues that, besides writing beautiful code and using kickass frameworks and libraries, we should be able to do some quick and dirty coding as well.
Can you write me a simple script that fetches some information from an RSS feed and displays the titles? Like, just write me that script in a couple of minutes. I don't care about tests, quality, etc. Just get me the information, quickly.
Gary Hockin posted a video with his attempt in solving the Day 1 challenge of http://adventofcode.com/. The video not only shows how he solved the problem codewise but also demonstrates some nice features of PHPStorm.
Mistakes and all, I attempt to code day 1 part 1 of the Advent of Code challenges you can find at http://adventofcode.com.I deliberately didn't overly edit, or over complicate the video as I'm trying to get them done as fast as possible, if you like this I'll do some more!
I know some people will say "Waaa you should have done it like this!", or "Why didn't you use library $x", well I didn't so get over it. I'm also worried this gives away far too much about my coding quality and how lazy I am, but such is life.
PHP does not support method overloading. In case you've never heard of method overloading, it means that the language can pick a method based on which parameters you're using to call it. This is possible in many other programming languages like Java, C++.
So, under normal circumstances, you can't do this in PHP:
class Foo
{
function bar(A $baz)
{
...
}
function bar(B $baz)
{
...
}
}
However, with some clever coding, Adam Wathan made a trait, aptly called Overloadable, that makes method overloading possible. It works by just accepting any parameters using the splat operator and then determining which of the given functions must be called according to the given parameters.
Let's rewrite that example above using the Overloadable trait.
class Foo
{
use Overloadable;
function bar(...$arguments)
{
return $this->overload($arguments, [
function (A $baz) {
$this->functionThatProcessesObjectA($baz);
},
function (B $baz) {
$this->functionThatProcessesObjectB($baz);
},
]);
}
}
Pretty cool stuff. In a gist on GitHub Adam shares a couple of examples, the source code of the trait and the tests that go along with it. Check it out!
https://gist.github.com/adamwathan/120f5acb69ba84e3fa911437242796c3
The goal of the game is for kids to maneuver their turtle across the board, avoiding obstacles and other players, in order to rendezvous with a jewel. But instead of rolling a dice and letting fate decide, they use a set of cards that serve as basic programming instructions, telling the turtle where to move and when to turn.http://toyland.gizmodo.com/a-board-game-that-teaches-four-year-olds-how-to-code-1656478026