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
interface BulkItemCreator { | |
create(items: Array<{ id: string; name: string }>): void; | |
} | |
export function useBulkCreateExample() { | |
return useRecoilCallback( | |
({ transact_UNSTABLE }) => | |
(callback: (creator: BulkItemCreator) => void) => { | |
transact_UNSTABLE(({ set, get }) => { | |
callback({ |
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 filteredWorkItemsByStatusSelector = equalSelectorFamily({ | |
key: 'FiltereWorkItemsByStatus', | |
get: | |
({ spaceId, filterString }: { spaceId: string | undefined; filterString: string }) => | |
({ get }) => { | |
const itemIds: string[] = getFilteredWorkItemsSomehow(get, spaceId, filterString); | |
return itemIds: | |
}, | |
equals: _.isEqual, | |
}); |
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
function equalSelectorFamily<T, P extends SerializableParam>( | |
options: EqualSelectorFamilyOptions<T, P> | |
) { | |
const inner = selectorFamily<T, P>({ | |
key: `${options.key}_inner`, | |
get: options.get, | |
}); | |
const priorValues: Map<P, T | undefined> = new Map(); |
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 workItemTitleSelector = selectorFamily({ | |
key: 'WorkItemTitle', | |
get: | |
(workItemId: string | undefined | null) => | |
({ get }) => { | |
return get(workItems(workItemId)?.title; | |
}, | |
}); | |
// only fetch what we need! |
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
function MyEditor() { | |
const editor = useMemo(() => withReact(createEditor()), []); | |
const [value, setValue] = React.useState<Node[]>([ | |
{ | |
children: [{ text: 'Testing' }], | |
}, | |
]); | |
return ( | |
<Slate editor={editor} value={value} onChange={(v) => setValue(v)}> | |
<Editable /> |
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
[ | |
{ | |
"type": "paragraph", | |
"children": [ | |
{ | |
"text": "Text with a link " | |
}, | |
{ | |
"type": "link", | |
"url": "https://kitemaker.co", |
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
#!/usr/bin/env bash | |
# fork from https://gist.github.com/jakemhiller/d342ad51505addf78ec628a16fd3280f | |
changed_files="$(git diff-tree -r --name-only --no-commit-id $1 $2)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
U=${USER+", $USER"} |
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
function helloWorld() { | |
`This template string ${x} is on | |
multiple lines. | |
` | |
function innerFunction() { | |
return 9 + 4; | |
} | |
return hello + innerFunction(); |
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
### Keybase proof | |
I hereby claim: | |
* I am ksimons on github. | |
* I am ksimons (https://keybase.io/ksimons) on keybase. | |
* I have a public key whose fingerprint is 28F4 A0A3 02CF 6CBC 7CD0 B1BF 0B9C 9048 FCE1 D4DE | |
To claim this, I am signing this object: |
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
function Foo(val) { | |
this.value = val; | |
this.increment = function() { | |
this.value++; | |
} | |
} | |
var f = new Foo(11); | |
f.increment(); |
NewerOlder