GitHub stars, are they bookmarks or thumbs up?

The trick to relative symlinks

I learned this week that relative symbolic links are relative to the link not the current working directory. What does this mean?

To remind ourselves, the format of ln is:

ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}

Example

Say we have the following structure:

config/config.yaml
app/index.php

Say we want to create a symlink to app/config.yaml. If we are familar with the cp command we would incorrectly do this:

$ ln -s config/config.yaml app/config.yaml  #this is incorrect

Here, we’re asking ln to create a symlink in app/config.yaml that points to app/config/config.yaml because the ‘source’ parameter is relative to the link being created, not the current working directory. As that file does not exist the command fails!

Correct example:

$ ln -s ../config/config.yaml app/config.yaml #this is correct
$ cd app; ln -s ../config/config.yaml config.yaml; cd - #this is clearer

The first correct example can be difficult to comprehend unless we’re familiar with this concept: From the perspective of the app/config.yaml file, we need to first go to the parent directory then into the config directory.

This is clarified by the third example: by changing into the destination directory, we align the current working directory with the path to the source.

Notes

  1. If we create absolute symbolic links by providing the full path to the source file, this is avoided, however these links are more fragile. For example when syncing links the absolute path to the source is likely different on another device.

Someone should really come up with an improved version of ln that works conceptually more similar to cp in terms of relative paths.

Syncing Wallpaper Images Spoon

As a macOS user with a multi monitor setup and a laptop I frequently switch between 1 to 3 screens. I use task related spaces (general, coding, organisation, social) and to reinforce this habit I installed some Unsplash wallpaper images relating to the task.

In some undefined situations I lose the wallpaper image on certain screens on certain desktops (I have already disabled reordering and removing spaces) but dragging wallpapers across multiple screens on multiple spaces is too much work; and why not see if this can be automated.

Thanks to Hammerspoon and a few minutes time you can benefit from my script:

-- SYNC WALLPAPER --
function sync_wallpaper()
    wp = hs.screen.primaryScreen():desktopImageURL()
    for index,screen in ipairs(hs.screen.allScreens()) do
        if screen:desktopImageURL() ~= wp then
            print('Syncing Wallpaper')
            screen:desktopImageURL(wp)
        end
    end
end

hs.spaces.watcher.new(sync_wallpaper):start()
-- /SYNC WALLPAPER --

Add this to your .hammerspoon/init.lua and switch spaces to sync wallpapers to all screens on that space!

By the way

I’m using the following wallpapers:

Cuttlefish 0.6

Cuttlefish simplifies creating and deploying PHP websites. In version 0.6 this focus continues by simplifying tooling friction and making routing and controllers more powerful.

MacOS is done? Nope, I have a wishlist for next years WWDC

Pandan (https://sindresorhus.com/pandan) is a little macOS menu bar widget displaying how much time elapsed since your last break; no nags and it’s a nice nudge to take breaks properly. Also check out the other software!

Three Finger Slash 1.0.0

This is a script for Hammerspoon that reorders the windows on the current screen in a reverse cascade, with the active window at the front left. It’s very useful to view all windows at once and create order from a mess of windows.

The name refers to the shortcut used to perform the action: control-option-command+/. This shortcut is editable in the script.

Easily access the windows after performing the Three Finger Slash

Taskfile 1.1.0

I’ve released Taskfile 1.1.0, with the following changes:

  • edit now edits the .Taskfile in the local directory if it exists.
  • Support for .Taskfile.local which should should contain version control excluded tasks.
  • Documentation update.

Taskfile remembers how to run all your shell based workflows.

Taskfile is now in maintenance-mode, so I can focus on other projects, as there are no feature requests 👍

Taskfile gains local .Taskfile editing refinement

Taskfile runs task files, a bash (or zsh etc.) script that contains functions that can be called via the runner. These files must be called .Taskfile. The runner detects any taskfiles in the current, parent, grandparent etc directory of the directory you’re in.

Example Taskfile output from the help command.

I’ve refined the edit task that ships with the script so that it opens the .Taskfile in the current directory if it exists, before falling back to editing the runner.

I think there is a lot of unused potential in optimising for end user productivity where there are boring solutions available. Mostly do less.

One of the under appreciated aspects of technical debt is that it makes it harder to get flow; certainly dealing with niggles and workarounds distracts developers from thinking holistically about a problem.

For our well-being, we take Slack off our phones when we’re on holiday. Leave it off, look after your well-being when you’re back to work as well.

Zero config project tooling

I often use my side projects for experimenting with concepts and one area of interest is onboarding. Too often there are major hurdles and complexities in getting started contributing or developing web projects.

With Cuttlefish the goal is to be as approachable as possible and be productive after running a single command.

So I’m happy to say today I landed a few PRs in the main branch that add zero configuration project tooling in the guest when using vagrant🎉

Dependency management, linting, pre commit hooks etc are all ready to go after a vagrant up. I’m pretty chuffed.

It’s optional so you can still bring your own tooling and use the built in PHP webserver.
Hopefully that should make it easy to get up and running and contribute.

Content type versus routing in Cuttlefish

Cuttlefish is my hackable web/blog framework. I’m doing most of the hacking and eventually you might blog.

Rubber ducking a bit. Working on the coupling of the controller name being linked to the content structure. For example /posts/x loads the post controller with the post model and content from content/post/x.md.

It felt intuitive but I’m not happy deriving a path literally from a class name. In Particular the post archive is an archive controller with a post model. Also feeds/post vs feeds/auctions or something.

Originally I went with contentpath being based on a controller name property. But because the model already specifies the fields available in the content that didn’t seem right

So doing some work around each model having a content path property but not 100% if that’s the right relation.

Feels like It’s doing two things. Routing and content types.

For instance if I want a /blog I’d probably create a blog controller with a post model with records loaded from content/blog.

Looks like the controller is registered to a path via the router and it dictates the content path after all.

As a web professional and a person who isn’t a native speaker but values privacy, it’s disheartening to see catering websites offering the choice between a phone call and a facebook message.

Also, it’s a business risk if your income is dependent on using a third-party community for essential business operations.

This used to be common knowledge in “web design” but it’s still true. Every time a site interrupts the visitor from achieving something on your site, (modal, sso login, login prompt, newsletter signup) the visitor loses focus and is less likely to meet the goal (or “lowers conversion tracking” if you’re using analytics). That’s why these things should be displayed after the main content when the visitor is naturally open for a new pathway.