See what we’ve written lately
Ruby: Converting XML to JSON
Today I was asked to convert an XML file full of e-mail addresses into JSON. I thought this solution might help others learn how to create an XML,...
Rails: Populating Your Database using Seeds.rb
When I'm building a new app, I prefer to populate my site with fake data so that I can see how the app actually starts responding...
Ruby: Loops
There are a lot of different ways to complete a loop. Here's a list of the most popular ones. Loop Loop in increments of 2 until...
Ruby Enumberable
I doubt many people will need this but here are a few neat things you can do with Ruby. I won't go into great detail but...
Rails: Querying the model
Thanks to some metaprogramming magic, whenever you create a column within a table, you get a free find_by_[name of column] method. Create a new Friend model...
Rails: Authenticating with Devise
I've been working with the Stripe API lately and I thought it might be handy to write a simple Ruby on Rails application that integrates Ruby...
Rails: Installing RoR using RVM
There are many ways to install Ruby on Rails but the current trend is to use a package manager to keep things in order. The best two options...
Rails: Validating Your Models
Rails is all about patterns and when you're creating models, it's important to set pattern-based rules before you publish to your database. Below are...
Ruby Sinatra
Rails is terrific, but if you're new to web development, I suggest you give Sinatra a try first. Not only is it excellent for building small...
Ruby: Using Time
There are many functions available for Time, Month, Day, and Year. Below are a few examples. # Find out the Current Time t = Time.now # Find out the Month,...
Ruby: Encrypting passwords for a database using one-way hash technique (SHA1)
Before you save a password to a database, it may make sense to encrypt it. That way, when you do some user authentication, you can compare the users...
Ruby: Validate a Credit Card Number
Download the Credit Card Library from Lucas Carlson. sudo gem install creditcard # Checksum Digit, there is an algorithm that checksum must match # A. Import the libraries require '...
Ruby: How to parse an RSS Feed
Here's a short example of how to parse an RSS feed using Ruby. require 'rss' require 'open-uri' open('https://www.chrisjmendez....