<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wei Ji</title>
    <description>The latest articles on DEV Community by Wei Ji (@weiji14).</description>
    <link>https://dev.to/weiji14</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F109890%2Ff9a2dbfb-e960-420e-a091-1f7dbe7b2008.jpeg</url>
      <title>DEV Community: Wei Ji</title>
      <link>https://dev.to/weiji14</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/weiji14"/>
    <language>en</language>
    <item>
      <title>On your markdown, hypertext, now!</title>
      <dc:creator>Wei Ji</dc:creator>
      <pubDate>Tue, 06 Nov 2018 02:35:51 +0000</pubDate>
      <link>https://dev.to/weiji14/on-your-markdown-hypertext-now-2cb6</link>
      <guid>https://dev.to/weiji14/on-your-markdown-hypertext-now-2cb6</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally posted at &lt;a href="https://letsjustwander.now.sh/on-your-markdown-hypertext-now!/"&gt;letsjustwander.now.sh&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I'll &lt;a href="https://dev.to/weiji14/developing-behaviours-by-starting-with-why-4n78"&gt;start with the why&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gherkin"&gt;&lt;code&gt;    &lt;span class="c"&gt;# language: en&lt;/span&gt;
    &lt;span class="kd"&gt;Feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; Free and minimal static blog
      In order to have a long-lasting blog
      As a blogger,
      I want a system that is portable

      &lt;span class="kn"&gt;Scenario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; Blog host goes down
        &lt;span class="nf"&gt;Given &lt;/span&gt;a backup copy of my blog's content
         &lt;span class="nf"&gt;When &lt;/span&gt;my old blog host becomes unviable
         &lt;span class="nf"&gt;Then &lt;/span&gt;I can rehost my blog and content somewhere else
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bit of background, I've been blogging on and off since I was a teenager maybe 10 odd years ago. As a kid, spending money on hosting and domain names was something I avoided like the plague, and keeping things &lt;em&gt;free&lt;/em&gt; is still something I'm obsessed with.&lt;/p&gt;

&lt;p&gt;A problem I faced was keeping my blog content safe from blogging platforms going down, becoming obsolete, or getting sucked in to very corporate locked-in platforms. I have only a faint idea on where my first &lt;a href="https://en.m.wikipedia.org/wiki/Windows_Live_Spaces"&gt;Windows Live Spaces&lt;/a&gt; posts are, stored in some proprietary format I may never unlock. The backups from my golden &lt;a href="https://en.m.wikipedia.org/wiki/B2evolution"&gt;b2evolution&lt;/a&gt; years (late 2000s to early 2010s) are likewise stuck in some mysql database which is marginally 'better'.&lt;/p&gt;

&lt;p&gt;Around 2014 after graduating from my degree (while travelling in Chile actually) I restarted blogging using &lt;a href="https://en.m.wikipedia.org/wiki/Ghost_(blogging_platform)"&gt;Ghost&lt;/a&gt;, the beta version. It was a bridge connecting me from the old school PHP based Content Management Systems I've used before to something akin to 'modern' JAMstack.&lt;/p&gt;

&lt;p&gt;But when Ghost 1.0 got released, I didn't bother migrating to the new API. Technically the posts were stored in JSON and I &lt;em&gt;could&lt;/em&gt; parse it if I wanted to. Read: still a lot of effort to go on a trip down memory lane.&lt;/p&gt;

&lt;p&gt;Really, it all seemed too much to maintain. Yes I &lt;em&gt;could&lt;/em&gt; pay, and have someone manage the hosting, upgrades, backup and whatnot.&lt;/p&gt;

&lt;p&gt;But stubborn ol' me thought the world must have gotten better than that. It's 2018 already for goodness sake! Was it too much just to have a few kilobytes or megabytes in the cloud to host some blog?&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Nuclear disaster proof blog&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Ok, I'm probably exaggerating. If you've read this far, you're probably hoping I've got a solution.&lt;/p&gt;

&lt;p&gt;I'm not a web developer, but I do program and can follow instructions. The blogging workflow below will not be Wordpress WYSISYG friendly, nor is it reliant on some passing Javascript framework that may or may not exist in the next 5 years.&lt;/p&gt;

&lt;p&gt;Because I'm paranoid, there should be &lt;strong&gt;two&lt;/strong&gt; and at least &lt;strong&gt;two&lt;/strong&gt; ways to do any part of the pipeline below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m3q7BN-3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://yuml.me/diagram/scruffy/class/%255BWriting-text%255D-%253E%255BText-to-hypertext%255D%2C%255BText-to-hypertext%255D-%253E%255BPublishing%255D" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m3q7BN-3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://yuml.me/diagram/scruffy/class/%255BWriting-text%255D-%253E%255BText-to-hypertext%255D%2C%255BText-to-hypertext%255D-%253E%255BPublishing%255D" alt="Writing text, Text to hypertext, Publishing" width="618" height="63"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So what do we use?&lt;/p&gt;

