Skip to content

Instantly share code, notes, and snippets.

int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@heinrich-ulbricht
heinrich-ulbricht / CompressString.js
Created June 11, 2021 13:38
JavaScript: Compressing a string to send via query parameter
// pako finally worked (browser, Teams desktop client, Teams Android client); I tried/checked a lot of libraries but they either produced wrong results, did not compress good or were old or without good docs: shorter, shoco, lzma-js, lzutf8 (did not work in Teams Android client), lz-string
const pako = require('pako');
const {Base64} = require('js-base64');
let stringToCompress = 'test';
let compressedStringBytes = pako.deflate(stringToCompress);
let compressedStringBytesBase64 = Base64.fromUint8Array(compressedStringBytes, true);
// send via query parameter
// -----------------------------