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
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: { |
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/issues/comments/#create-a-comment | |
// https://developer.github.com/v3/issues/comments/#edit-a-comment | |
const fetch = require("node-fetch") | |
const commentGithubPullRequest = async ({ | |
token, | |
repoOwner, | |
repoName, | |
issueNumber, | |
commentBody, |
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 lighthouse = require("lighthouse") | |
const chromeLauncher = require("chrome-launcher") | |
const launchChromeAndRunLighthouse = async ({ url, opts, config = null }) => { | |
const chrome = await chromeLauncher.launch({ chromeFlags: opts.chromeFlags }) | |
opts.port = chrome.port | |
const results = await lighthouse(url, opts, config) | |
// use results.lhr for the JS-consumeable output | |
// https://github.com/GoogleChrome/lighthouse/blob/master/types/lhr.d.ts | |
// use results.report for the HTML/JSON/CSV output as a string |
NewerOlder