&lt;h2&gt;
  
  
  Static plaintext
&lt;/h2&gt;

&lt;p&gt;One word - plain-text.&lt;/p&gt;

&lt;p&gt;I'm not chucking my words into some database no matter how open source it is. Nor am I going to put it into JSON, YAML, or some other FOUR letter acronym format.&lt;/p&gt;

&lt;p&gt;Each post should &lt;strong&gt;standalone&lt;/strong&gt; as one file. As a minimum, the blog folder will have an index page and a folder for all the individual posts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;_posts/

&lt;ul&gt;
&lt;li&gt;hello-world.md&lt;/li&gt;
&lt;li&gt;post-two.md&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;index.md&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I write my posts in &lt;a href="https://en.wikipedia.org/wiki/Markdown"&gt;markdown&lt;/a&gt; and although there's a hundred flavours out there, I can probably still open up a .md file in ten years and read it. If I had written my posts ten years ago in markdown, I would still be able to read it. Period. You could use some other markup language (LaTeX anyone?) if you fancy, but I highly recommend markdown.&lt;/p&gt;

&lt;p&gt;To store all the metadata of a post (e.g. date, title, tags, etc), I put it into a short YAML frontmatter like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;date&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;2018-10-31T12:00:00+12:00&lt;/span&gt;
&lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Hello World&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This follows the &lt;a href="https://jekyllrb.com/docs/front-matter/"&gt;Jekyll frontmatter&lt;/a&gt; convention. But we won't be using Jekyll (gasp!), though it &lt;em&gt;is&lt;/em&gt; a popular static site generator. I feel like there's too much boilerplate, &lt;a href="https://jekyllrb.com/docs/structure/"&gt;too many folders&lt;/a&gt; for css files, plugins and whatnot.&lt;/p&gt;

&lt;p&gt;The same can be said of most other &lt;a href="https://www.staticgen.com/"&gt;static site generators&lt;/a&gt;. Everyone has an opinion on what's better, faster, trendier. Popularity means nothing if we're going for longevity, remember Geocities? Instead, we're going for something opinionatedly unopinionated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Text to Hypertext
&lt;/h2&gt;

&lt;p&gt;The only reason we need this text-to-hypertext step is so that your blog doesn't look like some git repository. Or, yes you could upload all your files to an FTP site and call it a day. If that's you, skip down to the publishing/hosting part below.&lt;/p&gt;

&lt;p&gt;Today, we're striving for minimalism, but we're not compromising on quality!&lt;/p&gt;

&lt;p&gt;I'll jump straight to the chase and recommend no nonsense &lt;a href="https://github.com/11ty/eleventy"&gt;Eleventy&lt;/a&gt;. Alternatively, skip ahead for Plan B - pure scripting!&lt;/p&gt;

&lt;h3&gt;
  
  
  Plan A - Using Eleventy
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.11ty.io/docs/getting-started/"&gt;Install eleventy&lt;/a&gt; with npm in your terminal as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; @11ty/eleventy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to the top-level directory of the blog and type this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    eleventy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Eleventy will process your .md markdown files into .html, by default into a _site folder. Our folder should now look like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;_posts/

&lt;ul&gt;
&lt;li&gt;hello-world.md&lt;/li&gt;
&lt;li&gt;post-two.md&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;_site/

&lt;ul&gt;
&lt;li&gt;hello-world/index.html&lt;/li&gt;
&lt;li&gt;post-two/index.html&lt;/li&gt;
&lt;li&gt;index.html&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;index.md&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And that's all there is, seriously! Okay maybe &lt;a href="https://www.11ty.io/docs/"&gt;read the docs&lt;/a&gt; or add some &lt;a href="https://www.11ty.io/docs/plugins/"&gt;plugins&lt;/a&gt; if you want more configuration jazz. Otherwise, take your &lt;code&gt;_site&lt;/code&gt; folder host it somewhere (see next section).&lt;/p&gt;

&lt;h3&gt;
  
  
  Plan B - Using pandoc
&lt;/h3&gt;

&lt;p&gt;Credits to &lt;a href="https://dev.to/gypsydave5/write-and-deploy-a-super-fast-web-site-in-30-seconds-with-no-framework-4lab"&gt;@gypsydave5&lt;/a&gt; for coming up with this!&lt;/p&gt;

