Skip to content

Instantly share code, notes, and snippets.

View sarahhodne's full-sized avatar
🏳️‍⚧️

Sarah Hodne sarahhodne

🏳️‍⚧️
View GitHub Profile
class Battery
attr_reader :level
def initialize
@level = 0
end
def charge(uplevels)
@level += uplevels
@level = 100 if @level > 100
sine:~% ruby primetester.rb
Rehearsal ------------------------------------
2.980000 1.160000 4.140000 ( 4.164864)
--------------------------- total: 4.140000sec
Primesum: 496165411
user system total real
2.940000 1.180000 4.120000 ( 4.139064)
require "baguette/command"
module Baguette
end
/home/mint/pavarotti/plugins/irc/irc.rb:46:in `register_events': wrong number of arguments (1 for 2) (ArgumentError)
from /home/mint/pavarotti/plugins/irc/irc.rb:15:in `initialize'
from /home/mint/pavarotti/pavarotti.rb:95:in `new'
from /home/mint/pavarotti/pavarotti.rb:95:in `do_load'
from /home/mint/pavarotti/pavarotti.rb:27:in `load!'
from bot.rb:6:in `<main>'
square:~/code/euler[master]% ruby problem1.rb --solution
Project Euler
Problem 1
=============
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Solution (calculating):
266333
<?xml version="1.1" ?>
<config>
<listen interface="0.0.0.0" port="6667" />
<hostname>irc.sine.cluenet.org</hostname>
<motd src="/etc/ircmotd" />
</config>
require "rubygems"
require "eventmachine"
require 'thread'
require 'mutex_m'
require 'socket'
module RubyIRCd
class Server
module EMServer
<?xml version="1.1" ?>
<config>
<network>RubyIRCd Test Network</network>
<listen interface="0.0.0.0" port="6667" />
<hostname>irc.sine.cluenet.org</hostname>
<motd>
This is a testing server and it may reboot without warning!
</motd>
<opers>
<oper username="Dvyjones" pass="Hippos" />
16:27:24 < Dvyjones> That's like if I pick up my iPod and say "everyone expects this to be an iPod, but I say it's a toaster".
16:27:30 < Dvyjones> And it is a toaster.
16:27:39 < Dvyjones> But that would defy the laws of physics.
16:27:47 < Dvyjones> And the whole universe would implode.
16:27:49 < grawity> .whois hotdog
16:27:53 < Dvyjones> Into a gniB gnaB
16:27:58 < Dvyjones> Erm
16:28:02 < Dvyjones> *gnab giB
16:28:15 * LuminolBlue is back.
16:28:19 < Dvyjones> Hey LuminolBlue
def receive_data(data)
@buffer << data
while @buffer.include?("\x0D\x0A") && (line = @buffer.split("\x0D\x0A").first)
@handler.input(line.strip)
@buffer = @buffer.split("\x0D\x0A")[1..-1].join("\x0D\x0A")
end
end