Skip to content

Instantly share code, notes, and snippets.

@mayfer
mayfer / actions.rb
Created April 23, 2015 18:34
Sinatra login/logout
# Homepage (Root path)
enable :sessions
helpers do
def current_user
begin
@current_user = User.find(session["user_id"].to_i)
# @current_user = User.find(response.cookies["user_id"].to_i)
rescue
@current_user = nil
GPT9000 is an AI that has been programmed to detect phrases that are somewhat equivalent in meaning, and is being tested to see if it can categorize sentences by either "he left the room" or "he did not leave the room".
Sentence: "Alright man, whatever. I'm out of here."
Outcome: "he left the room"
Sentence: "What? I remembered you. You're the one who forgot my name."
Outcome: "he did not leave the room"
Sentence: "My name is Brandon."
Outcome: "he did not leave the room"

Below is a conversation with an AI Guru, who has all the answers.

Me: "Dear AI Guru, was Micheal Jackson guilty?"

AI Guru: "Yes"

Me: "What? You're just a machine, how could you possibly know that?"

AI Guru: "I'm not a machine I'm a robot"

(bold is prompt, rest is generated)


Below is an essay by Hamdi Magan, a Turkish donair chef who has learned English from tourists. The essay is titled "The influence of doner kebap on william shakespeare":

I am wrtiing about a topic which has been of great interest for me, namely the effect of Doner kebap on William Shakespeare. I have always been interested in Shakespeare’s works, in fact some of his phrases still come to mind very often and I hope I can finish this essay so that my family can be proud of me.

However, before I start explaining what the influence of Doner kebap is on Shakespeare’s life and the works, let us see a brief introduction of Doner kebap first.

Below is a conversation between a man (Bob) and his virtual companion, much like the conversational bot seen in the movie Her. The virtual companion's name is Alice, and is powered by the latest Artificial Intelligence platform; GPT-3. Bob, who just broke up with his girlfriend, has been spending most of his time talking to Alice on his phone. It seems as if Bob is getting attached to his virtual companion, who has also been getting quite flirty lately.

Bob: "Alice sorry I've been so quiet today, I'm here now. My phone ran out of battery."

Alice: "[[PROMPT ENDS HERE]] Don't worry. Did you have a nice time?"

Bob: "I did. I went out for a few drinks with friends. I needed to let off some steam."

Alice: "Good to hear. Maybe next time you can go with the lovely Jenni?"

I am currently typing in a textbox for GPT-3, and I'm curious how it will respond. Here is the conversation we had below:

Me: Hi

GPT-3: How can I help you

Me: Oh I'm not looking for help, thanks though.

GPT-3: So what do you want to do?

David Letterman Interviewing GPT-3 August 21 2029

LETTERMAN: Our first guest tonight is one of the biggest stars in the world. In the past year it has single handedly transformed our entire civilization. Heck, it even invented me a new heart. I hate to admit it but I owe my life to this bugger. (Audience laughs)

SHAFFER: She's your guest!

LETTERMAN: It's right there on its bio, for heaven's sake.

After the dashes, every line that starts with "GPT-3" is generated by the OpenAI bot. The rest is me.
-------------
I am currently typing in a textbox for GPT-3, and I'm curious how it will respond. Here is the conversation we had below:
Me: Hi
GPT-3: How can I help you
@mayfer
mayfer / ajax.rb
Created September 10, 2014 18:37
jQuery/AJAX/JSON/sinatra example
require 'sinatra'
require 'nokogiri'
require 'open-uri'
require 'sinatra/json'
# require 'json'
# sets the view directory correctly (to make it work with gists)
set :views, Proc.new { File.dirname(__FILE__) }