&lt;p&gt;If you haven't got swiss-army knife pandoc, &lt;a href="https://pandoc.org/installing"&gt;install it&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;pandoc &lt;span class="c"&gt;#linux&lt;/span&gt;
    brew &lt;span class="nb"&gt;install &lt;/span&gt;pandoc         &lt;span class="c"&gt;#mac&lt;/span&gt;
    choco &lt;span class="nb"&gt;install &lt;/span&gt;pandoc        &lt;span class="c"&gt;#windows&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'm using Linux as my system, so next I would fire up my bash shell and type in this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="k"&gt;for &lt;/span&gt;POST &lt;span class="k"&gt;in &lt;/span&gt;_posts/&lt;span class="k"&gt;*&lt;/span&gt;.md&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do &lt;/span&gt;pandoc &lt;span class="nt"&gt;--to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;html5 &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;_site/&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;%.md&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;.html &lt;span class="nt"&gt;--standalone&lt;/span&gt; &lt;span class="nv"&gt;$POST&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is basically a for-loop that converts every &lt;code&gt;.md&lt;/code&gt; markdown file in the &lt;code&gt;_posts&lt;/code&gt; folder to a standalone &lt;code&gt;.html&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;The caveat with this method compared to (a properly configured) eleventy is that it &lt;strong&gt;will&lt;/strong&gt; look horrible. There's no CSS styling, so you'll get something that's akin to a 90s era webpage.&lt;/p&gt;

&lt;p&gt;Luckily pandoc does allow you to set a &lt;a href="https://pandoc.org/MANUAL.html#options-affecting-specific-writers"&gt;&lt;code&gt;--css&lt;/code&gt;&lt;/a&gt; file or url to make it prettier (credits to &lt;a href="https://devilgate.org/blog/2012/07/02/tip-using-pandoc-to-create-truly-standalone-html-files/"&gt;Martin&lt;/a&gt;). You could point to some &lt;code&gt;pretty.css&lt;/code&gt; file you made, or cheat like me below and chuck in a CDN hosted css.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="k"&gt;for &lt;/span&gt;POST &lt;span class="k"&gt;in &lt;/span&gt;_posts/&lt;span class="k"&gt;*&lt;/span&gt;.md&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do &lt;/span&gt;pandoc &lt;span class="nt"&gt;--to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;html5 &lt;span class="nt"&gt;--css&lt;/span&gt; https://cdn.rawgit.com/yegor256/tacit/gh-pages/tacit-css-1.3.1.min.css &lt;span class="nt"&gt;--output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;_site/&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;%.md&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;.html &lt;span class="nt"&gt;--standalone&lt;/span&gt; &lt;span class="nv"&gt;$POST&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used &lt;a href="https://github.com/yegor256/tacit"&gt;tacit css&lt;/a&gt; above, which is a class-less CSS framework. That means I'm not bothering with opinionated class names that goes with using some front-end framework like Bootstrap or newer players out there. Simply write proper HTML5 (whatever proper means) and it will do the trick, at least until HTML6 comes out.&lt;/p&gt;

&lt;p&gt;You might need to tweak this &lt;code&gt;pandoc&lt;/code&gt; method further to get it to look as nice as &lt;code&gt;eleventy&lt;/code&gt;. There's probably a million ways to do this step so I'll leave that to your imagination. Share it in a comment if you have another one-liner script that does it!&lt;/p&gt;

&lt;p&gt;Now, let's jump straight into the scary part - publishing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Publishing/Hosting
&lt;/h2&gt;

&lt;p&gt;So you've written your blog post (in markdown), you've converted it into nice hypertext (html), now it's time to put it up somewhere! Again, I'm aiming for free. That doesn't mean it can't be easy.&lt;/p&gt;

&lt;p&gt;So far I've been through more dodgy free hosting providers than I can count. What I dislike is a free lunch that I'll get a stomachache from later.&lt;/p&gt;

&lt;p&gt;I'm of the opinion that publishing in itself is a scary thing, especially for new writers. But the last thing you want is to have a blog post written up and having it stuck on your computer staring back at you an only you. The word deserves your opinion, trust me.&lt;/p&gt;

&lt;p&gt;You need to push it out into the world with a click of your fingers! While you stress out on what the world will think of your post, do you really want to think about how hosting/ssl-certs/domain-names/database-configurations works? No!&lt;/p&gt;

&lt;p&gt;But hey, we're using static files now (&amp;lt;1MB in size), not some behemoth database! No database means no funky configuration. With static files, shouldn't there simply be a way to upload my files and get a URL link?&lt;/p&gt;

&lt;p&gt;It's 2018, what do we have out there?&lt;/p&gt;

&lt;p&gt;I'm going to show you the &lt;a href="https://zeit.co/now"&gt;Zeit Now&lt;/a&gt; way for its Zen-like simplicity. Alternatively, skip ahead for Plan B - P2P hosting!&lt;/p&gt;

