Getting Expert with GitHub!

Interesting Programming Language

This week my task was to find a new programming language that I have never used before and get familiar with git bash commands to use with Github. At first I though about using either JavaScript or Python but then I wanted to try something that wasn’t mentioned in the Slack Channel which is Ruby. After choosing the language that I’m going to work with now, I have to implement the following tasks into functions which is is to be added to the library I’m going to create:

Task #1

Filename without path. For example: given a path like “/home/kim/mydata.txt”, return “mydata.txt”.

Task #2

File size in bytes. For example, given a path like “/home/kim/mydata.txt”, return 129 (e.g., the file is 129 bytes on disk).

Task #3

SHA1 digest for a file at the given path. For example, given a path like "/home/kim/mydata.txt", which contains the text The quick brown fox jumps over the lazy dog, return 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12.

Task #4

MD5 digest for a file at the given path. For example, given a path like "/home/kim/mydata.txt", which contains the text The quick brown fox jumps over the lazy dog, return 9e107d9d372bb6826bd81d3542a419d6.

Not bad!

I have never used Ruby before but I can still use my programming language experience as most of the programming languages have similar concepts. I had first to setup my development environment, which is fairly easy to do. I have followed this guide on how to install Ruby on Windows 10 machine. I think ruby is a nice programming language but the syntax is very different compare to Java, which is what I’m use to, nevertheless I still prefer Java as my favorite language.

As I have started working on these tasks I have no idea how or where to begin so I search around the web on how to code in Ruby and have found great guides and open source codes, which I have inserted into my code and enhance them in helping solving these tasks. The code can be found in Github down below.

Results & Contribution

Throughout the process I was using git commands to clone the Github respiratory, merge, commit, which was fun to do. I have also contributed to one of my classmates project, which is in JavaScript language accomplishing the same tasks (I helped with getting the file size in bytes). Overall this is a great practice on how to use git bash commands and get out of the comfortable zone to get used to adapt to new things.

I have used sha1-online web to compare the hashes for task #3 and task #4, this is the results for the tasks in order: