Use an expression to select an array value in PHP. It's handy for quick output logic. Update: it's a bit too clever, perhaps, versus using the tenary operator.
$classes .= [ ' sort-default', ' sort-custom' ][ has_custom_sort( $post ) ];
Use an expression to select an array value in PHP. It's handy for quick output logic. Update: it's a bit too clever, perhaps, versus using the tenary operator.
$classes .= [ ' sort-default', ' sort-custom' ][ has_custom_sort( $post ) ];
Why do web-browsers not have a dedicated "Back to top" button? #technology
I replaced my cold half finished coffee with a hot half finished coffee.... because the machine ran out of water ๐
Finally updated my #WordPress Blocks In Plain English page with the WordPress 6.3 change in naming from Reusable Blocks to Synced Patterns. #technology
Created a HTMX PHP sandbox to get started really easily. Feedback welcome. Might add some convenience functions https://github.com/svandragt/htmx-php-sandbox #projects
I've updated my one stop system update script to remove unused Flatpaks. #linux #projects
What would it take to make writing vanilla JavaScript more pleasant? After reviewing the code for my blogging engine Lamb I concluded:
Most of the code adding interactivity to personal websites comes down to running code after the page has loaded; niceties to query the DOM and hook into events. There's probably more but this is a start. The result is shorthand.js. Hint: it's not dissimilar to jQuery, but you can fully learn it in 5 minutes.
Which simplifies code to:
onLoaded(() => {
const forms = $$('form.form-delete')
forms?.forEach($form => $form.on('submit', ev => {
cancel(ev)
let confirmed = confirm(`Really delete status ${ev.target.dataset.id}?`)
if (!confirmed) return
ev.target.submit()
}))
})
This is just a prototype and will evolve.
If you're using the Anytype (current version at the time of writing: 0.37.3) AppImage and made a .desktop file to launch it, here are a few tweaks that integrate it into your system better.
You may want to use a program like Desktopius to edit the .desktop file.
If you see one item for the AppImage and one for the application window in the Dock, add StartupWMClass=anytype
and these will be combined. This value is the result of running xprop WM_CLASS
and clicking on the Anytype main window.
If you see the generic icon, extract the icon to a path and update Icon=/path/to/anytype.png
(replacing the path to the directory where you will extract the icon).
To extract the icon from the AppImage do the following:
$ cd /tmp
$ mkdir anytype && cd anytype
$ /path/to/Anytype.AppImage --appimage-extract
....
$ cp squashfs-root/usr/share/icons/hicolor/1024x1024/apps/anytype.png /path/to/anytype.png
I've released php-activate 0.3.1, a PHP project version manager for Linux systems using native PHP packages.
Made for those working with multiple projects using a variety of PHP versions, this script will switch to the correct PHP version for the local shell session. It does not require sudo, so even works in IDEs.
The latest version contains a few small changes:
I've released php-activate 0.3.0, a PHP project version manager for Linux systems using native PHP packages.
Made for those working with multiple projects using a variety of PHP versions, this script will switch to the correct PHP version for the local shell session. It does not require sudo, so even works in IDEs.
The latest version drops support for the Fish shell again, and fixes compatibility with direnv. The correct PHP version is activated when changing into a project directory that is setup according to the README. #projects #phpactivate