&lt;h3&gt;
  
  
  Plan A - Zeit Now
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://zeit.co/download#now-cli"&gt;Install now-cli&lt;/a&gt; with npm in your terminal as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to the top-level directory of the blog and type this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    now _site
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Type 'y' for yes to confirm. It should take a second or three depending on how big your files are, and you'll be given a url to your blog! Something that looks like &lt;code&gt;https://site-abcdefghij.now.sh&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Of course, you might like a nicer url, in which case you can set up an &lt;a href="https://zeit.co/docs/features/aliases"&gt;alias&lt;/a&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    now alias https://site-abcdefghij.now.sh https://example.now.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's easy static hosting on Zeit Now in a nutshell. You can even alias it to your own &lt;a href="https://zeit.co/docs/features/aliases#custom-domains"&gt;custom domain&lt;/a&gt; if you've got the cash. I'll also give a shout out to &lt;a href="https://app.netlify.com/drop"&gt;Netlify Drop&lt;/a&gt; as an alternative hosting provider, just zip up your &lt;code&gt;_site&lt;/code&gt; folder and  drag-and-drop it to the website!&lt;/p&gt;

&lt;p&gt;Congrats, you've made it! Read on though if you'd like to know another way ;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Plan B - P2P Dat
&lt;/h3&gt;

&lt;p&gt;Credits to &lt;a href="https://beakerbrowser.com/docs/guides/publish-a-peer-to-peer-website"&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/datproject/dat"&gt;Install dat&lt;/a&gt; with npm in your terminal as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; dat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now go to the top-level directory of the blog and type this to share the files in your &lt;code&gt;_site&lt;/code&gt; folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    dat _site
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It should take a second or three depending on how big your files are, and you'll be given a url to your blog! Something that looks like &lt;code&gt;dat://abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz12&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Wait, what's &lt;code&gt;dat://&lt;/code&gt;? That's the P2P protocol part, you need a special browser like &lt;a href="https://beakerbrowser.com"&gt;BeakerBrowser&lt;/a&gt; to open it. That may be okay for you, or you might prefer a standard &lt;code&gt;https://&lt;/code&gt; url.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="https://hashbase.io"&gt;hashbase&lt;/a&gt;. Hashbase wraps around your dat and gives a nicer url like &lt;code&gt;https://example.hashbase.io&lt;/code&gt;. For example, you can also access the Beaker Browser website at &lt;a href="https://beakerbrowser-com.hashbase.io"&gt;https://beakerbrowser-com.hashbase.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Hashbase acts as a super peer that hosts your files so you don't have to leave your computer switched on... So sign up for it, or be a host yourself by forking their &lt;a href="https://github.com/beakerbrowser/hashbase"&gt;Github repo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I've always wanted to go the self-hosting route, and this is probably the closest I've gotten so far. Maybe &lt;em&gt;someday&lt;/em&gt; I'll get a raspberry pi mini-server set up, but this will do for now.&lt;/p&gt;

&lt;h2&gt;
  
  
  Caveat lector
&lt;/h2&gt;

&lt;p&gt;I can't predict what will happen to the future. Like I've mentioned in the beginning, I've blogged on and off for ten years or so. What seems like a good idea back then isn't quite so now. There is an element of hindsight bias in this post you need to be aware of.&lt;/p&gt;

&lt;p&gt;This $0 plain text -&amp;gt; hypertext converter -&amp;gt; publishing/hosting pipeline assumes the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;That plain text editors will continue to exist (and can open my markdown files). Maybe UTF-8 won't be valid anymore? Perhaps my favourite Atom editor will become obsolete?!!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That I'll be able to convert markdown to html in the future. Will Eleventy still work in ten years time? What will I do if pandoc goes away too?!!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That the hosting services I use and recommend now will remain free. What if Zeit Now/Github Pages/Netlify/Hashbase starts charging for use? Can the dat protocol actually continue into the future?!!&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The enlightened ones may notice a potential Plan C baked into each step. Can't I edit plain text with any editor? Why, isn't it possible to convert markdown to html with some Python scripting? Surely there will be another hosting provider that will do it for free?&lt;/p&gt;

&lt;p&gt;Let me point out though, that the weakest link in the picture might be yourself.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You are version controlling your blog posts right?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Git is awesome, I didn't mention it in the guide above but it's there in the background, silently making sure my history is intact.&lt;/p&gt;

&lt;p&gt;There are also little details I left out from this guide such as navigation links, making an archive page, etc. So for good measure, all my static blog templates are hosted on Github &lt;a href="https://github.com/weiji14/letsjustwander"&gt;here&lt;/a&gt;. It is as ridiculously barebones as I can make it, and you're free to copy or build off the design.&lt;/p&gt;

&lt;p&gt;Sure, there are definitely cons with using this free static blog system. Some people don't think second level domain names are professional (but I can live with that). It also takes some extra effort to get interactive stuff on the page like video embeds.&lt;/p&gt;

