Kaspars Dancis

blog

Jekyll hacks - HTML excerpts

Jekyll is a really cool platform for blogs, especially if you are a geek and love Github. Nevertheless it’s fairly new and has some gaps here and there.

One of the features that I really missed was a support for post excerpts so that for longer posts you could show a shorter version on the index page.

One workaround is to use Liquid templating library’s filters to strip the content:

{{ post.content | strip_html | truncatewords: 25 }} 

The downside of this is that you lose HTML tags and it’s not very convenient to control how much of the content is truncated per post.

Another alternative is to add additional attribute “excerpt” to post’s YAML Front Matter but in this case you need to duplicate some of the content.

Finally you can implement excerpt functionality as a Jekyll plugin but then you lose the convenience of the blog beeing auto-generated by Github Pages since it doesn’t support plugins.

The solution

First, mark the part of the post that you want to be truncated like this:

---
title: some post
layout: post
---

Some intro, this will be visible on the index page.

<!-- more start -->

More content, this will not be visible on the index page.

<!-- more end -->

And then use the following Liquid tag to hide the marked part on the index page:

{{ post.content | replace:'more start -->','' | replace:'<!-- more end','' }}

It simply makes the part commented out in HTML. It’s not perfect since the full content will still be included in the HTML, however it won’t be visible to your blog’s readers.

The upside is that it supports full HTML and you don’t need to duplicate any content or mess with the plugins.

10000km around Europe

People will make or break your startup

As Derek Sivers once noted, ideas are worth nothing without execution. But what’s the execution? It’s when somebody take the idea and materialize it. So it’s really about people.

Truth is that in most cases you can’t get too far alone, so you need a team. And I’m pretty sure that is the most vital factor of startup’s success.

iPhone arcade game Punchball is now open-source

Here’s a good opportunity to see Cocos2D iPhone gaming framework in action.

Punchball

Punchball is an original 2D arcade boxing game for iPhone. Technically the two most interesting features are a bit unconventional physics simulation, leveraging Chimpunk engine and peer-to-peer multiplayer gaming via Bluetooth, which is simple on the surface, but in practice requires all kinds of tricks for latency compensation.

You can get Punchball sources from GitHub and compile it yourself, or install it directly from AppStore.

AppRocket 2.0.0

AppRocket is an open-source toolkit that enables live synchronization between Google App Engine datastore and MySQL database. It can be used to migrate existing MySQL-based application to AppEngine, backup/restore AppEngine data as well for building hybrid AppEngine / MySQL applications.

This AppRocket update brings a bunch of bug-fixes as well as several functional improvements. The biggest improvement is the new multi-threaded engine which enables processing of different entity kinds in parallel. This provides a significant performance boost when your application contains more than one actively updated entity kind.

There are also few configuration enhancements, such as:

  • RECEIVE_EXCLUDE_FIELDS and SEND_EXCLUDE_FIELDS which allow to specify only fields that you want to exclude from replication. Earlier you can only do opposite by listing fields that should be included, which is not always very convenient
  • AFTER_SEND which allows to setup a hook function which gets triggered every time an entity is uploaded to App Engine Last but not least, this update has been extensively tested in couple live projects and appears to be stable and rock-solid.

You can get AppRocket from GitHub: https://github.com/k7d/approcket