I gave a lightning talk at RubyConf 2012 in Denver. Man was I nervous. Apparently I did an okay job though, and I'd like to thank all the people who were and took time out of their day to listen to me. Thanks! If you want to view the original talk, the video is here. Scroll to 10:15 to find me, but I recommend watching them all. A few people had more questions (I talked really fast since it was a lightning talk after all) and this was originally…
Named a file wrong? Need to move it to another directory? No big deal. What if you named a view file foo.haml instead of the proper foo.html.haml? mv app/views/widgets/foo.{haml,html.haml} Does exactly what you think it does. It expands to: mv app/views/widgets/foo.haml app/views/widgets/foo.html.haml Since it's just bash, it also works with git: git mv app/views/widgets/foo.{haml,html.haml} Works within the path too: git mv app/views/{widget,wh…
Here's something I cooked up this evening. Nothing too epic, but it's a neat illustration of metaprogramming with ruby. Ruby allows you to reopen classes and add methods to them. You can also make a Module and include that in a class to add methods. I've added four methods to the Symbol class and overridden one method in the Array class (using alias to keep the old method around since super doesn't quite work). Now we can pipe arrays like bash u…