Skip to content

Instantly share code, notes, and snippets.

View raws's full-sized avatar
🥯
dabbling in pumpernickel

Ross Paffett raws

🥯
dabbling in pumpernickel
View GitHub Profile
#!/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
<?php
$route["wiki/edit"] = "lorem/ipsum";
$route["wiki/delete"] = "dolor/sit/amet";
$route["wiki/(:any)"] = "wiki/view/$1";
?>
<?php
class Wiki extends Controller {
function Welcome()
{
parent::Controller();
}
function _remap($method)
>> class C
>> def initialize(foo, bar)
>> puts foo.inspect
>> puts bar.inspect
>> end
>> end
=> nil
>> C.method(:initialize).arity
=> -1
require "hal"
Wheaties.register(Hal::Handler)
---
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!*@*
#!/usr/bin/env ruby
require "rubygems"
require "sinatra"
# 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
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 ]
def dangerous!
socket = UDPSocket.new
socket.connect host, port
socket.send …
ensure
socket.close
end