Miscellaneous

Charming Ruby Compiler

The Charming Ruby Compiler is charming not just by name, but by nature. It's a thesis project at the Computer Science Department at Chalmers University of Technology in Sweden to develop a proof of concept Ruby compiler that compiles to the C-- intermediate language. So far, they've only got the basics working, but it's an interesting project, if only to learn about C--, an interesting 'portable assembly language' that makes life easier for compiler developers. It seems a little like Parrot, and is funded by Microsoft Research and the National Science Foundation.

Read more →

How to format Ruby code for HTML and blog posts

You might have noticed this blog has nice, syntax colored code excerpts, as does Code Snippets. Jim Morris looks at how you can pull this off in a few different ways. One quick and easy way is to use syntax.carldr.com, a Web site that converts any Ruby code you paste into the correct syntax colored HTML. Currently I use TextMate and an external script using the syntax gem, but might use that site instead as it's easier!

Read more →

Vector and Matrix Math in Ruby

NArray is an Numerical N-dimensional Array class. Supported element types are 1/2/4-byte Integer, single/double-precision Real/Complex, and Ruby Object. This extension library incorporates fast calculation and easy manipulation of large numerical arrays into the Ruby language.

Read more →

Asset Management with Ruby DSLs

Jeremy Voorhis has written an interesting, and seemingly overlooked, article about asset management in Ruby and Rails. Firstly he talks about using rake to build a basic asset compiler, and then demonstrates a basic DSL (Domain Specific Language) he created to manipulate image assets in only a few lines of code. An example:

Read more →

PX: A quick and silly Ruby obfuscation system

For the fun of it, I developed a quick Ruby obfuscation tool a few weeks ago. It's not a proper obfuscater that changes variable names and such, but it'll keep your code from being immediately understood. Here's the library, px.rb:

Read more →