Tag #sweetroll

Facepalm moment: realizing that flock(2) doesn’t block across threads inside of a process, only across multiple processes, and adding an MVar lock to Gitson about a year after writing the original code.

“Why is my app saying it can’t load my templates because it’s not valid UTF-8?!??!”

It’s been reading .DS_Store. Facepalm.

Accidentally reposted something from Tantek using Monocle. Reposts aren’t supported in Sweetroll yet, so I deleted that post, but not before looking at the JSON and noticing that my parser didn’t understand the publishing date…

<span class="dt-published published dt-updated updated">
  <time class="value" datetime="05:55-0700">05:55</time> on <time class="value">2015-08-28</time>

Turns out I missed the whole “Date and time parsing” section of the value-class-pattern! Fixed.

Testing… this should work (Bridgy Publish for posting to Twitter from my website).

Also, Sweetroll now uses canonical microformats2 JSON for storage.

Ported Sweetroll, the engine that powers this website, from Scotty to servant. Oh, and it’s also built with stack on GHC 7.10 now.

My favorite thing about Haskell: how the type system helps with fundamental changes. I’ve changed the data structure from Maybe to lists in microformats2-types, and then changing microformats2-parser and sweetroll was a very quick and simple “see the type error – fix it” loop.

Webmention endpoint discovery in Haskell. Probably the best function ever written :-)

This is how I search for it in HTML.

listToMaybe $ unsafePerformIO $ runX $ htmlDoc //> hasAttrValue "rel" isWebmentionRel >>> getAttrValue "href"

Why unsafePerformIO? Because there’s no reason for HTML parsing to depend on IO, but they’ve implemented parsing strings as parsing files with the string protocol.

So, notes on my website should be automatically posted on App.net and Twitter. Also, webmentions should be sent & webfinger works.

P.S. OAuth 1.0 is awful.