Turns out yaml_parse() in PHP automatically parses a front matter block out of a markdown based post.
Sander van Dragt's Notes
-
-
Entry titles aren't optional in Atom feeds, how to micro blogs deal with that? Update: it seems by making the title an empty element.
-
The AI evolution seems scary until you realise most of the applications are summarised as a wrapper around the OpenAI API that does all the work, with the context provided by a prompt prefix. So with half a day's study most programmers can participate. #technology
-
Ubuntu's minimal installation appears to be the standard installation plus the removal of some packages! That's unexpected as I was trying to save installation time. #ubuntu #technology #linux
-
Map Eject to Multitasking View
So I use ElementaryOS and in version 7 you are no longer able to map just the Eject key. I like to map this to the Multitasking View (something like the macOS Expose).
The solution is to use the DConf Editor application and search for
show-desktop. ElementaryOS repurposes the show desktop to the multitasking view. Simply set the value to['Eject']Alternatively you can set the left-super key (windows/command) to the Multitasking View. This seems better supported.
-
Lamb 0.2
I've released Lamb 0.2, my micro blogging app that's powering this site.
What's new?
- Posts! Posts are statuses with a title. The title can be added in the front matter (front matter is parsed as an ini-string). Posts have a slug based on the title when the post was created.
- Individual statuses / posts have opengraph tags for improved sharing fidelity.
- The text editor grows to accommodate the input.
-
0.2.0
Originally written on lamb-releases:
Via lamb-releasesPosts! Posts are statuses with a title. The title can be added in the front matter (front matter is parsed as an ini-string) Posts have a slug based on the title when the post was created. Individual statuses / posts have opengraph tags for improved sharing fidelity. Fixed several XSS, thanks @cameronterry
-
Anyone, regardless of coding experience can now create scripts and simple WordPress plugins:
WordPress developers who want to share their AI-assisted creations with the community have also started submitting them to WordPress.org.
We can imagine the headlines in six months when another popular site or plug-in is hacked, when both the author and the generator and the webmaster don’t understand the code, and can’t review it for security weaknesses, The current tools are proof of concept creators, but please be careful not to assume production ready code.
If you want a code review done hit up an engineer, like myself #technology #ai #wordpress
-
I've released php-activate 0.1.2, 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 automatically switch to the correct PHP version after
cding into the project folder. It does not require sudo, so even works in IDEs.The latest version contains only documentation changes, but I've been using this successfully for a few months, so wanted to share this more widely. #projects #phpactivate
-
Basic routing using REQUEST_URI
So for nginx it is not straightforward to setup PHP-FPM so that
PATH_INFOis correctly populated. Lamb uses the following/index.php/some/othertype routing, where/some/othershould be thePATH_INFO. Instead I want to make setup for a variety of web-servers straightforward, so I've switched to the more robustREQUEST_URI. This simplifies nginx configuration and Caddy and the PHP built-in web-server are compatible.REQUEST_URIcontains everything after the domain name, including the query string, so that needs to be removed:$request_uri = '/home'; if ( $_SERVER['REQUEST_URI'] !== '/' ) { $request_uri = strtok( $_SERVER['REQUEST_URI'], '?' ); }We can see that for a request for the root of the site,
REQUEST_URIreturns/whereasPATH_INFOwould be empty, so the code above takes that into account. We can then deduct a router action as follows:$action = strtok( $request_uri, '/' );Once the
$actionis known, it can be checked against an allowed list of actions:switch ( $action ) { case 'edit': ... break; default: respond_404(); break;