A cornucopia of hackery.
A cornucopia of hackery. Toys, Tricks and Tools that have spawned out
of my other projects (RubyInline, ParseTree, Ruby2C, etc) but don’t
exactly fit there. This includes ZenDebugger, ZenProfiler,
ZenOptimizer, ruby2ruby, and more.
ZenHacks is a semi-random collection of libs and scripts that just
don’t belong in a package of their own. Many, if not most, have
dependencies on other packages and use, abuse, or extend them in
This package is not supported in the same sense that my other packages
are, but since it is such a fun playground, I am very open to
contributions, suggestions, and bug fixes. I just can’t put this
project at the top of my priority list the way I can/do the others, so
it may take me longer to get to than normal.
- RubyInline Hacks
- zenprofile-demo.sh - demonstrates the use of zenprofile.
- lib/zenprofile.rb - a code profiler that is fairly readable yet fast.
- ParseTree Hacks
- bin/parse_tree_graph - graphs parsetree for code fed to it.
- test/test_parse_tree_graph.rb - tests for parse_tree_graph.
- RubyToRuby Hacks
- fixloops-demo.sh - demonstrates using parsetree to analyze source.
- lib/fixloops.rb - simple loop analyzer and refactoring tool.
- misc/fixloops-bad.rb - demo code for fixloops-demo.sh.
- lib/ruby2ruby.rb - converts ParseTree’s sexp back into ruby.
- RubyToC Hacks
- r2c_hacks-demo.rb - demonstrates r2c_hacks’ methods.
- lib/r2c_hacks.rb - implements to_sexp, to_ruby, and to_c for methods.
- zenoptimize-demo.sh - demonstrates dynamic optimization of ruby.
- lib/zenoptimize.rb - implements a dynamic optimizer using ruby2c.
- Testing Hacks
- bin/test_stats - shows ratio of assertions to methods
- Misc Hacks
- misc/factorial.rb - not a hack, but a demo file for above toys.
- misc/find_c_methods - sniffs through ruby’s C to find C methods.
- lib/class-path.rb - returns array of each level of a class’ namespace.
- lib/discover.rb - requires files and returns classes introduced.
- lib/muffdaddy.rb - allows you to very easily wrap objects and classes.
- lib/graph.rb - very simple / clean api for building w/ graphviz.
- bin/macgraph - very stupid / ugly frontend for using graphviz on osx.
- lib/OrderedHash.rb - a simple Hash with ordered keys.
- test/TestOrderedHash.rb - (bad) tests for OrderedHash.
- OrderedHash.rb/TestOrderedHash.rb - Orderered keyed collection.
- lib/timezones.rb - fixes the fact that you can’t get timezones from Time.
Get The Code
If you just want to use zenhacks, you can install it via RubyGems:
gem install zenhacks
If you want to hack on zenhacks, clone it from GitHub:
git clone git://github.com/seattlerb/zenhacks