Skip to content

Instantly share code, notes, and snippets.

View anodynos's full-sized avatar

Angelos Pikoulas anodynos

  • Freelancer
  • London, UK
View GitHub Profile
@anodynos
anodynos / proxy-promise.js
Created March 25, 2020 14:19 — forked from KiaraGrouwstra/proxy-promise.js
using ES6 Proxy to deal with methods of Promise'd objects. not sure how useful this is yet.
// using ES6 Proxy to deal with methods of Promise'd objects. works for me in Edge though not Chrome somehow.
let handler = {
get: (target, prop) => function() {
if(target instanceof Promise) {
let args = arguments;
return target.then((o) => o[prop].apply(o, args));
} else {
let value = target[prop];
return typeof value == 'function' ? value.bind(target) : value;
}
@anodynos
anodynos / gist:88bd8cf36a58ef94a68ed1603dbfdc50
Created April 25, 2018 13:09
Alsatian test suite on express server not exiting
A bug with "alsatian@2.2.1" or our server / setup, prevents the Alsatian test runner from finishing.
Our initial idea was the express Server was not closing, a common nodejs scenario, which would prevent the tests from finishing.
But it seems it is not for sure the case, plus we can't reproduce the problem ouside our codebase - hence we can't open an issue on the Alsatian repo.
Things we've tried:
- Tried combination of above and most other tricks in [stackoverflow](https://stackoverflow.com/questions/14626636/how-do-i-shutdown-a-node-js-https-server-immediately?noredirect=1&lq=1).
- Tried manually keeping track & destroying open sockets (`server.on("connection", socket => // add to array` and `socket.on('close', => // remove from array )` and calling `socket.destroy` on remaining ones.
- Tried `setImmediate(() => this.server.emit('close'))`
@anodynos
anodynos / gist:bdb2317c51db1093a01c
Created March 1, 2015 13:05
VMwareTools-9.9.0-2304977.tar.gz on Kubuntu 14.10 (kernel 3.16.0-31)
13:02:35 anodynos : ~/temp/VMware Tools9.9/vmware-tools-distrib
$ sudo ./vmware-install.pl
[sudo] password for anodynos:
A previous installation of VMware Tools has been detected.
The previous installation was made by the tar installer (version 4).
Keeping the tar4 installer database format.
You have a version of VMware Tools installed. Continuing this install will
@anodynos
anodynos / gist:be3f8b9943b633bc3bfa
Created March 1, 2015 13:00
VMwareTools-9.9.0-2304977.tar.gz patched with vmware-tools-patches@19d5e2f68db4cdc835747102102d8661f8c670a9 on Kubuntu 14.10 (kernel 3.16.0-31)
12:56:47 anodynos : ~/temp/vmware-tools-patches
$ sudo ./untar-and-patch-and-compile.sh
[sudo] password for anodynos:
=== Patching ./VMwareTools-9.9.0-2304977.tar.gz ...
Uninstalling the tar installation of VMware Tools.
Stopping services for vmware-tools
vmware-tools stop/waiting
@anodynos
anodynos / gist:5c51b82e7589669c84cc
Created March 1, 2015 12:53
VMwareTools-9.9.2-2496486.tar.gz patched with vmware-tools-patches@19d5e2f68db4cdc835747102102d8661f8c670a9 on Kubuntu 14.10 (kernel 3.16.0-31)
12:26:54 anodynos : ~/temp/vmware-tools-patches
$ ls
CHANGELOG.md downloads patches README.md untar-and-patch.sh
CONTRIBUTING.md download-tools.sh patch-module.sh untar-all-and-patch.sh VMwareTools-9.9.2-2496486.tar.gz
download-patches.sh LICENSE patch-modules.sh untar-and-patch-and-compile.sh
12:26:55 anodynos : ~/temp/vmware-tools-patches
$ git log HEAD
commit 19d5e2f68db4cdc835747102102d8661f8c670a9
Author: Ross Smith II <ross@smithii.com>
@anodynos
anodynos / gist:830718867daf1e13fa3e
Created March 1, 2015 12:51
VMwareTools-9.9.2-2496486.tar.gz unpatched with Kubuntu 14.10 (kernel 3.16.0-31)
12:15:16 anodynos : ~/temp/vmware-tools-992/vmware-tools-distrib
$ sudo ./vmware-install.pl
[sudo] password for anodynos:
A previous installation of VMware Tools has been detected.
The previous installation was made by the tar installer (version 4).
Keeping the tar4 installer database format.
You have a version of VMware Tools installed. Continuing this install will
@anodynos
anodynos / todoUrgencyEasinessGracefulness.md
Last active October 10, 2018 20:47
@todo: "Urgency Easiness Gracefulness"

@todos: the Urgency Easiness Gracefulness scheme

In my @todo's, I (intend to) use the following scheme:

@todo (Urgency Easiness Gracefulness)

For example: @todo (3 5 7)

The larger each number, the more of Urgency, Easiness and Gracefulness this @todo has!

// See https://github.com/cujojs/when/issues/403
// Generated by CoffeeScript 1.8.0
var When, arrayItems, catchCount, esprima, expand, file, fileTxt, files, fs, i, jspath, path, readFileP, _i, _j, _len;
fs = require('fs');
When = require('when');
When.node = require('when/node');
@anodynos
anodynos / code_fences_ break_on_blank_line.litcoffee
Last active December 28, 2015 18:49
Literate coffeescript code fences break on blank line

This is a literate text for jashkenas/coffeescript#3248

cs = 1 # this is the only line of real code

Now I want some code examples, not part of the coffee code

  var js = 2;

  js = 3;
# See http://www.traitsjs.org/tutorial.html
Trait = require('traits').Trait
EnumerableTrait = Trait
# the trait requires these properties
forEach: Trait.required
# the trait provides these properties:
map: (fun) ->