Skip to content

Blog

Ah, JavaScript...

Republished from earlier blog

Normally I wouldn’t expect myself to find a reason to blog about JavaScript. After all, for anyone who’s gone through the browser wars having tried to do html the hard way and be browser friendly, JavaScript, CSS, HTML, & DOM differences would be enough to make one vow never to touch the stuff again, particularly when the easy-to-control server-side .NET programming became available.

But, if you are interested in AJAX, you’ll probably get back to the JavaScript thing again (like I am about to).

So, along that vein, I thought I would note a post by Bertrand Le Roy about a nice, tight-coded way to ensure a JavaScript function returns a Boolean (as opposed to a null, undefined, or object. He also shared a way to force an undefined to return a null. Here’s the code snippets:

something ? true : false
!!something
return something || null;

Ah! That’s refreshing! Brings me back to my old C++ days…

Rebooting My Site

This reboot (Dec 27-28, 2016) is less about content and more about rendering GitHub pages in a clean GitHub repository of posts.

By clean, I mean that the repository has a small-footprint of files for actually rendering the page and is focused on keeping the posts (in MarkDown format) up-front. Why do I want this? Well, it’s basically because other solutions (i.e. - Jekyll) seem to flood the repository with all sorts of templates, parsable items, yaml files, etc.

Instead, I want to just have the following core files:

index.html
A small, clean html file that "frames" out the web page.
index.js
A small, clean javascript file that leverages CDN libraries to load (using Fetch) and parse MarkDown files as HTML.
index.css
A small, clean CSS file that uses modern layout tools like the modern FlexBox CSS and the upcoming Grid (which is "upcoming" in that most browsers don't support it yet).
nav.md
The article list as a MarkDown file that creates a simple list of links to the pages.
ReadMe.md
A ReadMe.md file that most repositories have that doubles as the "home page" content of the web page.
.nojekyll
Required to prevent GitHub from default-rendering the site as a Jekyll website (which prevents getting the MarkDown files via Fetch).
404.html
To re-direct the user to the home page

I’m using Vue and Vue-Router to help accomplish these tasks. It’s important to me that the site makes it friendly for the visitor to bookmark articles (#DontFearTheHashBang). Also, since there is no other “dynamic” aspects than having more posts to share, I would like it to work as a SPA (Single-Page-App).