Home → The Classics → Farai's Codelab
Quote Generator Revisited
Published:
Quote Generator is the earliest project on my GitHub. It randomly generates quotes when you click a button. I made this while I was using Free Code Camp to learn web development under their front-end development track.
To collect the quotes, I made a Python script to scrape quotes from Epic Quotes. Using BeautifulSoup and urllib, I downloaded the webpage, extracted the quotes using regular expressions, put them into an array before writing the array to a file. I’d then copy-paste the file’s contents into the webpage’s JavaScript. It would have been better to have done this in JavaScript through an AJAX request, but I only knew Python at the time I made the project.
The page itself is less interesting. I was over-reliant on jQuery and Bootstrap even though. So over-reliant I searched how to loop an array in jQuery not realizing that jQuery is just a JavaScript library. Remember that array I made using the Python script? It had 1008 elements leaving a very long line with 76,012 characters, far more than my code editor wants to render. I also had a tweet quote feature which was a good touch.
While the design is minimal, it isn’t pretty. As much as I used Bootstrap then, I’m still over-reliant on it. I guess I should go through Free Code Camp again. For some reason, I embedded multiple times to ensure responsiveness. Even though the like a sir meme on the page is stale, I think it’s a nice touch.
As the first thing in my GitHub, this isn’t bad although I really need to improve my HTML/CSS/JS skills instead of relying on libraries to do all the work for me.