Skip to content

Instantly share code, notes, and snippets.

@NicolasZanotti
NicolasZanotti / random-assignment.test.ts
Created December 3, 2021 13:37
A script to assign people to each other at random
import randomlyAssignPeopleToEachOther, { filterExclusions, filterOwnName, filterSelections, orderByPossibleSelections } from "./random-assignment.ts";
const describe = (name:string, fn:Function) => console.log(`${name}:`) + fn();
const test = (name:string, fn:Function) => console.log(`\t• ${name}:`, fn());
describe(
'Filtering data of type Person.',
() => {
test(
'It does not select the same person as giver and receiver.',
/**
* Function for generating ESR-numbers for orange swiss payment slips (so called "Oranger Einzahlungsschein").
*
* @author Jason Rubichi, Nicolas Zanotti
* @param
* bc: fix, 01 or 04
* chf: dynamic, amount in chf without rappen, must have eight chars minimum (if less than eight chars, insert zeros before)
* rappen: dynamic, amount in rappen
* help1, help2, help3: fix, "+" or ">", no editing required
* referenceNumber: dynamic, contains matag number, zeros, client number and job number
(function(GYG) {
"use strict";
function EventTracker() {
this.config = {
_server : 'http://pony1:9001/'
};
}
/**
@NicolasZanotti
NicolasZanotti / client.js
Created May 8, 2013 16:43
This is a test for running InDesign as a simple socket server. It can be connected to using Node. Both pass messages back and forth before Node closes the connection. Run the server.jsx file using the ExtendScript Toolkit (included with Adobe Creative Suite). Then run the client.js using Node.
var net = require('net');
var client = net.connect({port: 8000}, function() {
console.log('Client connected.');
client.write('Hello from Node!');
});
client.on('data', function(data) {
console.log(data.toString());
client.end();
@NicolasZanotti
NicolasZanotti / main.js
Created January 10, 2012 16:41
Render HTML content to a PDF file with wkhtmltopdf and Node.js
var http = require('http');
var sys = require('sys');
var exec = require('child_process').exec;
var util = require('util');
var fs = require('fs');
http.createServer(function(request, response) {
var dummyContent = '<!doctype html><html><head><title>Test</title><meta charset="utf-8"></head><body><p>Hello world!</p></body></html>';
var htmlFileName = "page.html", pdfFileName = "page.pdf";