Archive for the ‘ Ruby ’ Category

List

In my quest to provide something everybody already has, I present to you List, a simple Linked List implementation in Ruby. You can get it here, if you really want to. This is my first experiment in test driven development, and it┬ádefinitely┬áproduced many more tests than any other code I’ve written. We’re talking 8 tests for 2 classes, some 13 or 14 tests. It worked pretty well, but I don’t know if I’ll do it again. Maybe I won’t need to.

Obscuring Information in Function Calls

While the usefulness of this is questionable, it is possible to obscure valid information in a bogus function call. Check out the following code:

class Example
	def new(*args)
		puts "Got data: " + args[1] if method_name == :new
	end
end

You can then write the following code:

Example.new("127.0.0.1", 1342)

And it should print out “127.0.0.1”. What’s more, the actual call looks like an internet connection, not something that might print something. Again, the usefulness of this is questionably, but it could be useful.

Deady and irc bots.

I recently got involved in the creation of irc bots. It is common knowledge that my language of choice is ruby, so I set about making a bot in ruby. None of my friends had used ruby, they had used perl and PHP. I got an IRC library, and improved it, adding support for joining channels after the MOTD, a problem which was afflicting my bot (it wouldn’t always join the channels) an added support of auto-joining mutliple channels. I am currently working on a weapons system and dice bag. I then forked the project, and created Deady, a hellish irc bot. Deady is just like my other IRC bot, only Deady is contained in a single file, which you can download here. Deady utilzes ruby’s random number generator to generate a random name. It then joins the specified channels, and sits, doing nothing. However, if somebody says:
botsnack

Deady will say: botsnack, starting a vicious cycle where each deady will say botsnack, causing the other one to say botsnack, and causing all the other bots in the channel to respond with thier proper botsnack response (typicaly “:D.”) Though it has not been tested in a real world enviroment, I trust it works well. You can visit my nice bot, RBHellfire, on #bots on irc.foonetic.net. He doesn’t do much yet.

-Indigo

YstSimRB

Got a new programing project on github: YstSimRB Please provide positive criticism. No negative, please.

RubyCrypt Update

RubyCrypt Update! I am currently working on a new version, 1.2, and it may have a new feature, support for STDIN!. maybe. Still working on it.

RubyCrypt 1.0.1

RubyCrypt 1.0.1 has been released. You can download it here.

New Features:

  • Added the version option in the main menu.
  • You can now download it from my blog

And please, post the features you want to see in the comments!