As part of my work, I often create prototypes of Rails applications. My preferred tool for doing this is Serve. But as excellent as it is, it's a very thin application with no persistence layer. To be honest, I don't really want a persistence layer at this stage. But there are times when I want to be able to iterate over collections of objects the same way that I would in a Rails environment. Creating an index view of subscribers is a great example.
Read more…Intridea Blog: Technology, Design, Business
Back to Blog
Get in TouchYou're currently viewing posts tagged with: "ruby"
Requiring directories in Ruby, Node-style
Node.js has a pattern that I personally enjoy: if you require a directory, it will automatically look for a file called index.js in that directory and require it if present. This, to me, presents a simple, usable way to manage complex require schemes. On a whim, I decided to see how easy it would be to implement such a pattern in Ruby.
Read more…Random Hacks of Kindness
This past weekend I participated in Random Hacks of Kindness (RHoK) hosted by the OpenGov Hub in DC. I was extra excited this time around because RHoK was being held alongside the first ever Sanitation Hackathon, an event that tries to find technological solutions to some of the very serious sanitation problems around the world.
Read more…Building Modular, Scalable Web Apps? Of CORS!
Last weekend I had the opportunity to speak at RubyConf 2012 about a topic that is very exciting to me: Cross-Origin Resource Sharing (CORS). CORS allows for true cross-domain AJAX in the browser which, while simple in concept, is powerful in potential.
Read more…Rails + Girls = A Better Rails Community
The Rails community has had its share of misogynistic controversy over the last several years. Dominated by male programmers (recent statistics suggest 94% of employed Rails programmers are male), the inroads to professional Rails development for females are not exactly accessible or welcoming.
Of course, it's not just the Rails community that lacks representation from women. When only 18% of the Computer Science undergraduate degree recipients in 2010 were female () it's obvious there is a lack of female participation in the entire field of programming.
Read more…GreenOnion, The New UI Testing Tool
Don't cry. We've all been there too. Regression issues in the presentation layer make the entire team go crazy. Why can't we have a methodical way of testing the UI to ensure once designs are styled as views, they stay the way that they were created?
Read more…Vermont, Meet Ruby. Ruby, Meet Vermont.
I'll be spending the last weekend of July with passionate Ruby developers and pioneers in Burlington, Vermont - a small but charming city situated on the eastern shore of sparking Lake Champlain, and the perfect spot for Vermont's first Ruby conference.
Though this is a much anticipated retreat from the commotion of New York City (which is where I've been spending the majority of my time for the last several months), it's also an exciting opportunity for me to share some of the recent work I've been doing on spatial programming and location based apps.
Read more…Smart Timestamps with MongoDB
I really like using MongoDB and Mongoid, but a while back I ran into some shortcomings with querying timestamps. The problem was that I wanted to query only part of a timestamp, such as the day, week or year. So for example, let's say we need to find all users that signed up on a Wednesday.
In SQL there are date functions that let you to parse dates inside your query (although they seem to vary between engines). So in Postgres, you could do something like this:
Read more…Building Streaming REST APIs with Ruby
Twitter popularized the term "firehose API", to mean a realtime stream of data sent through a persistent connection. But even if you're not a realtime service, streaming APIs are great for pushing data from the backend to clients. They reduce resource usage because the server can decide when it's a good time to send a incremental chunk of data. They can also improve the responsiveness of your user experience. The same HTTP API can be reused to power multiple different apps. For example, you could write your web frontend with a Javascript frameworks like Backbone.js, but reuse the same API to power a native iOS application. Follow the jump to read about how streaming APIs work, and how you can write one with Rack::Stream.
Read more…RailsConf 2012 - Evented Ruby vs Node.js
Hey RailsConf goers! You won't want to miss Jerry Cheung, co-author of the just-released MacRuby in Action book and Senior Engineer at Intridea present "Evented Ruby vs Node.js" Tuesday afternoon!
Read more…Polishing Rubies (Part 4): Writing Library Code
Can you believe it? It's actually time to start writing the code for your gem! Now, in this part of the guide you'll be more "on your own" than up to this point. I don't know what kind of open source library you're writing, whether it's an extension to an existing library, a simple utility, or a complex, sprawling project that will change the face of development forever. What I do know, however, is that there are some common things that you may want to do that have community best practices attached.
Read more…Polishing Rubies (Part 3): Tools for Testing
A good toolchain is important for any development project. It makes the lives of developers easier by abstracting away or automating repetitive tasks. You should always spend some time at the outset of a project making sure you're using all of the best tools available. On an open source project this is 10 times more important. Instead of building a toolchain that will be used by your company or small team, you're building a toolchain that will potentially be used by dozens, hundreds, or even thousands of other developers.
Read more…Polishing Rubies (Part 2): Creating A Gem
Eureka! You've thought of a new idea for an open source library. Perhaps you already have some code tucked away in your application that you're extracting into a library, or perhaps you're starting from scratch. Either way, your next step is going to be setting up a gem folder to which you can then add code, tests, and documentation. As we saw previously, RubyGems are simply folders that follow certain patterns. You can build one from scratch quite easily, but luckily we have some tools that make it even easier.
Read more…Polishing Rubies: A Guide to Ruby Open Source Development (Part 1)
Building an open source library can be a daunting task if you've never done it before. How should I structure the project? What do I need to include in terms of documentation? What tools can I use to make my library friendly for others to contribute?
Read more…301 Redirect in a Rails Route
What do you get when you discover you setup a route incorrectly ages ago? Why, a redirect of course! And a blog post with some handy redirect code that you might find useful one day!
Read more…Pry Productivity From Your Code
You've heard of Pry right? It's a full-featured alternative to the classic IRB shell that we use in Ruby, and it's awesomesauce. If you've ever felt like you wanted a crowbar to pry open your code during runtime... well, Pry is your answer.
Pry is essentially a REPL (read–eval–print loop) tool that you can use to examine and debug your code. One of the best features is that local variables are available to Pry, saving you from recreating them as you normally would in an IRB session.
Read more…Capitalizing Apple Products in Ruby (and more)
I've been doing a bit more Ruby and Ruby on Rails coding lately by virtue of silently commandeering the Intridea.com codebase. shhhh, it can be our secret.
Last month I upgraded the site from Rails 2.3 to Rails 3.1; getting up and running on the asset pipeline was a much larger project than I imagined, and while I had plans for a supremely awesome post on all the details of the upgrade, I spent less time taking notes on all the cute little steps and more time... LOST IN TIME AND SPACE with all the.... complications.
Read more…Imbue: A Module Configuration Pattern for Ruby
It's a very common practice in Ruby to use Module mixins to enhance the functionality of a class. In fact, one of the most powerful and useful features of the Ruby language is that it is so easy to do so. Great stuff all around.
Another common pattern, however, is to want to provide some include-time configuration when the module is mixed in. Let's imagine I'm writing an extension for ActiveRecord that creates a slug based on some field. What I want in the end might be something that looks like this:
Read more…Using Anonymous Classes and Modules in Ruby
One of my favorite aspects of Ruby is that just about everything is an object, even Class and Module. The ability to instantiate "anonymous" classes and modules can give you a great deal of power and help you out in situations where you otherwise might not have a clean solution.
What do Anonymous Things Look Like?
Anonymous classes and modules are just like other classes and modules but a little different. This can be seen best by example:
Read more…DynamoDB for Ruby Developers
I've never read Amazon's Dynamo paper. I've also never had the opportunity to work with Cassandra or SimpleDB, but when Amazon announced DynamoDB I thought it was time to take a little bit of time to learn what it was just in case it was super-useful. I thought I'd share a few of my findings.
Disclaimer: I'm completely new to this style of NoSQL system and may well in fact be misusing it in places. Feel free to give me some free education if I'm doing something horrendous below.
Read more…Hunting Down Execution Order Test Failures
Unit tests should pass when run in random order. But for an existing legacy
project, certain tests might depend on the execution order. One test might run
perfectly fine by itself, but fail miserably when run after another test.
Rather than running different combinations manually, RSpec 2.8 has the option
to run specs in random order with the --order random flag. But even with
this, it can be hard to determine which specific test is causing the
dependency. For example:
City Programmer, Country Programmer - Building Rural User Groups
Metro areas generally have really active user groups where Rails_Awesome_Lord presents regularly, famous hackers drop in to give presentations, and the Rails Elite throw smashing parties and drinkups after each meeting. But not all developers live in (or near) metro areas and can partake in such festivities. If you're among the rural band of outlaw programmers, this post is for you.
Read more…Implementing DRY Magic Methods in Ruby
As a new developer to Ruby you might wonder how certain methods seem to be magically available without being strictly defined. Rails's dynamic finders (e.g. find_by_name) are one example of this kind of magic. It's very simple to implement magic such as this in Ruby, but it's also easy to implement things in a way that doesn't entirely mesh with standard Ruby object expectations.
Read more…Michael Bleigh on Rails 3 at Ruby Midwest
Intridea Partner and open source crusader, Michael Bleigh, will be back in his hometown of Kansas City this week, presenting "Rails is the new Rails" at Ruby Midwest.
The sweeping changes brought on by Rails 3 and 3.1 haven’t just made our existing development patterns easier, they have opened up the ability for us to build new patterns that accomplish more in a more beautiful and efficient way. In this session you will see how thinking about new features in a different light can lead to real innovation for your development practices. Examples include baking routing constraints into your models, application composition with Rack, truly modular design with the asset pipeline, and more.
Read more…One Time, At RailsCamp
Last month Intridea sponsored RailsCamp New England - a Rails retreat in the western mountains of Maine. Adam and I attended the event for the second time (this was the fourth U.S. Rails Camp, and the second one in Maine) along with 38 other Ruby and Rails developers. On a rainy Friday evening we all settled in the cozy Maine house for a long weekend of geekery.
Read more…Hire a Guard for Your Project
Of all of the new tools that I've picked up using for development in the past six months, there is one that has come to stand above the others for its nearly universal utility. That tool is Guard.
Guard is a RubyGem but don't let that fool you into thinking it's only
useful for Ruby projects. Guard is essentially an autotest for
everything. It provides a general purpose set of tools for watching
when files are changed in your project and taking action based on it.
You can use it to do just about anything, but common uses will include:
Ruby Thankful
A lot has been made in the talkosphere recently about the brewing "multi-Ruby version manager" war, namely RVM vs newcomer rbenv. I'm not here to discuss the relative merits of either software solution, mostly because I take things pretty simple and straightforward in command-line world and I've never run into problems with RVM. What I do think this little fracas displays, though, is a common thread in the Ruby community of having big, blown-up controversies when new things come along. In some ways, I think that such drama is one of the unique features of the Ruby community that make it so vibrant. It's also a feature of the community that can lead to community casualties.
Read more…Web Application Development and The First Mover Advantage
In the second post in the series on “Why Your Company Needs a Rails Shop”, we’re talking about the “first-mover advantage" and how outsourcing your development to a Rails company can get your product to market quicker.
What’s The Big Idea?
You’ve got a great idea. You know it’s great because you’ve done objective market research, talked to your target customers and made an effort to understand your competition. Now you need to get your product some legs of its own. Getting your product to market as soon as possible can be critical to the success of your initiative. The web is rich with the innovations of passionate people; the landscape is competitive. You have no time to spare.
Read more…Setting Up a Ruby Development Machine From Scratch With OS X Lion
Every so often I like to completely wipe out my computer and start it over from scratch. This isn't because I particularly enjoy the pain of setting up a system from scratch, but it does come with some advantages. I took it upon myself to perform this task when I upgraded to OS X Lion and thought it would also be a great chance to write one of those "how to get a Ruby development machine going from scratch" posts since that's what I'd be doing anyway. So here's the process of how I got my machine set back up to work the way I want it to on Apple's latest.
Read more…GemNotifier Goes Open Source
In April, I announced GemNotifier, a new Intridea SparkTime project. GemNotifier is a web app I created to send notifications to users when the gems they subscribe to are updated.
Today, I'm excited to announce that we are open sourcing GemNotifier. At Intridea, we have a long history of support for open source development, and we make every effort to open source tools and projects that can be of use to the greater development community.
Read more…RailsConf To Go: OmniAuth from the Ground Up
I had the opportunity to speak at RailsConf 2011 about OmniAuth, outlining some of the reasoning behind it as well as some current and upcoming features of Intridea's own "authenticate with anything" middleware. While the session wasn't video recorded, a little trick I've picked up is to run a screencasting program in the background while I present to generate a "poor man's Confreaks" version of the talk. Well, that's exactly what I've done for OmniAuth: From the Ground Up!
Read more…Introducing GemNotifier.org - A Simple Tool for Rubyists
Today I'm introducing GemNotifier.org, a web app I built to deliver timely notifications about your favorite gem updates. It's a SparkTime project at Intridea and it's something I've been working on for the last month.
Read more…Development for Designers
Fun with Ruby: Get All Nancy Drew on Chrome
I use the Chrome history tab when I forget about
something I've looked up in the past. I initially thought that the data would
be stored in a CSV or XML file and thought I could do some string munging for
kicks and giggles. To my delight, when I looked in the "Application Support"
directory for Chrome, I found several data-rich sqlite databases ready for
mining. With a few Ruby tricks, I found some cool data. All the code this article
covers is available on the chrome_spy project.
Summarize - A Ruby C Binding for Open Text Summarizer
Soon to be powering parts of tldr.it, the Summarize gem is a Ruby C binding to the Open Text Summarizer library and makes summarizing any chunk of text a simple task.
Read more…Build A Mac Application From Scratch Using MacRuby and Hotcocoa
Pay no attention to the code behind the curtain: the tech behind tldr.it
Learn all about the tech behind tldr.it, Intridea's Jeremy McAnally's application in the running in the Rails Rumble.
Read more…The Rails Rumble: An Intridean Tradition
This weekend was the fourth annual Rails Rumble event; a software contest among Rails developers, in which smalls teams of coders bring an app to life in just 48 hours. In the week following the Rumble, the apps are judged by an expert panel of judges, winners are selected, and honor is won.
Intridea is no stranger to the Rumble. We've sponsored the event for the last three years, and we've had teams participating since the event was jump-started in 2007. Intrideans have created some interesting applications, like Run1Mile, Lyricist, Love+Loathe, Thingivore, Celebrity Passage, and Smacksale - a deal aggregator that's still collecting data and publishing the hottest sales, even today!
Read more…Ruby Intrigue at Lone Star Ruby Conf
At this year's Lone Star Ruby Conference, Intrideans Brendan, Pradeep, and Adam presented a full-day training, "Ruby Intrigue", in which they walked through the construction of three separate applications: a web crawler, an Asteroids clone, and an SMS server.
Read more…RubyWorld Conf 2010
Fixing Common Bundler Problems
When bundler first came out, I really wanted to like it. It promised a clean way to declare dependencies for your application in a single and definitive place, regardless of what kind of box your app was running on. Unfortunately, bundler has not lived up to the hype, and I've had plenty of headaches from bundler problems. Read on for a list of tips I've pulled together to save you some headache.
Read more…Intridea at Lonestar Ruby Conference
Stop The Hate: Obj-C Deserves Your Love
My first foray into Objective-C was, for lack of a better description, a sink-or-swim situation. Our lead iPhone developer had just been laid off and the boss was in my office the next day asking me how quickly I could "get up to speed". "You know Ruby", he said, "How difficult could it be?" It was time to get some books.
Read more…Redfinger: A Ruby WebFinger Gem
Just yesterday, Google turned on webfinger for all GMail accounts. Today, we’re releasing a RubyGem to help you use the new protocol!
What’s a WebFinger?
Read more…Simple Mustache JSON Serialization
If you’ve taken a look at Mustache, the “stupid in a good way” templating engine, you might know that there are also Javascript Mustache renderers such as Mustache.js. Today we’ve released a small library called mustache_json that allows you to compile your Mustache view objects into JSON, allowing them to be interpreted by Javascript Mustache rendering engines.
Read more…Beboist -- Updates and Attention
Our friends at "Bebo":http://www.bebo.com have selected our "Beboist plugin":http://www.intridea.com/2008/1/11/beboist-a-rails-plugin-for-the-bebo-social-api to be one of their "featured Bebo Social API libraries":http://developer.bebo.com/blog/index.php/2008/04/03/introducing-a-ruby-api-for-bebo/.
This joyous occasion can only be properly acknowledged by the announcement that Beboist has now been moved to "Github":http://www.github.org, a "Git":http://git.or.cz/ repository host where the "cool kids":http://blog.rubyonrails.org/2008/4/2/rails-is-moving-from-svn-to-git play nowadays. We feel that Github's convenient fork-edit-push code publishing mechanism will only help Beboist grow even quicker to become a prominent solution for working with the Bebo API.
Read more…OpenSocial, Buzz and the Tao of Releasing an API
Michael Arrington announced OpenSocial on TechCrunch two days before its official release. Prior to that, there were whispers everywhere about Google’s new social platform, but not many seemed to know what exactly was about to go down. Needless to say, this is good buzz. Two days before ‘launch’ the overwhelming mood among web developers, especially us who dwell in the realms of social networking, was one of intense (even feverish at some points) anticipation. What unfolded over the next few days, combined with what we observed of Facebook’s API venture, provides us a set of best practices that we can apply to an API release.
Read more…Improved BetterNestedSet Plugin
On a recent project when I was using the BetterNestedSet plugin to manage a large hierarchal set of data, I encountered a problem that required me to find all of the items in a nested set that had children and those that didn't. In nested set terms I wanted: all 'parent' nodes and all 'leaf' nodes that exist within the 'tree'.
If you want to do this through the current BetterNestedSet interface you might be tempted to do something like this:
Read more…
















