assert_equal in MiniTest

https://gist.github.com/chrisbodhi/b7b10f5e428088fa38da @chrisbodhi I also find it difficult to understand how the test cases are passed. I’ve checked them and they do, but in my opinion test_name_sticks should fail as every call to name will append a new random name to the previous one instead of returning the same string. For example, if we run a simple test: robot = Robot.new 2.times{puts robot.name} we get: QF658 QF658YV199 making it clear that the test should fail. —franrodalg ...

Feb 15, 2015 · Christopher Boette

XML Shenanigans

For the last couple of weeks, I’ve been working on a project at work that has involved, among other things, parsing XML and updating existing XML files. Just like every other time I have to deal with XML, I do two things: Throw up a little bit. gem install nokogiri I found lots of code samples, including in the Nokogiri tutorials, that discussed how to create a new node and then insert a string as the node contents. This would have been ok if my node contents didn’t contain more nodes. Nokogiri tried to be helpful and escaped the node contents. So, not very many < and >, but lots of &gt; and &lt;. ...

Feb 9, 2015 · Christopher Boette

Video for 2015-02-01

I just started playing around with Beats, a command-line drum machine installed as a Ruby gem. It accepts YAML and outputs .wav files like it’s 1998. As I started noodling around with the tutorial, I noticed that the feedback loop could be tighter. I’m used to working with tools like grunt watch at work, and wanted a smoother flow. Rather than getting grunt running, I searched for some command-line solutions. This is what I found. ...

Feb 1, 2015 · Christopher Boette

Refactoring. It's a delight.

From https://gist.github.com/chrisbodhi/15210705414f1b4afcf2 to file_info[:control_info].map {|arr| arr[1] } to file_info[:control_info].map(&:last)

Feb 1, 2015 · Christopher Boette

Add GitHub gists to your Tumblr posts

https://gist.github.com/1395926

Jan 31, 2015 · Christopher Boette

(&:stuff) > {|a| a.stuff}

Rather than writing object.map{ |o| o.action }, I just found out that I could write object.map(&:action). I’m currently attempting to suppress a very strong urge to refactor everything in my current project. No curly braces, no pipes? Sign me up! src & in the Ruby docs

Jan 29, 2015 · Christopher Boette

Markov bot that degenerates over time

As the bot goes on, its algorithm degrades as elements of randomness are introduced.

Jan 17, 2015 · Christopher Boette

Photo for 2015-01-17

Jan 17, 2015 · Christopher Boette

ASCII Charts

“A Ruby library for generating plain text x,y cartesian plots and histograms that can be displayed in a terminal session.” on GitHub

Jan 15, 2015 · Christopher Boette

Quote for 2015-01-13

XML is like violence - if it doesn’t solve your problems, you are not using enough of it. Nokogiri project page Starting a new project today that will heavily involve, you guessed it, XML.

Jan 13, 2015 · Christopher Boette