Evolving Bits

Thu Jul 31 2014

CascadiaJS 2014

CascadiaJS 2014 kicked off today in Portland.

Everything ran smoothly, even in 89 degree weather!

Videos are starting to become available on YouTube with new ones being announced on Twitter.

Presentations

My favorite presentations today were:

I also enjoyed these presentations:


Sun Mar 09 2014

Bitesize Blogging via Node.js

Over the last couple of weeks, I rebuilt my blog so that I could:

  • keep my content in a repository all by itself, in a simple markdown format.

  • support a responsive design based on a popular framework rather than create custom themes based on the blog framework.

  • generate the website on the fly from the markdown files, and not from a "static website generator" nor a database.

It's intentionally built on small and specific node.js modules with the idea that others can take those components and roll their own blog as well. Some components I built myself, and others are existing ones from the node community.

The primary configuration and blog content are in their own Git repository, written in Markdown with YAML Front-Matter (yfm). The blog itself is in another Git repository -- it's largely data driven from the config file.

This borrows from Octopress and Hexo (having a config and yfm content), but differs in that mine is split into two separate repositories -- content is separate from the blog code and design itself.

Also, Octopress and Hexo are static site generators. Mine grabs all content from the Git repo and caches that. This allows me to contribute content to my site without having to rebuild it manually each time and push the built version.

Why another blog solution?

I'm a big fan of the Jekyll-based static blog sites, namely writing markdown files and saving in GitHub.

I enjoyed Octopress, and started porting to Hexo, but I really just want to have my content in a repo that is separate from the blog code and design itself. I also wanted to use presentation libraries directly like Zurb's Foundation, rather than learn a specific theme framework for the static generator.

This has led to developing the bitesize JavaScript library, which won't generate a static site, but will source the blog markdown content from a GitHub repo.

If you're interested in creating your own custom blog, the full source is at https://github.com/briangershon/bitesizeblog and if you want to see how the content is formatted, see https://github.com/briangershon/blog.evolvingbits.com


Sat Sep 28 2013

Testing Parse.com Cloud Code using Q Promises

I've been playing with Parse.com Cloud Code, and wanted to write more code offline so I didn't have to keep pushing to the cloud, plus wanted to use Test Driven Development.

I also had seen their blog post What’s so great about JavaScript Promises? and decided that was the best way to go for handling async logic.

For testing and mocking, I discovered the Q promise library which is fantastic. For a great intro listen to the 037 JSJ Promises with Domenic Denicola and Kris Kowal podcast and see Q Getting Started and Tutorial.

The problem I ran into was that the Parse.com promise library handles error-handling differently than the Promises/A+ spec (instead it follows jQuery's implementation) so then started trying to create a mock of a Parse.com promise, but this was a bit tricky and I wasn't happy with result.

Then I finally had the thought to replace the Parse.com promise implementation with Q. That way I could implement my Cloud Code with Q and also write my tests with Q.

Here's an initial experiment of using Q with Parse.com Cloud Code.

How to run: I just created a new Cloud Code project with the Parse command-line tool parse new and then grabbed q.js via an npm install q and copied q.js into the ./cloud directory.

{% gist 6747919 %}

Here's the code on gist.github.com