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.
See the basics of ruby and how to do simple things like:
- Loops
- String manipulation
- Concurrency
- Find
- Arrays
- Merge
- Operators
- Collect
-
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 gem
excelsior
. Example 2 uses the defaultcsv
. -
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.
I wanted to learn how to use statistics within real-world scenarios.
If you ever need to extend a class –such as a String, Hash, etc–, Monkey patches are your solution.
These examples are aimed at figuring out how to connect to the Internet to connect using:
- REST
- RPC
- SOAP
- Who Is
- Web Server
A few utility functions aimed at solving:
- Credit Cards
- Crypto
- Time
- YAML