Reading List #3

Five articles I've read and enjoyed recently.

Unearthing the Complete and Total Disaster That Was 'The Chevy Chase Show'

Sometimes TV shows drag their unfunny, uninteresting, yet highly rated feet across our living rooms for years. “Who let this happen?” we cry in vain.

Jennifer Pan's Revenge

The inside story of a golden child, the killers she hired, and the parents she wanted dead.

Reversal of Fortune

Forty-two residents of the struggling cotton-farming town of Roby band together to enter the lottery. They buy 430 tickets. Then - on the eve of thanksgiving, no less - they hit the jackpot, winning $46 million. You might expect a happy ending. Not even close.

Why You Cannot Find "The One"

So much sense.

The Secret Shame of Middle-Class Americans

Nearly half of Americans would have trouble finding $400 to pay for an emergency.

Reading List #2

Five articles I've read and enjoyed recently.

I'm an accessibility consultant. Stop hiring me.

Another tech job we shouldn't need.

Netflix and Ch-Ch-Chilly

How have decades of mass media and technology changed us? A writer returns to his remote hometown — once isolated, now connected. And finds unexpected answers.

Why "Live In The Moment" Is Terrible Advice

This advice has always sounded irresponsible to me.

God Knows Where I am

What should happen when patients reject their diagnosis?

I let strangers make all my decisions for a week and wound up sobbing in an Uber

This was a disaster waiting to happen.

Digital housekeeping

I'm finally getting my house in order. That is my digital house. I've never been very strict about files and folders though I try to keep on top of it. Recently I've felt a new vigour to get things in order.

Aside from a system SSD, where I do store some current work on my desktop, I try to keep my system drive free of anything but OS and software.

Along side the system drive is a 1tb WD Red that is my main drive. This is backed up nightly to a mirrored NAS giving me three local copies of these files. I'm also in the process of backing this up to a new Backblaze account, but the 300gb are taking a while to do.

Finally in my main system is a 640gb drive that I use as a scratch drive. There is stuff on there I wouldn't like to lose but it wouldn't be the end of the world if I did.

My small home server contains a small SSD for OS and software. Also in there are a 2.5in 750gb drive that I use for downloading and general work with a large amount of files. Also in here is my Media drive, a 2tb WD drive that contains films, tv shows, audiobooks etc.

The media drive is manually backed up to an external 2tb Buffalo drive.

In addition to the above I have a portable 2tb drive that lives in my bag. Another 2tb external that used to be my media drive. Two 1tb external Buffalo drives, and a 500gb external Buffalo drive.

So what am I storing where...

Documents and files (1tb WD Red)

All my JPG photos are further compressed using imagemin, in particular the jpeg-recompress binary.

Currently this drive contains about 300gb of data with about 650gb free, so should suffice for a few years to come.

Third drive (640gb)

At the time of writing the folder structure is:

As I said above, it wouldn't be the end of the world if this drive failed. But it's showing no signs and I plan to do something with a lot of the stuff on here soon.

Server - Media drive (2tb)

Back in October 2015 I decided to re-encode all video files to x265 and standardise audio formats and subtitle files. It's taken a long time to do this and I'm still doing it but the bulk of it is done. It's cut the space consumed by these files in half.

This drive is mirrored manually once every couple of weeks to an external 2tb drive.

2 x 1tb buffalo external

This is mirrored on two external drives. Just in case.

Reading List #1

Five articles I've read and enjoyed recently.

The Magic of Untidiness

I'm a very tidy, ordered person, trapped in the body of a clutterer.

Leviathan

David Sedaris on a family trip to the beach.

The Beginner's Guide to Getting Better Sleep

A life-long challenge for me.

I got destroyed at a web-surfing competition

Race across the internet from point A to B using only a one-button mouse: no keyboard, no search, no URL bar, no back button.

The New Essayists, or the Decline of a Form?

David Sedaris and a literary version of reality TV.

Neat Vanilla JS on HackerNews

I recently saw this video by Gordon Zhu highlighting the small but extraodinarily clever JavaScript on the Hacker News website.

I felt it would help me if I simplified it and broke down the steps for future reference. I'm using Paul Buchheit's code verbatim, I hope he doesn't mind, full credit to him.

What does this achieve?

This code is called when an anchor (a link) is clicked to vote up an item on Hacker News. It casts the vote and hides the vote up link so it can't be clicked again.

HTML

The markup for this is REALLY simple. It's a perfect example of progressive enhancement. The full URL is present in the HREF so if JavaScript is turned off the onclick is never called but the vote is still cast.

<a id="up_11659026" href="vote?for=11659026&dir=up" onclick="return vote(this);">Vote Up</a>  

JavaScript

No JQuery here! This is concise and elegant vanilla JS. The only JS on the site is following two functions, with the latter calling the former.

function hide(id){  
  var el = document.getElementById(id);
  if (el) { el.style.visibility = 'hidden'; }
}
function vote(node){  
  var v = node.id.split(/_/);
  var item = v[1];
  hide('up_'   + item);
  hide('down_' + item);
  var ping = new Image();
  ping.src = node.href;
  return false;
}

How does it work

  1. When the link is clicked the vote() function is called with the anchor (<a>) element passed as this
  2. The id, up_11659026, is split at the underscore and the parts passed to an array, v
  3. A new var, item, is given the value at v[1], in this case 11659026
  4. Two calls are made to the hide() function, one with the value up_11659026, and one with the value down_11659026
  5. The hide() function looks for an element with the passed id, if it finds it, the visibility of the element is set to hidden
  6. A var is created, ping, and is an instance of JavaScript's Image object.
  7. By setting the src of ping to the href of the clicked element, the URL is called (in this case a vote is cast by the back-end)
  8. Nothing is returned or rendered as it's unnecessary.
  9. We return false to stop the URL being followed by the browser
  10. If JavaScript is turned off in the browser, the URL is followed when clicked and the same outcome occurs.