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 React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import usePersistedState from './usePersistedState'; | |
function App() { | |
const [count, setCount, unsetCount] = usePersistedState( | |
0, | |
'count', | |
sessionStorage | |
); |
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
/** | |
* Marks all closed issues and pull reuqest notifications as read. | |
*/ | |
(() => { | |
const closedIssueNodes = document.querySelectorAll('.js-notification .type-icon-state-closed, .js-notification .type-icon-state-merged'); | |
closedIssueNodes.forEach(node => { | |
node.offsetParent.querySelector('button.delete-note').click(); | |
}); |
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
# Query order pattern from GitHub GraphQL API | |
# Can be used in conjunction with Relay pagination. | |
""" | |
Possible directions in which to order a list of items when provided an `orderBy` argument. | |
""" | |
enum OrderDirection { | |
""" | |
Specifies an ascending order for a given `orderBy` argument. | |
""" |
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
Prefix | Description | Notes | |
---|---|---|---|
ac_ | Platform Client ID | Identifier for an auth code/client id. | |
acct_ | Account ID | Identifier for an Account object. | |
aliacc_ | Alipay Account ID | Identifier for an Alipay account. | |
ba_ | Bank Account ID | Identifier for a Bank Account object. | |
btok_ | Bank Token ID | Identifier for a Bank Token object. | |
card_ | Card ID | Identifier for a Card object. | |
cbtxn_ | Customer Balance Transaction ID | Identifier for a Customer Balance Transaction object. | |
ch_ | Charge ID | Identifier for a Charge object. | |
cn_ | Credit Note ID | Identifier for a Credit Note object. |
A list of cheap-ish fonts, that doesn't put a dent in my wallet.
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 React from 'react'; | |
import { createBrowserHistory } from 'history'; | |
export const historyContext = React.createContext(null); | |
const HistoryContextProvider = historyContext.Provider; | |
// This is initialized at the time the file/module is imported, and not on component mount. | |
const history = createBrowserHistory(); | |
export function History(props) { |
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
function BetterFixedLazyExample({ lazyValue }) { | |
// Initialize with null value. | |
const myRef = useRef(null); | |
useLayoutEffect(() => { | |
console.log(myRef.current); // => HTMLDivElement DOM node | |
}, []); | |
// Make sure the ref setter is not blocked by conditionals. | |
return ( |
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
[profile.release] | |
opt-level = "z" | |
lto = true | |
codegen-units = 1 | |
panic = "abort" |