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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<title>3D Card Wheel</title> | |
<style> | |
html, | |
body { |
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
/* | |
An example of using Javascript Promises to ensure that a set of asyncronous | |
steps are always performed in the specified order and strictly one after | |
another. | |
*/ | |
// --- some async function that takes some time to complete |
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
/* | |
Method chaining is useful way to construct readable software. It is a process | |
where each method returns an object, allowing the calls to be chained together | |
in a single statement without requiring variables to store the intermediate | |
results. However, how can we achieve this in the face of JavaScript’s | |
asynchronous function? Here is a simple solution for this tricky issue. | |
*/ |
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'); | |
async function findImageWithinImage(outer, inner, max = 1) // max is the maximum occurences to find | |
{ | |
let file_o = sharp(outer); | |
let file_i = sharp(inner); | |
let buff_o = await file_o.raw().toBuffer(); | |
let buff_i = await file_i.raw().toBuffer(); | |
let meta_o = await file_o.metadata(); | |
let meta_i = await file_i.metadata(); |
OlderNewer