Opal has been under development for a couple of years now by Adam Beynon. There is an active community of people working to improve Opal and build extension libraries like opal-jquery, opal-sprockets, and vienna. I’ve started my own little Opal project while writing this blog post. I ported a basic Pixi.js example to Ruby via Opal.
Read more on Opal.rb: Ruby in the Browser…
A preview of Ruby 2.1 was released a couple of days ago with these release notes:
VM (method cache)
Frozen String Literal
def’s return value
I found myself scratching my head for a minute. I don’t know what most of these are! So let’s dig into them and dive into some of the details.
Read more on Kicking the Tires on Ruby 2.1 Preview…
Posted in Languages Tagged ruby
Documentation is a crucial part of any good API or framework. Despite this importance, it often gets neglected and treated as an afterthought.
I recently asked another developer how he always managed to put together such well-thought-out and complete documentation. His response was: “Documentation Driven Design (DDD): if your API feels clunky to document, it’s probably a bad design.” This reminded me of my first introduction to Test Driven Development (TDD). By breaking your code into smaller chunks and testing them first, you were immediately placed on a road traveling toward better design. Given how useful TDD has been for me, DDD seems worthwhile.
One of the main considerations that determines whether I use a framework is how complete and easy to understand the documentation is. But in my own hypocritical way, I’ve neglected good documentation principles on my own hobby projects and frameworks. Read more on Framework Docs Are a First-Class Citizen…
I am a to-do list junky. If I want to get anything done, I need it written in a list somewhere. I used to go through a lot of index cards to keep this obsession satisfied, until I switched to Trello.
Trello is a digital task list with a twist. You organize your tasks by placing them in lists on a board. Cards can be quickly assigned or dragged to another list, making Trello ideal for a Kanban board. Read more on Organize Your Life with Trello…
Acceptance testing is hard. It requires thinking through your entire problem and nailing down the expected outputs for a list of inputs. When working on games, acceptance testing becomes even more difficult.
There are certain aspects that cannot be tested: “Is it fun?” “Is it too hard?” Other aspects are just difficult to setup and too brittle to maintain. You don’t want your tests to break on small tweaks, like player walking speed or jump height, but you want to enforce that the core game mechanics are working: “Can I shoot another player?” “Can I jump up on that ledge?” This is the area where tests can be incredibly useful.
Is the bullet traveling perfectly parallel to the players feet? It’s hard to tell, even when playing.
Read more on Acceptance Testing Your Games to Fix Bugs and Provide Regression…
Chipmunk is a simple, lightweight, fast, and portable 2D rigid body physics library written in C.
I’ve recently helped update the Ruby chipmunk gem to the newest version of the Chipmunk code to brush up on my C skills. There have been loads of features and performance enhancements added since the last chipmunk gem was built (over 120 lines of CHANGELOG goodness). For example:
Read more on Chipmunk Gem, version 220.127.116.11.rc1…
Teaching a workshop involves a lot of thought and preparation. There’s research to do, content prep, slides to tweak — and you have to figure out some way of getting all the attendees started with the same setup. If you’re lucky, you’ll be presenting in a lab with machines that can be set up ahead of time. Puppet, Vagrant, and VirtualBox are fantastic tools to help you get your workshop setup. Using them saved me time and kept me from having to deal with issues on the day of the workshop.
I recently did an “Intro to Rails” workshop at Hope College. Their lab was set up with powerful laptops that were already equipped with VirtualBox. I just needed to provide them with an image to use. If your attendees are bringing their own equipment, think about having them install VirtualBox ahead of time.
Read more on Preparing Machines for Workshops with Vagrant, VirtualBox, & Puppet…
ActiveRecord’s implementation of
#hash is lacking, if not outright broken. I came across this issue while fixing an N + 1 problem in my current Rails application. I’ll use the proverbial Author/Book example to explain. I was doing something like:
@authors = Author.where(some_cond: true)
Later on in my code, I was looping over each author’s books (classic N+1). To fix, just sprinkle on some includes:
@authors = Author.where(some_cond: true).includes(:books)
There, fixed it. Page now loads in… 2 minutes!. How did that happen?
Read more on ActiveRecord Join Models Hash Themselves into Bad Performance…
TL;DR – RubyFlux statically compiles Ruby into Java. It has awesome performance and runs everywhere Java does with no runtime dependencies, but it isn’t done yet.
Charles Nutter, creator of JRuby, has a new offering for the Ruby/Java community: RubyFlux (formerly called fastruby). RubyFlux is a static Ruby to Java compiler. It uses JRuby to analyze the AST of the Ruby files and generate Java source files. The generated code has no run-time dependencies and ends up being pure Java.
RubyFlux could be an amazing tool if/when it gets built into a usable state. It provides massive speedups over MRI or even JRuby.
Here’s a preliminary benchmark. It generates a Mandelbrot Set ten times to compare the native Ruby to the much faster RubyFlux. Here are my results:
Read more on RubyFlux – Statically Compile Ruby to Java…
Posted in Tools Tagged Android, java, ruby
I have a treat for you Github users out there. If you don’t have the Github flavor of markdown memorized, or if you don’t want to write large wiki pages in Github’s browser interface, then the markdown editor Mou may be for you.
Read more on Mou for Markdown in OS X…