Skip to content

Instantly share code, notes, and snippets.

@mandolyte
mandolyte / gist:6eaa9e43f3dd45f544f2048275e2dfd3
Created December 8, 2019 12:55
De-asynchronize does not work...
$ cat read3.mjs
import csv from "fast-csv";
let expected = [
['Col1','Col2','Col3'],
['1.1','1.2','1.3'],
['2.1','2.2','2.3'],
];
let input = `Col1,Col2,Col3
1.1,1.2,1.3
@mandolyte
mandolyte / nonLatinTest.go
Created September 20, 2019 14:59
Example to produce Russian in gofpdf
package main
/*
To correctly produced in the output PDF the input string "Молоко и творог"
which is Russian, use codepage 1251; must also do the following:
- use the unicode translator method in gofpdf
- in the specifed font directory must be the following:
1. cp1251.map: the codepage mapping
2. helvetica_1251.z: font file (from the gofpdf project)
3. helvetica_1251.json: font descriptor file
@mandolyte
mandolyte / textToList-help.txt
Created January 9, 2018 14:12
The help message for the textToList.go example.
$ go run textToList.go -help
Help Message
Usage: textToList [options]
Note: font and line height are 'points', 1/72 inch
This example takes a text file of paragraphs and
demonstrates how to create a numbered list in PDF format
Blank lines are skipped!
-compressed
Don't add blank line between items
$ cat test1.xml
<Person type="alien" thumbs="yes">here is some character data<FullName>Grace R. Emlin</FullName><!-- this is not a comment... just kidding --><Company>Example Inc.<!-- this company excels --></Company></Person>
$
$ go run identityXform.go -i test1.xml -indent
<Person type="alien" thumbs="yes">here is some character data
<!-- this is not a comment... just kidding -->
<FullName>Grace R. Emlin</FullName>
<Company>Example Inc.
<!-- this company excels --></Company>
</Person>
$ cat identityxform.go
package main
import (
"encoding/xml"
"fmt"
"os"
"strings"
)