Fix HTML5 range slider slide event

I was very annoyed, that there was no change event on the HTML5 range element. You only got an event on mouseup. So i decided to write a short fix:

$('input[type=range]').mousedown(function () {
  this.slide = true;
  this.lastValue = this.value;
}).mousemove(function () {
  // trigger only on mouse down and
  // when the value has changed
  if (this.slide && this.lastValue !== this.value) {
    this.lastValue = this.value;
    $(this).trigger('change');
  }
}).mouseup(function () {
  this.slide = false;
});

Tokenizer for Linux Shell (cut2)

About a year ago, i coded a little command line tool to tokenize data from a file or stdin and print each token as new line to stdout. Now you can use grep, sort or cut to manipulate the data further. As delimiter you can use any string you want and it will be left out in the result.

Sourcecode

After make copy the cut2 binary to /usr/bin/ and you can use it like every other command line tool.

Usage: cut2 -d DELIM [- | filename]

Have fun 🙂

update: improved code now available at github

Se up a Git server with gitosis

The instructions i used can be found at scie.nti.st.

If you use Debian or Ubuntu you can install git and gitosis like:
apt-get install git gitosis

Everything works fine but i could not check out the repo with another user because of this warning:
“git Warning: remote HEAD refers to nonexistent ref, unable to checkout”

Found the solution on stackoverlow:
just do git config push.default current at the original source and the clone/checkout works fine!

To configure git-daemon and export singel repositories, this tutorial might help!