This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL=https://xkcd.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL=https://xkcd.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: clean | |
clean: | |
rm -f $(lastword $(MAKECMDGOALS)) | |
.fonts.zip: | |
zip -9 --filesync --move --recurse-paths .fonts.zip .fonts/ | |
%.zip: | |
mkdir -p nodejs/node_modules/chrome-aws-lambda/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Jimp = require("jimp") | |
const {ssim} = require('ssim.js') | |
Jimp.read("./ref.gif", function (err, image) { | |
if (err) { | |
console.log(err) | |
} else { | |
const buf = image.getBuffer(); | |
const out = ssim(buf, buf); | |
console.log(out); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash | |
filename=$(basename -- "$1") # $1 is full name | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
# trace to gif via https://github.com/pmdartus/snapline | |
echo "Converting $1 to $filename.gif ..." | |
snapline $1 -f 30 -o "$filename.gif" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require('sharp'); | |
sharp('./3MB.png').resize(400, 400).jpeg({ | |
quality: 1, | |
force: true | |
}).webp({ | |
lossless: false, | |
quality: 50, | |
force: true | |
}).toFile('./chain.webp'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 6MB => 6291456 | |
const fs = require('fs'); | |
fs.copyFileSync('svg.svg', 'long.svg'); | |
fs.appendFileSync('long.svg', `<!--${'-'.repeat(6 * 1024 * 1024 - 96)}-->`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browser = require('detect-browser'); | |
if (browser) { | |
console.log(browser.name); | |
console.log(browser.version); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PNG = require('pngjs').PNG | |
, pixelmatch = require('pixelmatch') | |
, fabric = require('fabric').fabric | |
var c1 = new fabric.Canvas('c1') | |
, getData = document.getElementById('get-data') | |
, data = document.getElementById('data'); | |
c1.add(new fabric.IText('hi', { | |
left: 20, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PNG = require('pngjs').PNG | |
, pixelmatch = require('pixelmatch') | |
, fabric = require('fabric').fabric; | |
var c1 = new fabric.Canvas('c1') | |
, c2 = new fabric.Canvas('c2'); | |
var ctx1 = c1.getContext() | |
, ctx2 = c2.getContext() | |
, ctx3 = document.getElementById('c3').getContext('2d'); |
NewerOlder