File | Diff | branch-name |
branch-with-a-long-name |
Event |
---|
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
// ESM version of "[email protected]" | |
// https://github.com/pillarjs/path-to-regexp/blob/master/package.json | |
/** | |
* Tokenize input string. | |
*/ | |
function lexer(str) { | |
var tokens = []; | |
var i = 0; | |
while (i < str.length) { |
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
import { cloneElement, toChildArray } from "preact"; | |
const AutoTargetBlank = ({ children }) => { | |
children = toChildArray(children); | |
return ( | |
<div> | |
{children.map((child) => { | |
return cloneElement(child, { target: '_blank' }); | |
})} | |
</div> |
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
import { urlToFileSystemPath } from "@jsenv/filesystem" | |
import { require } from "@jsenv/core/src/internal/require.js" | |
export const createMagicSource = ({ url, content, sourcemap }) => { | |
if (content === undefined) { | |
throw new Error("content missing") | |
} | |
const filename = urlToFileSystemPath(url) | |
const { |
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
document.querySelector('button').onclick = () => { | |
const scrollStart = document.querySelector(".menu-wrapper").scrollLeft | |
const scrollEnd = scrollStart + menuWrapperSize | |
startJavaScriptAnimation({ | |
duration: 300, | |
onProgress: ({ progress }) => { | |
document.querySelector(".menu-wrapper").scrollLeft = | |
scrollStart + (scrollEnd - scrollStart) * progress | |
}, | |
}) |
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
export const createSignal = () => { | |
let listeners = [] | |
const listen = (callback) => { | |
let removed = false | |
listeners = [...listeners, callback] | |
return () => { | |
if (removed) return | |
removed = true | |
const listenersWithoutCallback = [] |
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
<html> | |
<head> | |
<title>Redux stuff</title> | |
</head> | |
<body> | |
<main> | |
<iframe src="./without-redux.html"></iframe> | |
<iframe src="./with-redux.html"></iframe> | |
</main> | |
<style> |
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 debounce = ( | |
fn, | |
{ debounceInterval = 50, maxConcurrentRequests = 15, unstackCount = 10 } = {}, | |
) => { | |
let queue = [] | |
let pendingCount = 0 | |
const debouncedFn = async (request) => { | |
let entry | |
const promise = new Promise((resolve, reject) => { | |
entry = { request, resolve, reject } |
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 composeProps = (leftProps, rightProps) => { | |
const composedProps = { ...rightProps } | |
Object.keys(leftProps).forEach((key) => { | |
const leftValue = leftProps[key] | |
if (key in rightProps) { | |
const rightValue = rightProps[key] | |
composedProps[key] = composeProp(leftValue, rightValue) | |
} else { | |
composedProps[key] = leftValue |
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
// https://developer.github.com/v3/pulls/#list-pull-requests | |
const fetch = require("node-fetch") | |
const listPullRequestForBranch = async ({ token, repoOwner, repoName, head }) => { | |
try { | |
const href = `https://api.github.com/repos/${repoOwner}/${repoName}/pulls?head=${encodeURIComponent( | |
head, | |
)}` | |
const response = await fetch(href, { | |
headers: { |
NewerOlder