Why we need Jekyll?

Many of you should have known or have used some popular blogging platforms like Wordpress or Blogspot. They are all great platforms that have been developed for a long time and have a big community. However, they also have some disadvantages.

  • Have you ever found that Wordpress or Blogspot too complex and too difficult to backup and restore?
  • Have you ever encountered the problem when you want to display a piece of programming code in Wordpress, Blogspot,…?
  • Have you ever feel annoyed by the useless code that their WYSIWYG editors generate? And to fix them you have to edit the markup manually, which is very complicated for us to focus on the main content.
  • Have you ever noticed that they took a long time to load the pages?
  • And so on…

If you feel annoyed with these problems, it’s time for you to find another better solution.

Read more

Those little pieces of code are used to insert a Related Posts and Recent Posts column to Jekyll Bootstrap site. Just put them any where you want it to display in the post template (usually /_includes/themes/theme-name/post.html).

<h4>Related Posts</h4>
<ul>
  {% for post in site.related_posts limit:5 %}
  <li><a href="{{ BASE_PATH }}{{ post.url }}">{{ post.title }}</a></li>
  {% endfor %}
</ul>
Read more

I usually open many buffers in conkeror (50-100 buffers). Also, I have auto save mode enable so everytime I start Conkeror, it automatically loads all of those buffers. That can cause my network overloaded. Moreover, sometimes I need reload all the currently opend buffers to see all the changes. So I wrote those 2 little pieces of code to help me achieve it. Here are they:

Stop loading all buffer (key A-h)

define_key(default_global_keymap, "A-h",
          function (I)
          {
              for (var i = 0; i < I.window.buffers.count; i++)
              {
                  stop_loading(I.window.buffers.get_buffer(i));
              }
          });
Read more

Emacs is not just a simple text editor. It comes with powerful supporting packages to extend its capabilities. Emacs has the built-in package manager but you can also install packages manually by downloading, compiling and add them to the load path. However, what happen if you change to another computer or one day your computer broken and you have to freshly install it from the beginning? You will have to reinstall those packages again, and add them to the load-path manually. Here is a simple solution that will help us automate the installation process.

Load Emacs package manager and Add more source

Emacs is not a package manager, and we should load its package manager and also add more package source for it before using.
Add this to your .emacs

;;; Emacs is not a package manager, and here we load its package manager!
(require 'package)
(dolist (source '(("marmalade" . "http://marmalade-repo.org/packages/")
                  ("elpa" . "http://tromey.com/elpa/")
                  ;; TODO: Maybe, use this after emacs24 is released
                  ;; (development versions of packages)
                  ("melpa" . "http://melpa.milkbox.net/packages/")
                  ))
  (add-to-list 'package-archives source t))
(package-initialize)
Read more

This is a simple way to make yasnippet and autocomplete work together on emacs. Both of them use the Tab key to activate. Everytime you press Tab, yasnippet will run first. If there is no snippet found, autocomplete will be activated.

Download yasnippet and autocomplete and add them to the load path or just simply install them using package.el. After that, add this to your .emacs

First, activate yasnippet.

Read more

The default Jekyll Bootstrap index file contains a simple post list. However, it is really boring. It just gives you very basic information like Pulished date, Post title and the link to that post. After a little researching about the supported liquid tags in Jekyll, I came up with a new index page with the more beautiful post list, including thumbnail, post title, summary of the post, read more buttons and much more things you can add to.

Here are the implementation steps. Remember this is for Jekyll Bootstrap. That means you need Jekyll with Bootstrap to implement. If you don’t use bootstrap you can still apply those steps with a few tweaks.

Read more

Introduction

For Ubuntu Linux (and Mint), we have a powerful package manager called apt-get, which makes the installation, uninstallation and management of packages much easier. Sadly, for MacOS users, we don’t have that powerful tool. The appearance of MacPorts, an open source package manager for MacOS, has changed the way we install and manage our packages. With the help of MacPorts, MacOS users can now quickly install, keep track of the changes, update and maintain many open-source applications. You can even export all your installed packages and then let MacPorts automatically reinstall them for you when you have your computer reinstalled or when you migrate to another system.

Installation

The easiest way to install MacPorts is to download the .pkg installer here. Select the installer corresponding to your current OS. Alternatively, you can build it from source. For more detail, please visit this link.

After finishing the installation, you should consider updating MacPorts. Fortunately, MacPorts has the built-in feature for selfupdating. Everything you need to do is to execute this command

Read more

Sometimes when you run Jekyll server locally to test the preview of your site, you will encounter an error that tells you Address is already in used. The error output in the console when you run the command jekyll –server is something similar to this

[2012-12-30 00:10:58] INFO  ruby 1.9.3 (2012-11-10) [x86_64-darwin12.2.0]
[2012-12-30 00:10:58] WARN  TCPServer Error: Address already in use - bind(2)
[2012-12-30 00:10:58] WARN  TCPServer Error: Address already in use - bind(2)
Read more

The little code below helps us to quickly get tinyurl link for the currently viewed page instead of having to open tinyurl webpage, copy paste the link and get the new link. Put it in your .conkerorrc

// get tiny url for the current page
// press * q and then c to generate and copy the tinyurl into clipboard
define_browser_object_class(
    "tinyurl", "Get a tinyurl for the current page",
    function (I, prompt) {
        check_buffer(I.buffer, content_buffer);
        let createurl = 'http://tinyurl.com/api-create.php?url=' +
            encodeURIComponent(
                load_spec_uri_string(
                    load_spec(I.buffer.top_frame)));
        try {
            var content = yield send_http_request(
                load_spec({uri: createurl}));
            yield co_return(content.responseText);
        } catch (e) { }
    });
define_key(content_buffer_normal_keymap, "* q", "browser-object-tinyurl");
Read more

Introduction to Bitlbee

Quote from Bitlbee homepage

BitlBee brings IM (instant messaging) to IRC clients. It’s a great solution for people who have an IRC client running all the time and don’t want to run an additional MSN/AIM/whatever client.
BitlBee currently supports the following IM networks/protocols: XMPP/Jabber (including Google Talk), MSN Messenger, Yahoo! Messenger, AIM and ICQ, and the Twitter microblogging network (plus all other Twitter API compatible services like identi.ca and status.net).

In short, Bitlbee is an IRC server where you can connect to and use it with your IRC clients to connect to other chat services like Yahoo, FB, Gtalk,…

Bitlbee Homepage: http://www.bitlbee.org/

Read more