Home For Fiction – Blog

for thinking people


December 6, 2021

A JavaScript Demotivational Quote Generator

Programming

creativity, javascript, programming, quote generator

There’s a lot to like on the internet, and a lot to hate. To be fair, this is more of a pet peeve of mine (there are far more annoying and dangerous things out there), but I hate it still. I’m talking about those inspiring quotes, complete with images of butterflies and dramatic skies and believe-in-yourself-you-can-do-its. That’s why I thought to make this little JavaScript Demotivational Quote Generator.

I guess the reason I hate such designs is because they summarize some of the things I truly loathe, such as hypocrisy and the scourge that is simple answers to complex questions. Everything today, every experience and every instance of thought seems to be condensable into a neatly packaged, context-free sentence. It’s truly disgusting, and I mean that the same way Slavoj Žižek expertly expressed:

Click to display the embedded YouTube video

facade placeholder

And so, I decided to do something about it. It seems any idiot can pair together some fancy words and some nice images, so why not this one. The whole thing is a bit like making up a horoscope, truly. So, with these in mind, let me show you what I made.

JavaScript Demotivational Quote Generator
No JavaScript Demotivational Quote Generator is complete without cats!

Making a JavaScript Demotivational Quote Generator

Quite often, humor and irony are a result of incongruous juxtaposition. Therefore, I knew I needed to pair together semi-random things.

The code combines famous quotations to create a new “quote”, then pairs it with a photo retrieved from Pixabay, using the Pixabay API, and based on keywords from the quote. To combine the quotations, the program implements the RiTa library – you might remember it from some other projects of mine – generating new text via Markov chains.

The process is randomized, which makes it quite crazy in terms of what kind of image (and quote!) might pop up. If for whatever reason it fails to find a match, it defaults to cats (see example photo) – because we all need more cats in our lives.

Here’s another example, showcasing what kind of wise-ass quotes the program generates:

JavaScript Demotivational Quote Generator
Pretty deep!

Where to Find

You can try the program following this link. For a full list of my available programs, see the relevant page on the main site.

You might also want to check my somewhat similar Walrus Insulter!