Instantly share code, notes, and snippets.

Ross Paffett raws

View GitHub Profile
View gist:132271
proc checkbox {args} {
set choice [expr {int(rand()*[llength $args])}];
for {set i 0} {$i < [llength $args]} {incr i} {
if {$i == $choice} {
lset args $i [format {[x] %s} [lindex $args $i]]
} else {
lset args $i [format {[ ] %s} [lindex $args $i]]
puts [join $args { }];
View lo5.tcl
proc lo5 {who} {
upvar #0 sender sender;
set blank { };
set prefix [string range $blank 0 [string length $sender(nick)]];
puts "$sender(nick) \\o/ \\o/ $who";
puts "$prefix \\\\_ _//";
puts "$prefix /\\ /\\";
View array#pick.rb
class Array
# Pick +number+ random elements out of the array. If +number+ is
# greater than the size of the array, this method will simply return
# the array itself, sorted randomly.
def pick(number)
sort_by { rand }.slice(0...number)
View Global Away.scpt
# Global Away.scpt
# This Colloquy plugin takes over the "/away" command and sets your away and
# back status for all connections at once.
# Version: 1.0 (8 September 2009)
# Author: Ross Paffett (
# License: Distributed under the same terms as Colloquy.
using terms from application "Colloquy"
View gist:311978
class CommandsController < ApplicationController
before_filter :authorize, :except => [ :index, :show ]
def index
@commands = Command.all(:order => "name")
def new
@command =[:command])
View gist:321850
exit if ARGV.empty?
require 'timeout'
# Upload files to Hey.
uploaded =
ARGV.each do |f|
next unless File.exists?(f)
type = case File.extname(f).downcase
when '.jpg', '.jpeg' then 'image/jpeg'
View gist:337943
module Wheaties
module Commands
module Channel
def on_join
channel = response.args.first
if response.sender.nick == connection.nick
broadcast(:who, channel)
log(:info, "Joined", channel)
View gist:337951
module Wheaties
class Connection < EventMachine::Protocols::LineAndTextProtocol
attr_reader :nick, :user, :real, :channels
class << self
def instance
View gist:338265
module Wheaties
class User
include Comparable
attr_reader :hostmask, :modes
def initialize(args)
if args.is_a?(Hostmask)
@hostmask = args
@modes =
View gist:339778
result = ["line one"]
result << "line two"
result << "line three"