Yes, I know, it’s been almost an entire week since I blogged. There have been plenty of reasons why I haven’t been blogging my progress. Heck, there are plenty of reasons why I haven’t been blogging altogether. 1
But, for the last three days of last week, we began learning about Ruby Gems. Ruby Gems are small packages of code (snippets) that you download (via Ruby’s gem install (gem name)
command on your Terminal) and install to your system to give that supercharged addition to all your scripts. It’s kind of like jQuery for Javascript, and as for PHP, it’s just like PEAR 2 Packages and PHP packages and libraries, where you can add that extra oomph to all your scripts. I hope that makes a little bit of sense.
A few good examples of Ruby Gems are: Instagram Ruby Gem, 3 Nokogiri, 4 and the very first Ruby Gem that I was exposed to years ago when I was learning my very first static site generator script on Udemy: Jekyll.
For our assignments, we focused on two particular ruby gems and then create some cool scripts using the ruby gems provided code. The ones that Skillcrush chose were: Nokogiri and Twilio. 5 For some strange reason, my Nokogiri-based 6 script isn’t reading the CSS class that I pointed out from the given URL to make the “web scraping” capabilities work, so now I would have to start looking into what went wrong with it.
The second assignment, we were asked to create a Magic 8-Ball Fortune Telling script, in which users input their “yes/no/maybe” question into the prompt and then the script’s reply to their question are sent directly to their phone in text/SMS format. The first half is pretty easy, now I’ve gotten used to the earlier assignments. The texting/SMS part is where the Twilio app comes into play.
All of our scripts are now required to be pushed to our GitHub accounts, therefore you can check out the script in there if you’re interested.
When tested on the Terminal, it looks something like this:
The part at the bottom displayed my phone number, so I covered it up for privacy. Basically, the “Welcome…” part is the script asking the user to type in a question about your hopes, wishes, and dreams (must be yes/no/maybe question), just like that good ol’ Magic 8-Ball toy that we used to shake for our answers. In the screenshot of the terminal earlier, I asked if I would meet that special someone near the end of the year.
Unfortunately, my answer via text was not exactly I hoped. It’s the screenshot of my Android phone screen right above this entry.
That’s it for today. I’m now working on our final project for basic Ruby class: a weather app using another Ruby gem. I don’t know how well I’m progressing right now, to tell you the truth, but I’ll keep on working on it. 😅
On the sidenote…
- That includes blogging on my other blog. ↩
- PHP Extension and Application Repository ↩
- Developed and provided by Instagram, of course! ↩
- “web scraping” gem, kind of like an aggregator of sorts, but not really. ↩
- A ruby gem that enables created apps to communicate with users around the world via voice, video, text/SMS, and authentication. ↩
- Nokogiri is written in Kanji as 鋸, meaning “saw.” The “saw” part is where the “scraping” part comes in. ↩
August 8, 2016 @ 8:17 pm
Keep on mastering Ruby! 😀
August 11, 2016 @ 1:14 am
Yeshmam~! salute 😀