&lt;p&gt;But hey, there's no javascript being served! That means there's no popup ads (can be a good or bad thing). My site also loads &lt;a href="https://testmysite.io/5be0e11dfdd72a0d10c43e7a/letsjustwander.now.sh"&gt;blazingly fast&lt;/a&gt; in milliseconds.&lt;/p&gt;

&lt;p&gt;The thing that bugs me most is having all my hard work disappear from the web in a few months or years, and having to migrate to somewhere else, usually during some inconvenient time. This portable design aims to make that eventual migration as painless as possible.&lt;/p&gt;

&lt;p&gt;For now, this is probably the best I can come up with.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Hello World'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; index.md  &lt;span class="c"&gt;#write&lt;/span&gt;
    eleventy                       &lt;span class="c"&gt;#convert&lt;/span&gt;
    now _site                      &lt;span class="c"&gt;#publish&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you have it, a free static blog guide for 2018 and beyond.&lt;/p&gt;

</description>
      <category>blogging</category>
      <category>free</category>
      <category>staticsitegenerator</category>
    </item>
    <item>
      <title>Developing behaviours by starting with why</title>
      <dc:creator>Wei Ji</dc:creator>
      <pubDate>Fri, 02 Nov 2018 00:40:14 +0000</pubDate>
      <link>https://dev.to/weiji14/developing-behaviours-by-starting-with-why-4n78</link>
      <guid>https://dev.to/weiji14/developing-behaviours-by-starting-with-why-4n78</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally posted at &lt;a href="https://letsjustwander.now.sh/developing-behaviours-by-starting-with-why/"&gt;letsjustwander.now.sh&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In order to warn everyone about catastrophic sea level rise,&lt;br&gt;
As a scientist,&lt;br&gt;
I want to openly share a better map of what lies below Antarctica.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So I've been rambling on in my last few posts in a Zen/&lt;a href="https://en.wikipedia.org/wiki/Chan_Buddhism"&gt;Chan&lt;/a&gt;-like trance, on &lt;strong&gt;suddenness&lt;/strong&gt;. Indeed, people really &lt;a href="https://letsjustwander.now.sh/three-box-carts-in-one"&gt;shouldn't take it a step at a time&lt;/a&gt;, because &lt;a href="https://letsjustwander.now.sh/throw-it-into-the-trash-icon"&gt;it's all in the mind&lt;/a&gt; and there are &lt;a href="https://letsjustwander.now.sh/time-as-a-whole-instead-of-sequentially"&gt;better ways to look at things&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Yet Chan is not just about emptiness, it is also about &lt;strong&gt;balance&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So today we'll take a step back, looking at the individual steps you can take to reach the holy grail.&lt;/p&gt;

&lt;p&gt;Note that this is the culmination of the things I've been going through in the past two weeks or so. There is a saying that doing a PhD is like running your own little company. A PhD student is like the founder nurturing the initial spark of an idea, the worker who turns it into a tangible thing, and also the salesperson selling the benefits to humankind.&lt;/p&gt;

&lt;p&gt;Let's first start with the biggest question - Why?&lt;/p&gt;

&lt;h2&gt;
  
  
  Why why why
&lt;/h2&gt;

&lt;p&gt;Go watch this great video on the &lt;a href="https://www.ted.com/talks/simon_sinek_how_great_leaders_inspire_action"&gt;Golden circle&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=qp0HIF3SfI4"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qVQ2fbcF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://img.youtube.com/vi/qp0HIF3SfI4/0.jpg" alt="IMAGE ALT TEXT" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the video, Simon Sinek tells us to start with the "Why?" It is a compelling argument, driven not by psychology he says, but biology. Starting with "Why" taps into the limbic part of the brain, and is said to overcome our modern neocortex.&lt;/p&gt;

&lt;p&gt;It is not just a business thing though, I went to a workshop on producing an effective PhD thesis two weeks ago. In it, one of the points made was to put all the good bits in the beginning of the sentence, at the start of the abstract, the first few chapters of your thesis! Don't leave all the juicy parts to the end of the text, people want to know &lt;strong&gt;why&lt;/strong&gt; your work is original.&lt;/p&gt;

&lt;p&gt;It is almost a running joke in academia that you just need to skim the abstract and conclusions of a paper to get at the core idea being put forward. Really though, you don't want to lose a reader by putting all your effort in the conclusion and writing your abstract at the last minute. Capture the audience, put your best foot forward - in the beginning!&lt;/p&gt;

&lt;p&gt;Besides business and writing, you also apply this line of thought to other fields! In the personal finance world I sometimes blog about, you are often told to come up with a goal first. Yes, set a goal before coming up with a budget or finding a financial advisor!&lt;/p&gt;

