- New repository
- Initialize this repository with a README
- Add .gitignore Node
- Add a license MIT License
- Create repository
- Clone or download
- Copy to clipboard
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
// Find, Splice, Undo | |
function findSpliceUndo(arr, findCallback) { | |
const idx = arr.findIndex(findCallback) | |
if (idx < 0) return | |
const removedArr = arr.splice(idx, 1) | |
return () => arr.splice(idx, 0, removedArr[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
export function areUrlOriginsEqual(url1, url2) { | |
const u1 = new URL(url1); | |
const u2 = new URL(url2); | |
return u1.origin === u2.origin; | |
} |
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
<style> | |
body { | |
margin: 0; | |
min-height: 100vh; | |
display: flex; | |
flex-direction: column; | |
} | |
iframe { flex-grow: 1 } | |
</style> | |
<script type=module> |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title></title> | |
</head> | |
<body> | |
</body> | |
</html> |
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 eventPathFindTargetMatch(event, selector) { | |
return event.composedPath().find(target => target.matches?.(selector)); | |
} |
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
<!doctype html> | |
<head> | |
<!-- See 2020 CSS Starter https://gist.github.com/pinkhominid/c59aa716fb9598d3e547a87305ef198d --> | |
<link rel=stylesheet href=https://gist.githubusercontent.com/pinkhominid/c59aa716fb9598d3e547a87305ef198d/raw/08f50f2d48074414d67e378f302be4bb31231170/starter.css> | |
<style> | |
body { | |
display: flex; | |
flex-direction: column; | |
} | |
header { |
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
angular.element(document.documentElement).scope() |
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
{ | |
"version": "0.3.0", | |
"name": "url-fun", | |
"description": "URL fun", | |
"main": "url-fun.js", | |
"author": "pinkhominid <[email protected]>", | |
"license": "MIT", | |
"homepage": "https://gist.github.com/pinkhominid/742ff38688f7638d4eb795048b620e8e" | |
} |
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
// Handles root path slash and casing diffs correctly. For example: | |
// areUrlsEqual('http://example.com', 'http://Example.com/') => true | |
export default function areUrlsEqual(url1, url2) { | |
const u1 = new URL(url1); | |
const u2 = new URL(url2); | |
return u1.toString() === u2.toString(); | |
} |