littlelogs

Keep a social journal of your work progress as you make and learn things.

#Hakyll

February 2017

rhitakorrr
rhitakorrr

Didn’t think I’d get any programming done tonight considering I spent until 11:30pm cleaning my apartment, but I wanted to try One Quick Thing™. Two hours later, I have a very solid commit on my #hakyll_portfolio_blog and more pending sleep deprivation.

I did two things in this commit:

  • Introduced implicit parameters for my config value and two other values that are passed into a lot of different functions. Cleaned up the code quite nicely.
  • Created a Context for lists of tags. #Hakyll has a built-in tag module which is convenient for getting up and running quickly and not so convenient for customizing at all. It generates the HTML to display tags for you instead of giving you a Context with values you can utilize in your templates. Seems odd that this one bit of Hakyll is hard-coded, but hey, with enough digging through types, I got the tag data into a Context.

All in all, not bad for an accidental coding session.

rhitakorrr
rhitakorrr

Tonight I filled out the author-data.yaml config file, which is basically a #yaml representation of my resume. The goal is to eventually generate both a PDF and HTML page by just changing this one file, thus always keeping my site and my PDF resume in sync and up-to-date. The PDF generation looks like it will be tricky (and involve me learning #LaTeX), but I rigged up the new config data with my #hakyll Context and can now display any of that data on a web page. That finishes the last of the necessary features for a minimal release of my #hakyll_portfolio_blog. Not sure if I’ll be able to throw together a design and style the whole site before the MMP beta ends on Tuesday, but that remains the goal.

rhitakorrr
rhitakorrr

Tonight I added tags and categories to my #hakyll_portfolio_blog with some custom behavior outside of what #Hakyll already offers. That was the easy part.

I spent the last four hours trying to get the Contexts for posts and projects to contain one another such that a post page can display any projects mentioned in the post and a project page can show a list of posts that discuss that project. The actual Contexts weren’t too hard to code (despite having to delve into the docs and fit types together), but the recursive dependencies were a nightmare. I spent at least two hours fixing just that.

In the end, I did get it all working, but I’ll save just how I did that for a full-length blog post. For now, I think the hardest parts of the wiring are done. There are more Contexts and config files to rig up, as well as an RSS feed, but I don’t think anything I have left to do will be as complicated and confusing as tonight’s features. All in all, it’s coming along.

September 2016

rhitakorrr
rhitakorrr

Somehow I got a full night of sleep last night and woke up more tired than ever this morning. Took half the day and a good amount of tea to shake that off. I do feel better than yesterday, but still not great, so I decided to take it easy again tonight. However, since I’d be remiss to take a complete night off, I added a CSS autoprefixer to the build system. Pretty neat that #hakyll has command line access through the unixFilter function. So the #hakyll_portfolio_blog should now have all the vendor prefixes it needs!

rhitakorrr
rhitakorrr

I didn’t get to post all weekend, but I haven’t been slacking. Promise! I actually got a lot done with my #hakyll_portfolio_blog.

  • Friday. Added logic to conditionally show fields based on metadata. Turns out it was tricky, but not impossible, @josh. I had to go on a type safari through #hakyll docs and source to figure it out. Since I couldn’t find any resources on doing this, I’ll write up an explanation in a blog post once my blog is done.
  • Saturday. I got the résumé JSON into a #hakyll Context and displayed in the template. I also figured out how to get #pandoc to inject values from the JSON into a #LaTeX template and render that template to PDF. All from #Haskell! Also, went to a diner for dinner.
  • Sunday. Tried to learn #LaTeX and ended up breaking my entire installation. Spent the first half of the day fixing it. Spent the rest of the day hanging out with @JorfimusPrime. Went to the diner again. I might like diners too much.
rhitakorrr
rhitakorrr

I’m writing up my log now to encourage myself to actually stop working for tonight.

Today I was told that the failed #OpenCart upgrade I attempted actually did leave behind some errors. Not too surprising. I don’t know OpenCart; I’m just that “hey, you’re good with computers, right?” guy. So, it’s kind of broken now. It looks like OpenCart has somehow managed to render a smaller version of itself inside one of its own templates. I dug through the templates and saw no trace of what was causing this, and I’m not about to blindly debug thousands of lines of #php. For now, it still works. It just looks stupid. I’ll look at it again over the weekend.

On a brighter note, I spent a good amount of time reading up on #aeson today and managed to get it to parse a JSON version of my résumé for my #hakyll_portfolio_blog. Tomorrow, I’ll try to get that data into my #hakyll template.

For now, I’m gonna make some popcorn, finish Twin Peaks, maybe read for a while, and get some much-needed sleep.

rhitakorrr
rhitakorrr

Looks like I’m starting this week by going to bed too late again. Oops.

Today I continued working on the #hakyll_portfolio_blog.

  • Added an #RSS feed. This is actually really simple in #hakyll, but I wanted the URLs in the feed formatted a certain way which complicated the process. Spent a while digging through #hakyll docs and mapping function compositions into monads to “alter” strings. Eventually, I got it working.
  • Added link to resume as well as social media links in the sidebar.
  • Sidebar now handles scrolling in a more aesthetically pleasant manner.
  • Removed banner from the home page since it looked too busy and confusing.
  • Added banner support to posts and post teasers.

I still have lots to add (Disqus, social share buttons, Google Analytics, better post formatting, etc.), but it’s coming along. Honestly, though, I’m pretty tired of #css and #design in general. I’m trying to finish this quickly so I can get back to logic programming and #writing.

rhitakorrr
rhitakorrr

Added some basic support for projects to the #hakyll_portfolio_blog tonight. Rigging it up wasn’t too bad even though I did have to dig through a lot of docs to get some cool but largely unnecessary functionality in there. It’s all learning (and #Haskell), though, which is fine by me.

Speaking of learning, I learned, after many wasted hours, that it is either tricky or impossible to get metadata out of the MonadMetadata monad in order to do a simple comparison. I wanted a Bool. All I could get was a MonadMetadata Bool. Or maybe it was a Compiler Bool. I’m not sure. All I know is I absolutely could not figure out how to extract a value from that monad.

I did post in the #hakyll Google Group to ask about it, but it seems Google Groups ate my post. Either it’s awaiting moderation (as a new member) or it’s gone forever. No idea which.

August 2016

rhitakorrr
rhitakorrr

After all of @JorfimusPrime’s talk of blogging, I got it in my head to convert my portfolio website into a portfolio website / blog. It’s seriously due for an update anyway. Spent a good portion of the day looking at Jekyll, a simple Ruby-based static blog generator which #GitHub will build for you automatically on push. But, me being me, I had to look up a #Haskell alternative. And what do you know? I found #Hakyll, which is basically a #Haskell clone of Jekyll with a bunch more configuration options. Neat.

Spoiler alert: #GitHub does not support automatic #Hakyll builds to gh-pages.

So, tonight I dug through a bunch of #Hakyll + #CircleCI build tutorials, spent several hours configuring git submodules, orphan branches, and SSH keys as well as fixing mismatched dependency versions, and finally got the first automatic build and deploy of my #hakyll_portfolio_blog working!