&lt;p&gt;Not just any goal though, you need to think hard about &lt;strong&gt;Why&lt;/strong&gt; you want to reach that goal. The &lt;strong&gt;How&lt;/strong&gt; you do it is simply maths and grit, and the &lt;strong&gt;What&lt;/strong&gt; is the reason behind the dopamine rush when you reach that goal.&lt;/p&gt;

&lt;p&gt;Did you know that there's even a formalized way to write it out? I discovered this as I started creating unit tests and fell down a rabbit hole to...&lt;/p&gt;

&lt;h2&gt;
  
  
  How - With a language called Gherkin
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Pickled_cucumber#Gherkin"&gt;Gherkin&lt;/a&gt; - a pickled cucumber. It is typically used for getting people on the same page. Well, the &lt;a href="https://en.wikipedia.org/wiki/Cucumber_(software)#Gherkin_language"&gt;Gherkin language&lt;/a&gt; rather, not the cucumber.&lt;/p&gt;

&lt;p&gt;As a domain specific language (&lt;a href="https://docs.cucumber.io/gherkin/reference/#spoken-languages"&gt;translated to over 70 languages&lt;/a&gt;), Gherkin is used for writing behaviour scenarios in '.feature' files with an intuitive syntax. These '.feature' files are codified templates that can be understood by non-technical people, and used by technical people to guide their coding in &lt;a href="https://en.wikipedia.org/wiki/Behavior-driven_development"&gt;Behaviour-driven development&lt;/a&gt;. See also &lt;a href="https://automationpanda.com/2017/01/25/bdd-101-introducing-bdd/"&gt;BDD101&lt;/a&gt;(Python-orientated).&lt;/p&gt;

&lt;p&gt;This is an example I came up with this morning for my current project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gherkin"&gt;&lt;code&gt;    &lt;span class="c"&gt;# language: en&lt;/span&gt;
    &lt;span class="kd"&gt;Feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; High Resolution Bed Elevation Model of Antarctica
      In order to have a better map of Antarctica's bed
      As a glaciologist,
      We want a model that learns from many open datasets  

      &lt;span class="kn"&gt;Scenario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; See high resolution bed
        &lt;span class="nf"&gt;Given &lt;/span&gt;low and high resolution images of a bed
         &lt;span class="nf"&gt;When &lt;/span&gt;the user selects some view of Antarctica
         &lt;span class="nf"&gt;Then &lt;/span&gt;a high resolution bed elevation map is returned
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The brilliant thing about this feature file is that it is high-level &lt;strong&gt;and&lt;/strong&gt; spells out what needs to be done!&lt;/p&gt;

&lt;p&gt;The 'Feature:' is basically the title. Under it is context. You will see that I've used something akin to the Golden Circle by starting with the &lt;strong&gt;Why&lt;/strong&gt;. Unlike the Golden Circle though, I put in the &lt;strong&gt;Who&lt;/strong&gt; next, a hint at the importance of user-centric design. Finally the &lt;strong&gt;What&lt;/strong&gt; is spelt out, which is either a model, an app, a fancy function, or ... you get the idea.&lt;/p&gt;

&lt;p&gt;The 'Scenario:' lays out &lt;strong&gt;How&lt;/strong&gt; the feature works. Under it is a Given-When-Then statement, a form of &lt;a href="https://en.wikipedia.org/wiki/Specification_by_example"&gt;Specification by example&lt;/a&gt;. One way I think of it is as an input-processing-output pipeline. &lt;em&gt;Given&lt;/em&gt; some body of data or knowledge, &lt;em&gt;When&lt;/em&gt; you are faced with something (the app has to act on this), &lt;em&gt;Then&lt;/em&gt; an output is returned.&lt;/p&gt;

