This file contains hidden or 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
"editor.tokenColorCustomizations": { | |
"[Shades of Purple]": { | |
"comments": "#675a72", | |
"functions": "#ffa996", | |
"keywords": "#bdafb9" | |
}, | |
"textMateRules": [ | |
{ | |
/* handles jsx props & module names */ | |
"name": "[Entity] — The main Entity color", |
This file contains hidden or 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
export function handlePromises(promises = []) { | |
return Promise.all(promises) | |
.then((responses) => { | |
console.log('handlePromises Success', responses); | |
return responses; | |
}) | |
.catch((error) => | |
console.log( | |
`handlePromises Error ${JSON.stringify(error, null, 2)}` | |
) |
This file contains hidden or 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
function injectField (obj, { name, value }) { | |
return {...obj, [name]: value} | |
} |
This file contains hidden or 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
function isEmpty(value){ | |
return value === undefined || | |
value === null || | |
(typeof value === "object" && Object.keys(value).length === 0) || | |
(typeof value === "string" && value.trim().length === 0) | |
} |
This file contains hidden or 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
function downloadAsJson(exportObj, exportName){ | |
var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportObj)); | |
var downloadAnchorNode = document.createElement('a'); | |
downloadAnchorNode.setAttribute("href", dataStr); | |
downloadAnchorNode.setAttribute("download", exportName + ".json"); | |
document.body.appendChild(downloadAnchorNode); // required for firefox | |
downloadAnchorNode.click(); | |
downloadAnchorNode.remove(); | |
} |
This file contains hidden or 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
import { useEffect, useState } from "react"; | |
export function useStates(defaultState) { | |
const [states, setStates] = useState({}); | |
//SCOPE: used as a make-shift logger, triggers on each state change | |
useEffect(() => console.log("states monitor", states), [states]); | |
useEffect(() => { | |
// SCOPE: set initial state - or - throw if no defaultState |
This file contains hidden or 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
Show hidden characters
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
"Named import": { | |
"scope": "javascript,javascriptreact,typescript,typescriptreact", | |
"prefix": "from", |
This file contains hidden or 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
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | |
# dependencies | |
/node_modules/ | |
/.pnp | |
.pnp.js | |
# testing | |
/coverage |
This file contains hidden or 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
import { Octokit } from '@octokit/rest'; | |
import { nanoid } from 'nanoid'; | |
export class GitCMS { | |
constructor(o) { | |
this.rootOptions = o; | |
this.octokit = new Octokit({ | |
auth: this.rootOptions.token | |
}); | |
} |
This file contains hidden or 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
import { promises as fsPromises } from 'fs'; | |
import os from 'os'; | |
import path from 'path'; | |
// used to render and work with local markdown files | |
export async function pathExists(filePath) { | |
try { | |
const stat = await fsPromises.stat(filePath); | |
return stat.isFile(); |