This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { }]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /\\ /\\"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 ([email protected]) | |
# License: Distributed under the same terms as Colloquy. | |
using terms from application "Colloquy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommandsController < ApplicationController | |
before_filter :authorize, :except => [ :index, :show ] | |
def index | |
@commands = Command.all(:order => "name") | |
end | |
def new | |
@command = Command.new(params[:command]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exit if ARGV.empty? | |
require 'timeout' | |
# Upload files to Hey. | |
uploaded = Array.new | |
ARGV.each do |f| | |
next unless File.exists?(f) | |
type = case File.extname(f).downcase | |
when '.jpg', '.jpeg' then 'image/jpeg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Wheaties | |
class Connection < EventMachine::Protocols::LineAndTextProtocol | |
attr_reader :nick, :user, :real, :channels | |
class << self | |
def instance | |
@@instance | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Wheaties | |
class User | |
include Comparable | |
attr_reader :hostmask, :modes | |
def initialize(args) | |
if args.is_a?(Hostmask) | |
@hostmask = args | |
@modes = Set.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = ["line one"] | |
result << "line two" | |
result << "line three" |
OlderNewer