errfree is a factoid & Markov chain text processing bot that features semi- intelligent conversation and the ability to discern question/answer phrases.
- Basic Functions
class Enum; class << self; def new(*list) | |
i = (list[0].class == Fixnum) ? list.shift : 0 | |
Class.new.class_eval do | |
list.each { |item| const_set item, i; i += 1 } | |
class << self; | |
def each(&blk); self.constants.each { |i| blk.call(i) }; nil; end | |
def map(&blk); self.constants.map { |i| blk.call(i) }; end | |
end | |
self | |
end |
require 'humane' | |
server = HB::Server.new # use "include HB" for even more fun | |
server.path "/" do # Hello world, HB style | |
write true, "h1. Hello, world!" # write() = puts() for the web; hx. = <hx></hx> | |
write true, "The URL you entered was '%s'" % url # Just pop that word in there and enjoy | |
end | |
server.path "/submit" do |name| # auto-magically gives you POST/GET-ed variables |
#!/usr/bin/ruby | |
# Viewing as a Gist? See rubytask.md at the bottom | |
ARGV.push 'help' if ARGV.empty? | |
command = ARGV.shift.downcase | |
Taskfile = '/home/'+ENV['USER']+'/.rtasks' | |
system "touch #{Taskfile}" if !File.exist? Taskfile |
class Canine | |
VERSION = '1.3' | |
def initialize(&block) | |
@commands = Hash.new | |
@default = @latest = :commands | |
@empty = nil | |
@auto = { | |
:commands => hash_command("commands","Show a list of commands",Proc.new { | |
@commands.each { |cmd| c = cmd[1] | |
name = c[:name].to_s |