25th May 2015

Two steps forward, Three steps back

Shortly before christmas I made the decision to get all of my code onto github (initially privately before moving to open). It would push me to commit more often throughout projects and push all files to a remote server, where they were at lower risk of getting lost or accidentally deleted. Git also allows my to undo any errors I might make and gives me the flexibility of using branching to build in new features.

So I was getting all my files and folders in place ready to git push and cleaning up the directory structure along the way (using terminal because it’s awesome). But heres where it went a little wrong. In order to delete folder structures (especially those that have permissions on them) you need to use the command

$ sudo rm -rf [DIRECTORY NAME] 

Note: this is probably one of the most dangerous commands you can enter into terminal as I will explain.

This removes (rm command) all files and directories (-rf flag) within the designated directory and uses super-admin privileges to do so. Basically you type this and your password into the terminal and the directory is gone. Forever. Not getting it back. No recycle bin. Gone.

I made the mistake of entering this command and being forced to watch as my whole desktop being whipped out, destroying the folders containing my websites code.

At this point you’re probably thinking “Just download the files off the internet” but it’s not the simple. The files on the internet only contain the minified versions of the code for performance reasons. The build files are stored locally, or they were.

Thankfully I did have backups (albeit slightly old ones) for most of my work and some of it was built before I started using grunt with Sass, minification and concatenation so it was just a case of downloading the live files and pushing them to github.

The backup I had for davidendersby.me dated back to August 2014 roughly version 2.0. I had lost a few months of work but it did give me the opportunity to rebuild the about page in pure javascript. This is the page I’m most proud of.

I can’t deny that it has been a little frustrating having to rebuild work that I had done already. One of the biggest tasks, and one thats not entirely finished as I write this, was to migrate the css to Sass. It required making the codebase more modular, removing redundancy and cleaning everything up. I’ve also changed the font (influenced by theverge.com), making the whole site cleaner and more minimalistic. I removed a lot of code from the music listing page which attempted to resize video content responsively and centre the play button. It had been upgraded to jQuery previously cos the majority of the code if fallback or redundant. I have rebuilt the page to use the video thumbnail (grabbed from Youtube) as a background image (using the aspect ratio sass mixin from css tricks)and using progressive enhancement to make the play button load and centre with javascript. It looks practically identical to the previous implementation but now works far better, with much less code.

Its all very much a work in progress but its a start. On the upside all the code is now open source on github.

Version 2.2.1 released 25/5/15