Twis (present tense of “twas”?) not a real big demand on the internet for the kind of silly randomness I spat out to make a web toy that generates random utterances about AI using the quotes of Agent 007’s gadget master, Q.

And there’s still place and value to do these things without just reachhig for ChatGPT method of Prompt, Copy, and Paste. This was one of a fleet of obscure random generating amusements done for my audience of 1 (me).

They had all been first set up to have a button proving a means to blip a generated nugget to Twitter (the platform I only will refer to as Twitter), (shown here as screencap because nobody can really be sure if a tweet can be viewed).

A twert from @cogdog  on Jan 27, 2021reading -
Another generated Edtech Metaphor (updated for @mweller)

What does raising a puppy tell us about Artificial Intelligence?

Blame @cogdog for https://cogdog.github.io/edtechaphors/
A tweet created from one of my generator’s with the three part structure, stating what generator it was, what was generated, and a credit and link to the generator.

It’s not terribly complex to create a hypertext link to share on Twitter (not saying it again), of course , there’s no being sure when its supreme commander will arbitrarily take it away. Just make a link that looks like:

https://twitter.com/intent/tweet?url=LINKTOBESHARD&text=DEFAULTMESSAGE

This opens a window where the person who clicks can just tweet out as is, or modify it.

The thing is… I barely use Twitter, under under extreme circumstances — I did login to test it for the new generator, here is a link that only works for the those who are Twitter Not Impaired.

I’ve already written too much but basically the old way had

After publishing my post, my back brain kept whispering…. why not change the button to share to Mastodon?

I had after all, discovered recently MastodonShare that does the same thing via the same URL structure

https://mastodonshare.com/?text=text&url=yourURL.com

What is slick is he first time a visitor uses this link, it asks for their instance name, from whence the share screen is generated. From then on, the instance is saved as a cookie so te next share will go directly.

I could just change it out, but heck, some people actually use the Platform Formerly Known as a Better Platform, so my first approach was to add a second button.

I was going to detail the code changes, but I doubt anyone reall cares that much- I do have comments, with occasional sarcasm. And function names like share_it_like_a_bluebird. One could compare the first commit with the new Q generator, where the share button was a single link and the current version where what is changed is:

  • Link changed from an ugly button image reading “tweet” to a bootstrap class rendering a button with svg icons
  • Options from calling function to send twitter and mastodon username to credit, by sending a blank string for parameters, it hides the button
  • A more generalized function to build the button that is less brute forced concatenated
  • Also added opengraph tags to template for spiffer social sharing

Who really cares? Well, these little generators are just toys, but now having some chops building the Mastodon share capability can come into use.

More than that, there’s pride in going through the iterative process of trying a new function, modifying and improving, as opposed to asking ChatGPT to spit out code you try, and then nag, the prompt continuously until maybe you are lucky it works. Both are iterative, yet I wonder which approach teaches you more. I do not doubt one could learn from analyzing and studying the code generated for you, but I’d bet most people will just keep banging until it works and not caring too much about understanding.

Look! Proof is in the tooting:

Fin.


Featured Image: My own, but yes, for some reason, although I do not have to, I attribute myself. It’s not vanity (well maybe) but being consistent in demonstrating attribution. If anyone actually reads this commntary, and comments, I will mail you a Canadian Toonie. Yes! The attribution, this is One of Today’s Projects flickr photo by cogdogblog shared into the public domain using Creative Commons Public Domain Dedication (CC0) modified by superimposing a screenshot of bit of the javascript code I am arm waving about in this post.

A wood frame with hammer, ruler, and glue sitting on top. Superimposed inside the frame is some javascript code
If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for cogdog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *