- 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
// Export a default import as default | |
export { default } from '../node_modules/roadtrip/dist/roadtrip.es.js'; | |
// Export a default import as named | |
export { default as router } from '../node_modules/roadtrip/dist/roadtrip.es.js'; |
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
const fs = require('fs'); | |
const fetch = require('node-fetch'); | |
const FormData = require('form-data'); | |
const filePath = `path/to/file.ext`; | |
const form = new FormData(); | |
const stats = fs.statSync(filePath); | |
const fileSizeInBytes = stats.size; | |
const fileStream = fs.createReadStream(filePath); | |
form.append('field-name', fileStream, { knownLength: fileSizeInBytes }); |
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
// Found in a Lea Verou project and tweaked :) (https://github.com/LeaVerou/animatable/blob/gh-pages/index.js#L1) | |
function $(expr, con) { return (con || document).querySelector(expr); } | |
function $$(expr, con) { return Array.from((con || document).querySelectorAll(expr)); } |
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
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} | |
html:before { | |
padding: 200px; | |
position: fixed; | |
background-color: #222; |
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(); | |
} |
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
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
<!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
export function eventPathFindTargetMatch(event, selector) { | |
return event.composedPath().find(target => target.matches?.(selector)); | |
} |