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
name: Create or Update Branch | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
required: true | |
jobs: | |
checkout-branch: | |
runs-on: ubuntu-latest |
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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 { useEffect, createRef } from 'react'; | |
const stopPropagationAndUseHandler = (handler: EventListener): EventListener => e => { | |
e.stopImmediatePropagation(); | |
handler(e); | |
} | |
export const useNativeEvent = (type: string, handler: EventListener) => { | |
const ref: React.RefObject<any> = createRef(); |
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
/** | |
* Summary of `ReactBrowserEventEmitter` event handling: | |
* | |
* - Top-level delegation is used to trap most native browser events. This | |
* may only occur in the main thread and is the responsibility of | |
* ReactDOMEventListener, which is injected and can therefore support | |
* pluggable event sources. This is the only work that occurs in the main | |
* thread. | |
* | |
* - We normalize and de-duplicate events to account for browser quirks. This |
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 el = findDomNode(this); | |
el.addEventListener("click", handler); |
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 handler = () => alert('🙌'); | |
const MyComponent = () => <button onClick={handler}>🔥</button>; |
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
╰─$ gitclean | |
Running 'git fetch'... | |
Running 'git remote prune origin'... | |
Running 'git branch -vv'... | |
Running 'git branch -d RN-423'... | |
Running 'git branch -d WE-1885-cancel-subscription-reason'... | |
Running 'git branch -d anna/WE-2304/app-page-refactor'... | |
Running 'git branch -d chandra/we-2246-ts'... | |
Running 'git branch -d dw-more-uat'... |
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
/* | |
[2018-12-17] Challenge #370 [Easy] UPC check digits | |
The Universal Product Code (UPC-A) is a bar code used in many parts of the world. The bars encode a 12-digit number used to identify a product for sale, for example: | |
042100005264 | |
The 12th digit (4 in this case) is a redundant check digit, used to catch errors. Using some simple calculations, a scanner can determine, given the first 11 digits, what the check digit must be for a valid code. (Check digits have previously appeared in this subreddit: see Intermediate 30 and Easy 197.) UPC's check digit is calculated as follows (taken from Wikipedia): | |
1. Sum the digits at odd-numbered positions (1st, 3rd, 5th, ..., 11th). If you use 0-based indexing, this is the even-numbered positions (0th, 2nd, 4th, ... 10th). | |
2. Multiply the result from step 1 by 3. | |
3. Take the sum of digits at even-numbered positions (2nd, 4th, 6th, ..., 10th) in the original number, and add this sum to the result from step 2. |
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 { Prompter, Validators } from './prompt'; | |
const main = async () => { | |
const inputs = await new Prompter() | |
.prompt('What is the auction id?', { validator: Validators.required }) | |
.then(p => p.prompt('Start Date?', { validator: Validators.isDate })) | |
.then(p => p.prompt('End Date?', { validator: Validators.isDate })) | |
.then(p => p.finish()); | |
console.log(inputs); |
NewerOlder