Skip to content

skygroundmedia/ruby-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Exercises

These are a few ruby scripts and exercises I use to refresh my memory. There's no particular order but they do cover the basics of ruby, ruby gems, web services, web servers, classes, mix-ins and modules.


Ruby Basics

See the basics of ruby and how to do simple things like:

  • Loops
  • String manipulation
  • Concurrency
  • Find
  • Arrays
  • Merge
  • Operators
  • Collect

Ruby Apps

  • CSV Parser - This app uses Ruby gem excelsior to parse a CSV file with over 42k rows into a Dictionary. This is the lightning fast approach to parsing.

  • CSV to JSON - This app shows how to convert a CSV fie into JSON. Example 1 uses the Ruby gemexcelsior. Example 2 uses the default csv.

  • Food Finder - This app shows how to make a Kiosk-type application.

  • Nginx Error Log Parser - This app will parse and sort an Nginx Log to count errors.

  • Reporting - I was given about 1000 records with timezones. The data is supposed to represent where users are located when they log on. My job is to iterate through each record and organize it into a report that's easy to read.

  • XML to JSON - The first script create an XML file filled with fake user info.


Ruby + R

I wanted to learn how to use statistics within real-world scenarios.


Monkey Patches

If you ever need to extend a class –such as a String, Hash, etc–, Monkey patches are your solution.


Web Related

These examples are aimed at figuring out how to connect to the Internet to connect using:

  • REST
  • RPC
  • SOAP
  • Who Is
  • Web Server

Utilities

A few utility functions aimed at solving:

  • Credit Cards
  • Crypto
  • Time
  • YAML