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(); |
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
<!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
<?php | |
/* | |
* A simple PHP file based cache with support for cache expiry and storing any data type or structure | |
* | |
* Released with the karmaware tag - https://pete-rai.github.io/karmaware | |
* | |
* Website : http://www.rai.org.uk | |
* GitHub : https://github.com/pete-rai | |
* LinkedIn : https://uk.linkedin.com/in/raipete |
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
<? | |
/* | |
* A simple PHP timer class with interim marker support | |
* | |
* Released with the karmaware tag - https://pete-rai.github.io/karmaware | |
* | |
* Website : http://www.rai.org.uk | |
* GitHub : https://github.com/pete-rai | |
* LinkedIn : https://uk.linkedin.com/in/raipete |
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
<?php | |
/* | |
* A simple PHP wrapper around the Twitter API with full authorization support | |
* | |
* Released with the karmaware tag - https://pete-rai.github.io/karmaware | |
* | |
* Website : http://www.rai.org.uk | |
* GitHub : https://github.com/pete-rai | |
* LinkedIn : https://uk.linkedin.com/in/raipete |
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
<?php | |
/* | |
* A simple PHP logger class with timestamps and trace support | |
* | |
* Released with the karmaware tag - https://pete-rai.github.io/karmaware | |
* | |
* Website : http://www.rai.org.uk | |
* GitHub : https://github.com/pete-rai | |
* LinkedIn : https://uk.linkedin.com/in/raipete |
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
<?php | |
/* | |
* A super simple PHP file based cache for any data type or structure | |
* | |
* Released with the karmaware tag - https://pete-rai.github.io/karmaware | |
* | |
* Website : http://www.rai.org.uk | |
* GitHub : https://github.com/pete-rai | |
* LinkedIn : https://uk.linkedin.com/in/raipete |
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
'use strict' | |
/* | |
first install the following node modules: | |
npm install aws4 | |
npm install https | |
npm install querystring | |
npm install speaker | |
npm install lame |
NewerOlder