The Fortune Cookie is a current side project of mine. First, I ported the old Unix file-based fortune cookie program to PHP (as seen here). Now, I'm turning it into a WordPress plugin that stores quotations in a custom MySQL table. The in-development version uses the WordPress REST API to collect information from the backend. The basic plugin is working now — the development version is running on my test domain. This page shows 2 fortune cookies when you visit it: the first is generated using a WordPress shortcode placed in the page, and the second is generated by Javascript. Both cookies have an (optional) Again button that will request a new cookie based on the filters used to create the current one. There's also a button at the top of the page that will inject a new cookie into the page each time it is invoked.

There are still several big chunks of functionality before it's worth releasing. I've built the backend mechanism that lets you import, view, and edit cookies, and next is the mechanism that manages the actual instances (views) of cookies on the page. Coming soon!

This plugin kept generalizing itself as it progressed, so it's actually a good way to dynamically inject display cards at arbitrary places on a page. I've defined several types of cookies to start ('Quote' and 'Aphorism'), and I built an import mechanism that reads a text file of fortune cookies and stores them in a table in the WordPress database. The rendering function that creates the HTML for a given cookie is determined by the type, so you could easily add a new type or change the rendering function for an existing type.


Recently on Twitter as @dffmonolith

Most of my writing these days is in 140-character chunks, and here are my most recent tweets.

Twitter: dffmonolith

 

Help Us Look for Aliens!

Whether you believe in Benevolent Overlords or BEMs, it behooves us to find the aliens before they find us. You know they’re out there, and it would be a lot less disruptive to find their radio signals than it would be to welcome them in person. Comet Hale-BoppThe SETI project has been searching for years, using hundreds of thousands of computers to process data from Arecibo using the BOINC distributed computing screensaver.

Current Team Score from SETI

If you have some spare cycles, join my team: AstroScum — Team 747680. Our combined score is pretty good for only 3 people, but it’s tough to compete against those with access to server farms. Join my team and share the credit when we discover the first verifiable alien signals!

Back to TOP Page UP Page DOWN