Musings of a Fondue

Tag: Ruby

Particles and SketchUp Shenanigans

Particles are cool! Example,

I had this idea back in 2014 of getting the points from premade 3D models (similar to the video above), and using them to do fancy animations in Threejs. Then I hit a knowledge wall and shelved it. Until today…

RailsCasts

Checkout RailsCasts by Paul Bates.

They are very well done! And pack a lot of information into 10 minute bites.

He covers a diverse range of topics related to websites such as security, payments, authentication, spam, tagging, data management, and much much more.

Even if you’re not interested in Ruby the language, or the Rails framework, the videos are useful for leveling up on general knowledge of how websites work.

#notSponsored #itsJustThatGood

Scraping Pictures With Ruby

Another snippet!

I was trying to get some images from this site. They are part of an animation sequence of about 200 images.

At about the sixtieth image it got quite tedious to right click and save each image manually.

So, I did a quick Google search for “using ruby to grab images from a site” and came across this answer on StackOverflow.

Only four lines of code! Four!

Mechanize X Investopedia

I wanted to get the trade history of a user (whom I suspected was a bot), but I didn’t want to copy and paste all those pages.

I had previously watched episode 191 of RailsCasts where Ryan Bates uses Mechanize to login to a site and scrape the desired data. The original instructions in the video were not 100% applicable, however the Mechanize documentation filled in the gaps.

I put a script together using the two sources, and… it worked!

Web Scraping With Nokogiri

This is a small script I originally wrote on October-ish of 2013.

It’s based on this excellent 10 minute tutorial by Paul Bates (RailsCasts).

The script visits a website and returns (‘scrapes’) information without you having to manually open, search, copy, then paste the information you desire. This makes it invaluable for batch executions or tasks you want automated.

I recall being ecstatic at the time - or more accurately, my mind EXPLODING into several pieces!

Though I didn’t take any screenshots, here are some with the same script but run today (May 12, 2015),

Learning Ruby on Rails

I finished Michael Hartl’s intro series to Ruby on Rails.

In the process, I learned a lot about the web in general and website design.

I also learned a lot (and I mean a lot) about patience! Turns out attempting to do a tutorial written in 2010 in 2013 is hard given the blinding rate at which Ruby and its gems are updated.

I also learned about command line use, Github, Heroku, Git, Ruby, and lots of other stuff. The series is quite comprehensive!

The end result is the following website:

Subtitles Using JavaScript - Part 3

Using Excel to convert subtitle files into arrays is too laborious to be practical.

I came across regex while working through Michael Hartl’s Ruby on Rails tutorial. He covers regex in Lesson 6 when talking about password validations.

With generous use of Stack Overflow and Rubular, I managed to put a ruby script together. It takes a subtitle file as an input, and returns a JavaScript array as an output.

Overall using the script requires much less effort than Excel. Only two manual steps of search and replace are needed to finish up the array.

Here it is in action,