Gleam has a `todo` keyword

2023-11-29 #gleam #erlang / gleam.run

Gleam is a statically typed language that runs on the Erlang virtual machine. From distance, it looks like a love child of Go and Elixir (count me in!)

One neat language feature is a todo keyword. First-class syntax to mark a piece of code as work in progress and to stop the compiler from yelling at your half-implemented code.

fn favourite_number() -> Int {
// The type annotations says this returns an Int,
// but we don't need to implement it yet.
todo
}
 
pub fn main() {
favourite_number() * 2
}

Flexoki: my new favorite calm color scheme

2023-11-20 #programming #tools / github.com

I love this warm color scheme from Steph Ango (kepano, CEO of Obsidian) based on printing inks and warm paper. It's my new default theme in Sublime Text—which is still my preferred editor when I'm not slogging through large PHP codebases.

Screenshot of Flexoki in Sublime Text


Ask for ranked wishlists

2023-11-16 #product-management #project-management / thunk.dev

John Drexler shares an easy to implement prioritization scheme when working with a client.

It's a gift when another team gives you a wishlist of product improvements. Ask them to put their lists in order of importance, and then focus the conversation just on the top 5. This saves you loads of time. But it also brings them into the prioritization discussion and gets them to think like Product Managers too.


Robin Rendle: "Cut the intro"

2023-11-14 #writing / robinrendle.com

(I suppose it'd defeat to point to add a comment here.)

Writing about the symbiosis between trees and mushrooms? Don’t start talking about how humanity has depended on trees since the blah blah blah. Just jump right in! Talking about new features in your app? Don’t start with the fluffy stuff about how excited you are to announce yada yada ya – just tell me what improved.

Boom! The text is lighter, faster, less wasteful.


Remove falsy values from a Laravel collection or array in PHP

2023-11-13 #php #laravel

The native array_filter() in PHP and collect()->filter() in Laravel also work without providing a filter callback.

array_filter([0, 1, '', 'a', false, true, []]);
// [1, 'a', true]
 
collect([0, 1, '', 'a', false, true, []])->filter();
// [1, 'a', true]

If you don't provide a callback, PHP will remove all empty values from the array.


Cosmic Latte

2023-11-13 #design / en.wikipedia.org

A team of astronomers have calculated the average color of the universe and named it cosmic latte. I'd love to have a cosmiclatte CSS color one day.


Adding stale while revalidate functionality to Laravel's cache

2023-11-13 #laravel / rias.be

A stale while revalidate cache macro by Rias Van der Veken. With stale while revalidate, expired cache items will still be used when requested, but the data will be revalidated right after. That means the current request will be handled faster than if the cache would have to be revalidated, and the next request will receive fresh data.

Stale while revalidate is often used in web applications, popularized by Vercel's SWR React library.


Technology didn’t have to glow

2023-11-02 #technology / macwright.com

Technology didn’t have to glow. […] There were devices that simply did what they were for, without demanding attention.

I've always had a soft-spot for e-ink screens. Tom MacWright puts it better than I ever could, we should be the ones demanding attention from technology, not vice-versa.


Stefan Zweifel on storing user preferences in a Laravel application

2023-10-31 #laravel / stefanzweifel.dev

Stefan Zweifel explains how he stores user preferences in a Laravel application using spatie/laravel-data. With the data package, you can store user settings as a blog of JSON in your database—so you don't need to update your table schema for every change—and have a typed object to work with in code.

He mentions poor query performance as a possible tradeoff if you need to query the database for a specific value.

One thing to keep in mind is that querying for specific settings can lead to performance issues and should probably be avoided.

If your app regularly needs to query for users who have selected a particular date_format , it's better to promote this setting to its own column. This makes the work of your database and possible indexing much easier.

If this is something you need, you could solve it with a virtual column mapped to a JSON value of the settings object. There's a nice tutorial on that on the Kirschbaum blog


Introducing Svelte by Example

2023-10-24 #svelte

This week, I released Svelte by Example, a tutorial/resource/whatever-you- want-to-call-it introduction to Svelte.

The goal of Svelte by Example is not to turn you into an expert Svelte consultant after reading it through, but to introduce you to the framework's main concepts, and hopefully peak your curiosity and have you dig deeper.

If you've been curious about Svelte but haven't had time to give it a look yet, it's for you!

Keep reading if you want to learn more about how the site is built.

Read more


Empty states with CSS and the `:only-child` selector

2023-09-28 #css #tailwind #laravel #blade

Here's a quick trick with the :only-child selector to display an empty state in a list.

Read more


Go Is a Shop-built Jig

2023-09-28 #go #programming / robnapier.net

I love this description of the Go programming language from Rob Napier:

Go feels under-engineered because it only solves real problems. If you've ever worked in a wood shop, you've probably made a jig at some point. They're little pieces of wood that help you hold plywood while you cut it, or spacers that tell you where to put the guide bar for a specific tool, or hold-downs that keep a board in place while you're working on it. They're not always pretty. They often solve hyper-specific problems and work only with your specific tools. And when you look at ones that have been used a lot, they sometimes seem a little weird. There might be a random cutout in the middle. Or some little piece that sticks off at an angle. Or the corner might be missing a piece. And when you compare them to “real” tools, “general” tools like you'd buy from a catalog, they're pretty homey or homely depending on how you're thinking about it.

But when you use one of them in your shop, you learn that the random cutout is because you store it against the wall and it would block the light switch otherwise. And if you put your hand on that little extra piece that sticks out, then the board won't fall at the end of the cut. And the corner… well the corner is where you messed up when you were first making it and it's kind of ugly, but it never actually matters when you use it. And that's Go.


Sketchplanations: Point positive

2023-09-08 #project-management #programming / sketchplanations.com

A little Sketchplanation on "point positive".

Point positive is a rafting term for agreeing in advance to point towards the safe way out of danger rather than towards the dangers themselves.

When you're in trouble, don't dwell on the cause, look for a solution. Only when the waters are calm, take a step back, reassess, and learn the necessary lessons to avoid it in the future.


Cat Hicks on Craft

2023-09-06 #programming / www.drcathicks.com

I lovely read on craft by Cat Hicks.

Grandpa loved craft. […] He fixed things often and silently. Grandpa just cared about things working. He had an instinct for not just broken things but soon to be broken things. He would point out risky work, bad decision making in the form of shoddy materials or shifting angles.

As software developers, we often consider our trade to be unique. But what we (should) have in common with others is the mindset of respecting our craft—of producing solid and lasting work.

I have read a lot of long spiels about craft that frequently end in something like, software work isn’t like other work, and we shouldn’t be judged the same way. We are entirely unique. We are the special ones. I find this both saddening and unconvincing. I think that all labor is skilled labor. I think about the factories and the fields and the ways that demands for speed instead of cadence can hurt people. I think we should seek to understand and value our skills and see effort. But I don’t think we are going to fix anything about how software work is valued by refusing to let it belong to the rest of the world.


Forge deploy scripts in version control

2023-09-05 #laravel-forge

I love Laravel Forge's quick deploy scripts. Forge allows you to set up a deploy script in their web interface and run it when you push to a git branch. However, I generally prefer to keep orchestration in the git repository. It's nice to have history, and I don't want to visit Forge whenever I want to make a change to the deploy script.

An elegant solution: move the script to a file. I created a deploy.sh and call it from Forge.

Read more