I’ve written another article for JSPro.com, this time on event delegation with jQuery. You can read it here: http://jspro.com/jquery/event-delegation-with-jquery/
Bower Article on JSPro.com
I’ve had an article published on JSPro.com, SitePoint’s new site for all things JavaScript. My article is on Bower, the browser package manager, and covers installing it, using it to install, update, and delete packages, and how you can publish your own packages.
You can read it here: Package Management for the Browser with Bower.
Using Dropbox as a Git Remote
If you’re working on a pet project and aren’t quite ready to share it with the world via GitHub, here’s a handy way you can backup your work to the cloud using Dropbox as a git remote:
- Create a new, empty folder in your Dropbox to house your project’s remote:
1
| |
- Initialise a bare git repository in this newly created folder:
1
| |
NB A bare repository in Git is one that only contains the revision info and system files (the files you’d normally find in the hidden .git directory), and doesn’t contain the working tree. From Git version 1.7.0 and onwards, a repository has to be a bare repository in order to accept a push, so we must create our Dropbox remote as a bare repository.
- Add our new remote to our project:
1
| |
- Push our work to our
dropboxremote:
1
| |
You can then interact with your Dropbox remote the same way you would with any other.
Node-encdec
A while back I wrote a gist for base58 encoding / decoding in Python, then ported it to JavaScript. The other day I thought it would be good fun to convert the JavaScript version to a npm module so it can run on Node.js, and here’s the result: https://npmjs.org/package/encdec
It’s essentially the same as the original version. The only real difference is the unit tests are now in nodeunit instead of QUnit.
You can install node-encdec via npm:
npm install node-encdec
# or to install globally
npm install -g node-encdec
Smoke on the Mindstorms
I’ve been having some fun with nxt-python recently, a programming library for Lego Mindstorms. One of the examples lets you play the tune Mary Had A Little Lamb via the Mindstorms brick. I thought I could do one better and made my son’s Mindstorms play Smoke on the Water:
Terminal or Shell Command to Shutdown or Reboot Ubuntu Linux
Pretty simple when you know how:
http://theos.in/howto/howto-shutdown-reboot-ubuntu-linux-command/
Python - Tomorrow’s Weather Script
Here’s a little script that outputs tomorrow’s weather forecast, using the Yahoo Weather API:
Book Review - Sinatra: Up and Running by Alan Harris and Konstantin Haase (O’Reilly Media)
Sinatra Up and Running is a good read both for web developers who want to start building web applications with Sinatra, and for experiencedRuby developers who want to learn how Sinatra works under the covers.
The book is organised with the above in mind, making it easy to find the information you need. The first part covers the basics of Sinatra and focuses on giving you the knowledge you’ll need to start writing your own Sinatra powered web applications. Part two gets more technical, and looks at how Sinatra works under the covers, how you can write your own helpers and extensions, how Sinatra can be used as Rack middleware, and you can use it to create modular applications. The final part ties everything together and walks the reader through creating a Sinatra powered blog.
I enjoyed reading Sinatra: Up and Running. It’s well written, and full of code samples to help give you a better understanding of the concepts discussed. If you’re looking for a book on Sinatra then I’d recommend this one without hesitation.
Disclaimer: This book was reviewed as part of the O’Reilly Blogger Review program.
Remap Capslock in Windows With AutoHotkey
Probably the easiest way to remap the Capslock key in Windows is to use AutoHotkey. I have an AutoHotkey script set to run when my machine starts up that remaps Capslock to Escape. All it contains is this:
Capslock::Esc
If you want to remap Capslock to Ctrl instead, just replace Esc with Ctrl.
No registry hacking required.
Further Reading
Gitsvnscript
Since I’ve been using Git, git-svn has become my preferred way of using Subversion. To make that git svn clone command a bit easier for svn projects hosted on Google Code, I’ve created a Greasemonkey script / user script that:
- Finds the
svn checkoutcommand on the source checkout page e.g. https://code.google.com/p/bbc-radio-scrobbler/source/checkout - Appends the equivalent
git svn clonecommand, using the standard layout option-s.
The source code is available on GitHub, and you can install it directly from this link: https://github.com/ianoxley/gitsvnscript/raw/master/gitsvn.user.js