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
# 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 <<< |
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
// 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]; |
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
// 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); |
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
// 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}) => ( |
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
<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> |
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 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 |
NewerOlder