For some reason my brain has defected and has chosen a life of NEVER being able to recall basically anything related to Ruby’s % notation. After seeing this list on a recent Arkency blog post (an awesome blog) I’ve decided to steal repost it here for my own personal reference. %q[ ] # Non-interpolated String […]
Category: Quick Tip
Have you ever had this happen to you? You finish writing some awesome code. You’re a bad ass and you know it. You hit the command line, because you stopped creating GUI interfaces using visual basic a long time ago. Issue a little “git add” here and there, add some broth, a potato. Baby, you’ve […]
For anyone who’s just starting to get into YDD (YOLO Driven Development), here are some good guidelines put together by GitHub user Todor Grudev (tagrudev): View the code on Gist. ps. this is a joke, don’t do any of this stuff… or do it! YOLO!
Ruby provides 3 ways of classifying a methods in a Class: Public, Private and Protected. These keywords are used to declare a method’s visibility and essentially what you’re doing is restricting access to the individual methods contained in your class. Here’s a quick and dirty about the differences: Public These methods are accessible by anyone who calls […]
Here’s a cool trick for dealing with situations where you want to assign multiple values at the same time. The technique used is called parallel assignment and it looks something like this: View the code on Gist. If you’re working with game boards, this is super useful way to pass around board coordinates!!
If anyone actually reads this, here’s an unusual circumstance to look out for… circular object references that cause Pry to go BSC. (For those who don’t know, Pry is a Ruby shell that can be used as a replacement for the default Ruby shell, IRB (like IPython for python people).) Today I witnessed a pretty strange […]
Did you know it’s possible to run (aka build) your Ruby code straight from inside of Sublime Text 2? That’s easy, just make sure your code is saved as a .rb file and hit Command+B. But wait, there’s more… Did you also know it’s possible to run your Ruby code straight from inside of Sublime […]
Some Preface An app I’m working on has a rake that that basically gathers data from the web. Doing things serially is really REALLY slow and to get around this I started using the (fantastic) parallel gem by Michael Grosser. This gem is great — it’s simple to use and in something like 3 minutes […]
My use case for this is that i have a rails app using STI. I’ve got an array of results from all of my inheriting models and i’d like to sort them ALL based on a common attribute they share — a zip code. Here is a RIDICULOUSLY simple way to use Ruby to sort […]