Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Floyd Noel floydnoel

👨‍💻
View GitHub Profile
@floydnoel
floydnoel / NoteField.swift
Created Jul 11, 2021
A TextEditor component with a placeholder
View NoteField.swift
//
// NoteField.swift
//
// Created by Floyd Noel on 7/11/21.
//
import SwiftUI
struct NoteField: View {
var label: String
View getSearchParams.js
const getSearchParams = () =>
window.location.search
.substring(1)
.split('&')
.reduce((acc, searchParam) => {
const [name, value] = searchParam.split('=');
return { ...acc, [name]: value };
}, {});
@floydnoel
floydnoel / forgetAboutCors.js
Last active Apr 30, 2018
CORS problem? forget about it!
View forgetAboutCors.js
// 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`)
View scriptAlreadyLoaded.js
const scriptAlreadyLoaded = urlString => Array.prototype.slice.call(document.scripts).filter(s => s.src).map(s => s.src).contains(urlString)
@floydnoel
floydnoel / git-ignore-cleaner.sh
Last active Jul 27, 2022
Remove all files from a Git repo based on the .gitignore file
View git-ignore-cleaner.sh
#!/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