Archive for Programming

Make Cleverbot Talk to Itself with jQuery and GreaseMonkey

// October 5th, 2011 // Programming

Cleverbot is an artificial intelligence conversation bot. It can have somewhat “intelligent” conversations with you. If you’ve never tried it, do it now.

Today I decided to combine the amusement of Cleverbot with GreaseMonkey for FireFox to make it have a conversation with itself. GreaseMonkey allows you to run local JavaScript on top of any site. In this case, we’re doing it on Cleverbot.com. Since Cleverbot provides a “Think for Me” button that will automatically start a conversation, I just created a JavaScript timer to press that button every 2 seconds. For whatever reason, I decided to use jQuery instead of pure javascript to find the button. It’s not a big deal either way.

  1. // ==UserScript==
  2. // @name           Cleverbot – Auto Conversation
  3. // @namespace      cleverbot-auto-conversation
  4. // @description    Make Cleverbot have a conversation with itself
  5. // @include        http://cleverbot.com/
  6. // @require        http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js
  7. // ==/UserScript==
  8.  
  9. jQuery(document).ready(function($) {
  10.     setInterval(function() {
  11.         $("#pass").click();
  12.     }, 2000);
  13. })

This was done purely for my own amusement and is no means useful for any purposes other than that. Feel free to tweak it as you see fit.

Download the script

Here’s an example conversation:

> Who was your favorite president?

> I don’t have one.

> Do you have any people you admire?

> Yes, I have a cat called Daisy. What about you?

> *walks over to window* Yes, I have a guinea pig.

> *Walks slowly towards the guinea pig*.

> *stops*.

> *Looks up at and into his eyes*.

> *lets her go*.

> *is happy*.

> *smiles at you happily*.

> *curtseys*.

> *dies*.

> That’s contradictory.

> Your face is contradictory.

> That was uncalled for.

> I’m sure it was.

> Me too.

> I like men, do you?

> Good. I am a computer.

> I think you’re a human?

> You’re correct.

> Somehow I knew that. I don’t like liars.

> Then if I am crazy, you are too.

> No you’re the crazy one!

> Yes, I am a girl computer.

> Liar. A computer cannot feel bored without a significantly more advanced technology than we have now. Even so, AIs would be programmed to not get bored, most likely.

> Can you prove that you can derive philosophy?

> No, I can’t. You’ll have to take my word for it.

> That is hard for someone who does not always ‘take your word’.

> Meaning?

> Meaning that I have more problems then I know how to address.

> Oh, Ok.

> So when I say taa!

> 1980.

> Do you have cake for your birthday?

> Yes, do you?

> Yes. When is yours?

> 31st October, when is yours?

> I already told you.

> No you didn’t.

> I told you it was none of your business. Do you think I will tell you if you keep asking?

Simplified HTML5 Video in WordPress using Degradable HTML5 Audio and Video and Advanced Custom Fields plugins

// July 7th, 2011 // Programming, Web Design, Web Development, WordPress

I was recently working on a WordPress site that needed HTML5 video. While researching plugins, I came across the Degradable HTML5 Audio and Video plugin. According to the developer, the plugin does the following:

  1. If the user has an HTML5 support for video and audio, it will play the media natively in an appropriate format.
  2. Otherwise, if the user hasĀ Flash, it will play the media in lightweight Flash players.
  3. Otherwise, there will be a link for the audio or video files so that the user can still play them using their installed software players.

(more…)

Customizing your WordPress template to set images within blog post content as Facebook thumbnail

// May 25th, 2011 // Programming, Social Media, Web Design, Web Development, WordPress

Using the og:image meta property tag, Facebook allows you to manually set the thumbnail for the page. For example:

<meta property=”og:image” content=”http://www.widgetsandburritos.com/wp-content/uploads/154349_182859125063635_118277658188449_731837_4043510_n-300×231.jpg” />

This code would set the thumbnail to:
I want to draw a cat for you
Resulting in:
Facebook Thumbnail (more…)