articles tagged with github

New year, new wiki!

1 comment

Hello 2011! Who knows what this year will have in store for me. I’ve set myself a few resolutions, one of them being ‘take more notes’ (while learning, reading, coding etc.) I keep an online wiki for these things, but recently it has gotten a little stale.

So, in some spare time over Christmas I managed to move (and clean out) what was an aging, badly formatted, self-hosted MediaWiki, into something a little nicer, a GitHub wiki repository. Now I have version control goodness from Git, formatting and pages through Gollum and web hosting provided by GitHub.com.

Gollum is the real star here; it’s a Ruby/Git-powered wiki engine operating on static files in a simple folder structure. I can even run it locally (for the odd-time github goes down). With all this in place it should be easier for me to take notes than not.

January 04, 2011 18:00

Paging Keys

no comments yet, post one now

Some time ago I wrote a javascript class to implement keyboard short-cuts for paging through listings one item at a time (and across paginated pages). It was inspired by the navigation at FFFFOUND! and explained nicely by Ryan Singer of 37Signals.

Some time ago Ryan posted a link to my script on the 37Signals blog, now with over 130 watchers on github a creeping sense of responsibility has settled in. So the latest revision now has both jQuery and Prototype support and a handier configuration object, so you can further customise how your page and CSS work with the script.

var config = {
  nodeSelector:        '.hentry h2 a.entry-title',  // used to select each item on the page and place in the map (must be a link)
  prevPageSelector:    '.prev_page',                // link on this element should always jump to prev page a.prev_page (must be a link)
  nextPageSelector:    '.next_page',                // link on this element should always jump to next page a.next_page (must be a link)
  pagingNavId:         'paging-nav',                // dom id of the floating page navigation element
  keyNext:             'j',                         // hot keys used 
  keyPrev:             'k',
  keyNextPage:         'h',
  keyPrevPage:         'l',
  keyRefresh:          'r',
  additionalBodyClass: 'paging-keys',               // this class is assigned to the page body on load
  bottomAnchor:        'bottom'                     // the name of the anchor (without #) at end of page, e.g. set on last post on the page
};

I’m using the script on this site (see the overlay on the top right) and you can try it out by pressing j/k to navigate through the articles. Some things worth mentioning about the code;

  • It tries to closely follow the ’7 rules of unobtrusive javascript":http://icant.co.uk/articles/seven-rules-of-unobtrusive-javascript/
  • By default (and in the demo) it hooks to items in the HTML that formated with in the hATOM microformat
  • It also latches onto pagination links generated from the popular will_paginate gem
  • It makes use of Hotkey.js
  • Eventually this script will live inside many of the default templates in Bugle
November 18, 2009 11:14
← (k) prev | next (j) →