Skip to content

Instantly share code, notes, and snippets.

View mseymour's full-sized avatar

Mark Seymour mseymour

View GitHub Profile
@mseymour
mseymour / cinch_plugin_hello.rb
Created August 25, 2011 04:38
A basic 'hello' plugin for Cinch 1.1.3
class MyCinchPlugin
include Cinch::Plugin
react_on :channel
match /hello/, method: :execute_hello
def execute_hello m
m.reply "Hello, #{m.user.nick}!"
end
end
@mseymour
mseymour / acrogame.rb
Created August 26, 2011 20:37
Acrobot acro game class (incomplete 2011-08-25 @ 5:37 PM)
module Games
module Acro
class Game
attr_reader :acronym
attr_reader :answers
attr_reader :voters
def initialize acronym = nil
@acronym = acronym ||= Random.new.rand(3..10).times.map { [*?A...?Z].sample }.join
@answers = []
@mseymour
mseymour / acrogame.rb
Last active October 2, 2015 00:26
Acrobot acro game class (incomplete 2011-08-29 @ 8:55 PM)
module Games
module Acro
class Game
attr_reader :acronym
attr_reader :answers
attr_reader :voters
def initialize acronym = nil
@acronym = acronym ||= Random.new.rand(3..10).times.map { [*?A...?Z].sample }.join
@answers = []
@mseymour
mseymour / remoteadmin.rb
Created September 25, 2011 18:47
RemoteAdmin - message relayer
require 'obj_ext/string'
module Plugins
class RemoteAdmin
include Cinch::Plugin
set help: "Relays certain messages to logged-in admins.", required_options: [:admins]
listen_to :notice
listen_to :private
@mseymour
mseymour / admin.rb
Created October 15, 2011 02:34
IRC bot admin singleton class - 2011-10-13 11:33PM ADT
require 'singleton'
require 'digest/sha2'
class Admin
include Singleton
attr_reader :masks
attr_accessor :password
def initialize
@mseymour
mseymour / table_format.rb
Created October 23, 2011 20:33
ascii table generating class
# Should really make a note here:
# This class currently only accepts arrays of data that has separators, rather than being a two-dimensional array. This will be fixed at some point.
# It will also not take a single string, or other types of collections. This will also be fixed at some point (in that case, table headings would have to be revamped to allow key->value pairings.
# - Mark
# -*- coding: utf-8 -*-
require 'active_support/core_ext/object/blank'
module Helpers
# Formats a supplied array into a list or table.
@mseymour
mseymour / adminhandler.rb
Created November 6, 2011 06:04
Admin handler + automatic +vhoa of bot admins
# -*- coding: utf-8 -*-
require 'modules/helpers/table_format'
module Plugins
module Admin
class Handler
include Cinch::Plugin
set(
plugin_name: "admin",
@mseymour
mseymour / cr_dj_info.yaml
Created December 27, 2011 01:25
DJ info from YAML (debugging version)
---
mli:
My site: http://insomniafanfics.weebly.com
Tumblr: http://mylittleinsomnia.tumblr.com
Facebook: http://www.facebook.com/profile.php?id=100001428581452
PonySquare: http://ponysquare.com/profile-2220/
Twitter: https://twitter.com/#!/DJINs0mnIAK
Skype: legit.sketchy
E-mail: insomnia@ponify.me
XboxLIVE Gamertag: ThatGuyEcho
@mseymour
mseymour / IRC test 212PM 2011-12-28
Created December 28, 2011 17:59
Twitter plugin v6 for Cinch (>=1.2.0)
Observations from below: nil gets sent, so that overrides any defaults.
Search should be switched over to named params.
<@Azure> !tw
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>nil, :nth_tweet=>nil}
<@Azure> !tw azuretan
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>"azuretan", :nth_tweet=>nil}
<@Azure> !tw azuretan+10
<@Aiko_> TWITTER: tweet_by_username - params: {:username=>"azuretan", :nth_tweet=>"10"}
<@Azure> @
@mseymour
mseymour / happybirthdaysean.rb
Created March 17, 2012 19:38
Just something silly that I threw together.
# @author Mark Seymour (mark.seymour.ns@gmail.com)
require 'date'
class Person
attr_accessor :first_name
attr_accessor :last_name
attr_accessor :birthday
# @param [String] The person's first name