Skip to content

Instantly share code, notes, and snippets.

@jsommr
jsommr / machine.js
Created July 26, 2020 16:35
Generated by XState Viz: https://xstate.js.org/viz
const invoicePaymentStatusMachine = Machine({
id: 'invoice_payment_status',
initial: 'open',
states: {
open: {
on: {
PAY: 'paid',
CANCEL: 'cancelled',
UNCOLLECTIBLE: 'uncollectible'
}
using System.Linq;
using Nustache.Core;
static ILookup<string, string> GetMetadata(string templateContent) {
// All metadata are written as {{! key: value }}. {{! ... }} is a comment in Mustache.
// This function uses the possibility to alter start and end delimiters to scan for {{! }}
// instead of {{ }}. With {{! as start delimiter, {{!! becomes a comment. I don't think
// you need comments in this case, but I think this is a neat way to include metadata in
// the templates.
return new Scanner("{{!", "}}")
@jsommr
jsommr / printserver.js
Created March 11, 2016 16:21
Node Label Print Server for WASP WPL305
import Rx from "rx"
import Printer from "zuzel-printer"
import mysql from "mysql"
main()
function main () {
let printer = new Printer("labels")
let db = mysql.createConnection({
host : "abc",