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 args = process.argv | |
.filter((arg) => arg.includes("=")) | |
.reduce((acc, cur) => { | |
let split = cur.split("="); | |
acc[split[0]] = split[1]; | |
return acc; | |
}, {}); | |
console.log(args); | |
// run command: node parse-node-args.js foo=bar baz=qux |
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
// update a head tag | |
function updateHeadTag({ tag = "meta", ...attrs }) { | |
// input check | |
const attrKeys = Object.keys(attrs); | |
if (attrKeys.length < 1) { | |
return console.error( | |
`updateHeadTag() received no attributes to set for ${tag} tag` | |
); | |
} |
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
// update head meta tags | |
function addMetaTag({ name, property, value }) { | |
// console.log({ name, property, value }); | |
// input checks | |
if (value === null || value === undefined) { | |
return console.error( | |
`addMetaTag received no value to set for tag: ${name ?? property}` | |
); | |
} |
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
// | |
// NoteField.swift | |
// | |
// Created by Floyd Noel on 7/11/21. | |
// | |
import SwiftUI | |
struct NoteField: View { | |
var label: String |
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 getSearchParams = () => | |
window.location.search | |
.substring(1) | |
.split('&') | |
.reduce((acc, searchParam) => { | |
const [name, value] = searchParam.split('='); | |
return { ...acc, [name]: value }; | |
}, {}); |
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
// takes a string URL, and returns a string URL which allows the request to proceed without CORS blocking | |
const forgetAboutCors = u => `https://cors-anywhere.herokuapp.com/${u}` | |
// example usage: forgetAboutCors(`https://clinicaltrials.gov/ct2/show/${'NCT03512561'}?displayxml=true`) |
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 scriptAlreadyLoaded = urlString => Array.prototype.slice.call(document.scripts).filter(s => s.src).map(s => s.src).contains(urlString) |
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
#!/bin/bash | |
echo "Cleaning up any git ignored files..." | |
# copy and paste the line below to get the same results as running this script | |
git rm --cached `git ls-files -ic --exclude-from=.gitignore` | |
echo "Finished clean up." | |
# source: https://stackoverflow.com/questions/13541615/how-to-remove-files-that-are-listed-in-the-gitignore-but-still-on-the-repositor/13541721 |