&lt;p&gt;Take this as an opinionated starting template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gherkin"&gt;&lt;code&gt;    &lt;span class="c"&gt;# language: en&lt;/span&gt;
    &lt;span class="kd"&gt;Feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &amp;lt;title&amp;gt;
      In order to ... &amp;lt;Why&amp;gt;
      As a ... &amp;lt;Who&amp;gt;
      I/We want ... &amp;lt;What&amp;gt;

      &lt;span class="kn"&gt;Scenario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &amp;lt;example&amp;gt;
        &lt;span class="nf"&gt;Given &lt;/span&gt;... &lt;span class="nv"&gt;&amp;lt;input&amp;gt;&lt;/span&gt;
         &lt;span class="nf"&gt;When &lt;/span&gt;... &lt;span class="nv"&gt;&amp;lt;something happens&amp;gt;&lt;/span&gt;
         &lt;span class="nf"&gt;Then &lt;/span&gt;... &lt;span class="nv"&gt;&amp;lt;output&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want more examples, I find that the Python &lt;a href="https://behave.readthedocs.io/en/latest/tutorial.html#feature-files"&gt;behave tutorial&lt;/a&gt; is one of the funnier ones, with ninjas! It goes to show how people can use this in so many different ways besides its original use in Behavioural-Driven Development. Why not make a few cards for a new habit you want to take up?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight gherkin"&gt;&lt;code&gt;    &lt;span class="c"&gt;# language: en&lt;/span&gt;
    &lt;span class="kd"&gt;Feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; Healthy Eating
      In order to live longer
      As a healthy person,
      I want to eat a balanced diet

      &lt;span class="kn"&gt;Scenario&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; Eating fruit
        &lt;span class="nf"&gt;Given &lt;/span&gt;a fruit bowl full of juicy fruit
         &lt;span class="nf"&gt;When &lt;/span&gt;the healthy person hasn't been any fruit eaten today
         &lt;span class="nf"&gt;Then &lt;/span&gt;there should be less fruit in the fruit bowl
          &lt;span class="nf"&gt;And &lt;/span&gt;some fruit in the healthy person's tummy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alright, I am sort of (ab)using gherkin for purposes it wasn't designed for, and maybe breaking some standards to boot! Go and read &lt;a href="https://automationpanda.com/2017/01/30/bdd-101-writing-good-gherkin/"&gt;how to write good gherkin&lt;/a&gt; with proper grammar (e.g. the link recommends writing in third person instead of first person). Or maybe follow some &lt;a href="https://automationpanda.com/2017/01/27/bdd-101-gherkin-by-example/"&gt;good gherkin examples&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We've now ran through a method of formally writing down something we want to do using Gherkin language. So now what?&lt;/p&gt;

&lt;p&gt;Did I hear "what's in it for &lt;strong&gt;me&lt;/strong&gt;" you say?&lt;/p&gt;

&lt;h2&gt;
  
  
  What's in it for me
&lt;/h2&gt;

&lt;p&gt;It's easy to for anyone to argue on how to do things (implementation). But it is much harder to argue about the why (principles).&lt;/p&gt;

&lt;p&gt;By starting with the core &lt;strong&gt;Why&lt;/strong&gt;, you deliberately make things as vulnerable/awkward as you possible could. If it's a strong why, it stays. If it's not good, people realize it immediately and you can correct the most fundamental problem before it's buried in layers and layers of subjective matter.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Why&lt;/strong&gt; should be made as clear as possible. Over time, different people will have different interpretations on &lt;strong&gt;What&lt;/strong&gt; it means and &lt;strong&gt;How&lt;/strong&gt; we can use the message laid out by the why. The use cases will change, technology will change, but a good &lt;strong&gt;Why&lt;/strong&gt; should withstand the test of time.&lt;/p&gt;

&lt;p&gt;For example, I went to a workshop on managing documents and data last Wednesday.&lt;/p&gt;

&lt;p&gt;They started off with the &lt;strong&gt;Why&lt;/strong&gt; of backing up - so that you don't lose your work in the event of some unexpected event like an earthquake. This is something I've covered in my &lt;a href="https://letsjustwander.now.sh/geographical-diversification"&gt;geographical diversification&lt;/a&gt; post.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;How&lt;/strong&gt; is the implementation. Here already, we differ on opinion. The workshop people recommended a particular cloud storage provider that is quite 'reliable', whereas I prefer something like git which is not tied to a provider.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;What&lt;/strong&gt; is the benefits of using a proper backup solution, things like peace of mind, ensuring your work lives on, etc etc.&lt;/p&gt;

&lt;p&gt;As I write this paragraph, the place where I publish my work (Github) is experiencing some &lt;a href="https://status.github.com/messages/2018-10-22"&gt;login issues&lt;/a&gt; and people are fretting out about potential data loss. Yes it's annoying but I'm not too fussed because I've got my continuity plans in place. With two local copies of my work, I am able sync it to any other git provider if necessary due to git's &lt;a href="https://en.wikipedia.org/wiki/Fungibility"&gt;fungible&lt;/a&gt; nature.&lt;/p&gt;

&lt;p&gt;If I used what the people at the university recommended, and that provider were to fail, or if I graduate and get kicked out of the university system... Yes I might still have my two local copies, but I'd have lost my version control, and it would take lots of time and effort to find another backup provider that does the trick. During that time, who knows what might happen to your personal computer?! With fungible git, I can simply add a new remote and push it up in a minute like nothing has happened.&lt;/p&gt;

&lt;p&gt;By starting with the "&lt;strong&gt;Why&lt;/strong&gt;", you get to know the fundamental reason. "How" things are done can change, "Who" your users are can change, "What" they think about your idea/product can change, but if you have a compelling "Why", those differences won't matter.&lt;/p&gt;

