You are currently browsing the archives for the release tag.

Jim, the JavaScript modal framework

Nowadays, there are a lot of Ajax and Web 2.0 JavaScript frameworks. This actually is a good thing, but I believe that a good ol' geek aspect is missing. That's why I developed Jim.

Jim is not :

  • An ajax framework
  • An animation framework

What Jim does:

  • Jim adds a command line interface to a webpage, inspired by vi
  • Jim allows easy developement of keyboard based applications

I know what you think, it sound like WTF?. Here is a simple example to help you understand. The commands are straightforward:

  • : opens the CLI
  • ESC closes the CLI
  • TAB autocompletion
  • Return to execute

If you've ever used a terminal emulator, it won't be difficult…
I've implemented 4 commands in the example:

  • echo : echo pli prints "pli"
  • eval : evaluates a javascript statement : eval "echo(1+1)"
  • set field value : sets the field field to value
  • submit : submit the pseudo form

You might ask how this is a framework, and I'd reply that it was made in such manner that it is possible to define custom commands the way you want. Here is the configuration file used in the example:

_('echo', echo);
_('eval', eval);

_('set', function(what, value) {
  $$('#'+what+' .value')[0].update(value);
},{
  suggestions: function (n, a) {
    switch (n) {
      case 1:
        return $$('.settable').pluck('id');
      case 2:
        switch (a.last())
        {
          case 'name':
            var names;
            new Ajax.Request('names.htm', {
              method: 'get',
              onSuccess: function (e) {
                names = eval(e.responseText);
              },
              asynchronous: false
            });
            return names;
          default:
            return Array();
        }
      default:
        return Array();
    }
  },
  callback: function (id, a) {
    $$('.settable').each(function(e) {
      e.down('.field').removeClassName('highlight');
    });
    if (id)
      if (a.length == 0)
       {
        $$('#'+id+'.settable')[0].down('.field').addClassName('highlight');
       }
  }
});

_('submit', function () {
  var params = {};
  var submit = true;
  $$('.settable').each(function (e) {
    var val = e.down('.value').innerHTML;
    if (val.blank())
     {
      err('Please fill in <b>all</b> fields');
      submit = false;
     }
    params[e.id] = val;
  });
  if (submit)
    new Ajax.Request('names.php', {
      parameters: params,
      onSuccess: function (e) {
        echo(e.responseText);
      }
    });
});

This is highly modular and allows almost all possible commands. I have had a few hesitations about polluting the namespace, but I add only three function echo err _, which can be renamed.

Downloaded : 123 times
File : jim-0.32.tar.gz
Size: 63 ko

Vimpress !

This is quite experimental (and unmaintained): I'm currently writing this article using the only decent text editor: Vim. That's why I wrote a plugin inspired by this one

Presentation

Vimpress is a nifty plugin for Vim which allows you to publish and edit posts on your wordpress blog.

Features
  • Get a list of all articles
  • Write a new article
  • Edit a current article
  • Save (yeah, no kidding)
  • Supports categories
  • Supports tags1

Pseudo help

Commands
  • ":BlogList"
    Lists all articles in the blog
  • ":BlogNew"
    Opens page to write new article
  • ":BlogOpen id"
    Opens the article for edition
  • ":BlogSend"
    Saves the article to the blog
  • Configuration

    Edit the "Settings" section (starts at line 51). If you wish to use UTW tags, you should install the following plugin and set "enable_tags" to 1

    Just fill in the blanks, do not modify the highlighted parts and everything should be ok.

    Downloaded : 403 times
    File : vimpress.tar.gz
    Size: 2.5 ko
    1. using this plugin []

Smart Cropper

Smart Cropper allows you to automatically crop PNG, JPEG and GIF images by targeting high contrast regions on the picture, using edge detection to do so. It allows multiple crops at the same time.

A little howto :

$ smartcropper [OPTIONS] <files>

To crop one file :

$ smartcropper foo.jpg

To crop multiple files :

$ smartcropper foo.? */bar.jpg

The option -o, --output= [mask] allows you to specify the mask used to generate the output files' names. A mask is a string which may contain the following tokens :

  • # : numbering of the cropped picture, starts at 0 (use ## to have two digits numbers, ex. 01)
  • %n : name of the original picture, without extension
  • %e : original picture's extension
  • %d : directory containing the original picture

For example, to crop all JPEG pictures which are in a sub directory of the current directory, and to export them with a name consisting of their original directory name and their number in a directory called "small", one would use :

$ smartcropper */*.jpg –output=small/%d_###.%e

The default value for the output mask is "%d/cropped_%n.%e".

One can specify the size of the output using the following option :

-s, –size= [width] x [height]

Downloaded : 88 times
File : smartcropper-0.3.tar.gz
Size: 82.7 ko

.