Skip to content

Instantly share code, notes, and snippets.

View natalan's full-sized avatar

Andrei Zharov natalan

View GitHub Profile
@natalan
natalan / README.md
Last active August 29, 2015 14:04 — forked from kdabir/README.md

Creating a TimerTask can not get easier than this thanks to groovy.

  • import java.util.timer.* is not required as java.util is already imported.
  • the run() is implemented as closure

To Run this:

groovy https://gist.github.com/kdabir/3176945/raw/timer_example.groovy

@natalan
natalan / tiny Promise.js
Created August 7, 2012 03:20 — forked from unscriptable/tiny Promise.js
A minimalist implementation of a javascript promise
// (c) copyright unscriptable.com / John Hann
// License MIT
// For more robust promises, see https://github.com/briancavalier/when.js.
// adding support for limited promises where limited cannot resolve/reject itself
var Promise = function () {
var thens = [],
builder = function (arg){
var Constructor = function () {
this._thens = thens;