Skip to content

Instantly share code, notes, and snippets.

View halldorel's full-sized avatar

Halldór Eldjárn halldorel

View GitHub Profile

Keybase proof

I hereby claim:

  • I am halldorel on github.
  • I am halldorel (https://keybase.io/halldorel) on keybase.
  • I have a public key ASCRtZXBVXl9iBBjJLREQrK3xtdlb0MbAAIOrooVpT-5kAo

To claim this, I am signing this object:

const folderName = filenamify(req.body.folderName);
const createSize = (file) => new Promise((resolve, reject) => {
// Returns a promise
console.log("Inside resize", file);
return sharp(file.buffer).resize(file.w, file.w, {
fit: sharp.fit.inside,
withoutEnlargement: true,
})
.toFormat('jpeg')
@halldorel
halldorel / dof.js
Created June 19, 2019 20:35
Inconvergent DOF effect implementation in JS
// Requires npm package canvas-sketch
// Credit: https://inconvergent.net/2019/depth-of-field/
const canvasSketch = require('canvas-sketch');
const settings = {
dimensions: [ 2000, 2000 ]
};
const points = [[[500, 500, 0], [1700, 700, 200]], [[1700, 700, 200], [900, 1000, 0]], ];