nvm install lts/*
nvm install stable
const util = require('util') | |
const fs = require('fs') | |
const path = require('path') | |
function makeFileCacheJunction(dir) { | |
return async function fileCacheJunction(...args) { | |
const [cacheKey, junction, fn] = | |
args.length === 3 ? [args[0], args[1], args[2]] : [0, args[0], args[1]] | |
const directoryTemplate = process.env.JUNCTION_CACHE_DIRECTORY_TEMPLATE |
<html><head><meta charset="utf-8"> | |
<title>Data join with and without key function</title> | |
<style> | |
.contentBound, .contentNoFunc {position: relative; height: 40px; } | |
.contentBound div, .contentNoFunc div {position: absolute; } | |
</style></head> | |
<body> | |
<h1>With Data Callback Function</h1> | |
<div class="contentBound"></div> |
// Per https://criscodes.hashnode.dev/how-to-render-multiple-images-in-gatsby-using-image-component-cjxoowlou000pfms1o91x71ts | |
// Cycles through an array of *all* of the images and uses .find() to pass along one with a matching filename | |
// Max image width is set as 1200px, but can be changed... | |
// This component has zero styling (other than the implied max-width) | |
import React from "react" | |
import { StaticQuery, graphql } from "gatsby" | |
import Img from "gatsby-image" | |
const Image = ({filename, alt}) => ( |
// sauce: https://dev.to/eaich/spy-on-the-dom-3d47 | |
(function SpyOn() { | |
const _id = 'spyon-container', | |
_posBuffer = 3; | |
function init() { | |
document.body.addEventListener('mousemove', glide); | |
document.body.addEventListener('mouseover', show); | |
document.body.addEventListener('mouseleave', hide); |
// Will actually work without the 'String()` whatnot, but I'm being particular | |
const subsetSum = (arr, target) => { | |
let dictObj = {}; | |
for (let i = 0; i < arr.length; i++) { | |
const val = arr[i]; | |
const compliment = String(target - val); | |
if (dictObj.hasOwnProperty(compliment)) { // must use hasOwnProp in case of index=0 which would return as false!! | |
return [dictObj[compliment],i]; |
# Rich's .gitignore file: | |
# See https://help.github.com/ignore-files/... | |
# leading-slash stops recursion, trailing slash = directory/ | |
# >>>Notes <<<< | |
notes.txt | |
notes.md | |
localnotes.md | |
tutsrc.txt | |
# >>> Dependency directories <<< |
build/ | |
node_modules/ | |
package-lock.json | |
yarn.lock | |
package.json | |
*.html |
{ | |
"printWidth": 80, | |
"tabWidth": 2, | |
"useTabs": false, | |
"semi": true, | |
"singleQuote": true, | |
"trailingComma": "all" | |
} |
/* orig https://gist.github.com/gaearon/ca6e803f5c604d37468b0091d9959269 */ | |
module.exports = { | |
entry: { | |
main: './src/app.js', | |
}, | |
output: { | |
// `filename` provides a template for naming your bundles (remember to use `[name]`) | |
filename: '[name].bundle.js', | |
// `chunkFilename` provides a template for naming code-split bundles (optional) |