The JavaScript blog.


animation gif reactive

Gifffer, Composing Discrete Events with RxJS

Posted on .


Gifffer (GitHub: krasimir / gifffer, License: MIT) by Krasimir Tsonev is a small library for adding a play control to animated gifs. It works by drawing a play button over the image, and dynamically inserting an image element when play is clicked. To prevent the gif from playing when the page loads, the data-gifffer attribute is used instead of the src attribute.

Krasimir has a blog with gifs that illustrate browser features, so he wanted to be able to handle playing gifs more elegantly than the default behaviour. Here's an example: Gifffer example. You can click it to toggle playback.

Composing Discrete Events with RxJS

Composing Discrete Events with RxJS by Sergey Bolshchikov is a post that compares addEventListener with RxJS. If you've ever used Reactive Extensions then you should be at home with the use of selectMany, combineLatest, and so on.

Here's the full example:

var mouseDowns = Rx.Observable.fromEvent(document, 'mousedown');  
var mouseMoves = Rx.Observable.fromEvent(document, 'mousemove');  
var mouseUps = Rx.Observable.fromEvent(document, 'mouseup');

var moves = mouseDowns.selectMany(function(md) {  
  var start = {
    x: md.clientX,
    y: md.clientY
  return mouseMoves.combineLatest(mouseUps, function(mm, mu) {
    var stop = {
      x: mu.clientX,
      y: mu.clientY
    return {
      start: start,
      stop: stop

moves.subscribe(function(res) {  
  var body = document.querySelector('body');
  body.innerHTML = 'Start: x = ' + res.start.x + ', y = ' + res.start.y + '; Stop: x = ' + res.stop.x + ', y = ' + res.stop.y;


node modules security vnc gif

Node Roundup: 0.10.8, msfnode, vnc-over-gif

Posted on .

You can send in your Node projects for review through our contact form.

Node 0.10.8

Node 0.10.8 was released last week. v8, uv, and npm were all upgraded, and there are fixes and improvements to be found in the http, buffer, and crypto modules. This is the third stable release so far in May.



msfnode (GitHub: eviltik / msfnode, License: GPL 3, npm: msfnode) by Michel Soisson is a Metasploit API client for Node. Metasploit is a hugely popular penetration testing framework. This module allows you to use Node to script Metasploit. The Metasploit API supports things like managing jobs, loading plugins, and interacting with open sessions to compromised systems.

The module provides a metasploitClient constructor, which can be passed an object that contains the Metasploit server's details, including login and password. The client is event-based, and the project's readme has an example of how to get a login token and make a request against a server.


Andrey Sidorov sent in vnc-over-gif (GitHub: sidorares / vnc-over-gif, License: MIT, npm: vnc-over-gif), a VNC viewer that uses animated gifs as the data transport. It currently has no client-side JavaScript, so it acts purely as a means of viewing a VNC session. The author is interested in expanding it further with an Ajax-based UI. There's a good background to the project in the vnc-over-gif FAQ.

Although it isn't interactive, it's a great hack -- the code is currently only around 50 lines, which Andrey claims only took 30 minutes to write.