This file contains hidden or 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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "summer" | |
class Bot < Summer::Connection | |
def channel_message(sender, channel, message) | |
return unless message =~ /^\.lmgtfy\s+(.+)$/i | |
privmsg "http://lmgtfy.com/?q=#{URI.escape($1)}", channel | |
end |
This file contains hidden or 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
<?php | |
$route["wiki/edit"] = "lorem/ipsum"; | |
$route["wiki/delete"] = "dolor/sit/amet"; | |
$route["wiki/(:any)"] = "wiki/view/$1"; | |
?> |
This file contains hidden or 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
<?php | |
class Wiki extends Controller { | |
function Welcome() | |
{ | |
parent::Controller(); | |
} | |
function _remap($method) |
This file contains hidden or 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 C | |
>> def initialize(foo, bar) | |
>> puts foo.inspect | |
>> puts bar.inspect | |
>> end | |
>> end | |
=> nil | |
>> C.method(:initialize).arity | |
=> -1 |
This file contains hidden or 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
require "hal" | |
Wheaties.register(Hal::Handler) |
This file contains hidden or 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
--- | |
brain: doolanshire | |
# The following two hashes are optional hostmask-based simple | |
# access control for who the brain learns from and who it will | |
# respond to: | |
converses: | |
only: | |
- Jesse!*@* | |
- Cidsa!*@* |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require "rubygems" | |
require "sinatra" | |
This file contains hidden or 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
# Instead of Capistrano running things like: | |
task :deploy do | |
servers.each { upload "foo", "bar" } | |
servers.each { run "rm -rf /" } | |
end | |
# do it like: | |
servers.each do |
This file contains hidden or 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
19:34 ~ $ rvm list | |
rvm Rubies | |
ruby-1.8.7-p249 [ x86_64 ] | |
=> ruby-1.9.2-preview1 [ x86_64 ] | |
System Ruby | |
system [ x86_64 i386 ppc ] |
This file contains hidden or 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
def dangerous! | |
socket = UDPSocket.new | |
socket.connect host, port | |
socket.send … | |
… | |
ensure | |
socket.close | |
end |