&lt;p&gt;Maybe ten years down the road, there will be an even better solution, a better &lt;strong&gt;How&lt;/strong&gt; to do things. Yet the &lt;strong&gt;Why&lt;/strong&gt; of having a peace of mind with backups won't really change. It might even be the case that &lt;strong&gt;What&lt;/strong&gt; the new solution offers is even more comprehensive, more foolproof, something that would seem like magic to us today.&lt;/p&gt;

&lt;p&gt;So who stands to benefit from this? Is this just some propaganda to change all of our language into a strict monotonous template of Gherkin-like syntax?&lt;/p&gt;

&lt;h2&gt;
  
  
  Who cares
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Hackers
&lt;/h3&gt;

&lt;p&gt;I'll be honest with you, I'm a guy who likes a good howto article that gets into the nuts and bolts. A blog post might have a &lt;strong&gt;How&lt;/strong&gt;-What-Why structure and I won't bat an eye. Like, just tell me how it works already!! Perhaps the developers and engineers reading this will feel the same.&lt;/p&gt;

&lt;p&gt;You could be a great engineer, or developer, or some hacker that brings a vision to life. There is however, a possibility of over-engineering something. You could go from bug-driven development to test-driven development to behavioural-driven development, and so on, but was all of that necessary? Could you have designed something much more simpler and easier to maintain that &lt;a href="https://letsjustwander.now.sh/climbing-the-pareto-curve"&gt;covers 80% of the use cases&lt;/a&gt;?&lt;/p&gt;

&lt;h3&gt;
  
  
  Testers
&lt;/h3&gt;

&lt;p&gt;Strangely enough, the Gherkin syntax was borne from Behaviour Driven Development (BDD), itself an extension of Test Driven Development (TDD). Testers are akin to users, they are effectively the ones using the product, discovering &lt;strong&gt;What&lt;/strong&gt; it does.&lt;/p&gt;

&lt;p&gt;You could be so user-centric, focused on your customer, at the expense of losing your sanity. Sure, the customer is always right, but that doesn't mean the customer can call all the shots and break the law to get what they want! I've worked in the service industry, and you do realize that there are some privileged customers who can feel so entitled as to wreak havoc on your day. &lt;a href="https://letsjustwander.now.sh/from-first-world-problems-to-surviving-an-apocalypse"&gt;They might not be satisfied&lt;/a&gt; with what you offer, and you'll need to accept that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Visionaries
&lt;/h3&gt;

&lt;p&gt;Doesn't this &lt;strong&gt;Why&lt;/strong&gt;-first syntax seem like some push from business orientated folk with an agenda? Why should we believe in their vision? Sure, come up with a vision and have us all adhere to that, building your empire and using your goods.&lt;/p&gt;

&lt;p&gt;For the businessman, or teacher, or whatever inspirational leader out there. Sure, maybe it &lt;em&gt;is&lt;/em&gt; too much of an ask for you to write in (good) Gherkin. It's all too easy to send out a tweet or have a witty one-liner quote sent out, while your minions scramble to work on it. I don't know what to say really. Perhaps be careful of the ideals you are bestowing on the world, because &lt;a href="https://letsjustwander.now.sh/on-falling-down-the-optimal-rabbit-hole"&gt;taking it to the extreme&lt;/a&gt; can be dangerous.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hustle on!!!
&lt;/h3&gt;

&lt;p&gt;It's easy to specialize into your own silos, I know. Although you get some great people who can cover all three, or maybe two out of the three questions (Why-How-What) in detail, it's a rarity.&lt;/p&gt;

&lt;p&gt;As an individual, I do find it tricky to balance all three.&lt;/p&gt;

&lt;p&gt;Coming back to my PhD... Some days or weeks I would just get so engrossed in coding, implementing cool bleeding edge stuff that few people on the planet have done before. When it comes to writing, it can be scary to go deep into the "Why?" question, because it means a lot of soul searching. Further down the track, I'll need to explain myself too, what I've done over my PhD, what it means for our world!&lt;/p&gt;

&lt;p&gt;As I mentioned at the start, it's all about balance.&lt;/p&gt;

&lt;p&gt;To strike that balance, you need communication. Be it communication between your team members, or communication with the different parts of your brain that does different things, we all need to figure out how to join the dots.&lt;/p&gt;

&lt;p&gt;At the end of the day, you need to get to the same page. Start with the &lt;strong&gt;Why&lt;/strong&gt;. Hopefully you find the gherkin spec helpful in formalizing your thoughts. As for what comes next, that's up to you to discover!&lt;/p&gt;

&lt;p&gt;Get going!&lt;/p&gt;

</description>
      <category>bdd</category>
      <category>tips</category>
      <category>writing</category>
    </item>
  </channel>
</rss>
