View tsconfig.json
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
Show hidden characters
/* | |
Enabled by "strict": | |
- alwaysStrict | |
- noImplicitAny | |
- noImplicitThis | |
- strictNullChecks | |
- strictBindCallApply | |
- strictFunctionTypes | |
- strictPropertyInitialization | |
- useUnknownInCatchVariable |
View model.tsx
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, { | |
createContext, | |
ReactNode, | |
useCallback, | |
useEffect, | |
useState, | |
} from 'react'; | |
import { unstable_batchedUpdates } from 'react-dom'; | |
import { ReadonlyJSONValue, ReadTransaction, Replicache } from 'replicache'; |
View use-subscribe-suspense.ts
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, useState } from 'react'; | |
import { unstable_batchedUpdates } from 'react-dom'; | |
import type { | |
ReadonlyJSONValue, | |
ReadTransaction, | |
Replicache, | |
} from 'replicache'; | |
// We wrap all the callbacks in a `unstable_batchedUpdates` call to ensure that | |
// we do not render things more than once over all of the changed subscriptions. |
View theme.ts
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 { createCss } from '@stitches/react'; | |
import { mint } from '@radix-ui/colors'; | |
type ScaleNum = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; | |
type ScaleKey<Name extends string> = `${Name}${ScaleNum}`; | |
type ColorScale<Name extends string> = { [K in ScaleKey<Name>]: string }; | |
function mapColorScale<FromName extends string, ToName extends string>( | |
fromScale: ColorScale<FromName>, | |
fromName: FromName, |
View 05.js
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 opcode = op => { | |
const str = String(op); | |
return parseInt(str.substr(str.length - 2)); | |
}; | |
const mode = (op, pos) => { | |
const str = String(op); | |
if (pos + 2 > str.length) return 0; | |
return parseInt(str.substr(str.length - (2 + pos), 1)); | |
}; |
View gist:b3183357f904bc61cb21f1dd22a1af00
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
## dgraph query | |
{ | |
person(func: uid(0x41d)) { | |
__typename | |
uid | |
name: Person.name | |
partner: Person.partner { | |
__typename | |
uid | |
name: Person.name |
View clean.sh
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
# Require Swiss File Knife (sfk) (available from homebrew on macOS) | |
# find all files detected as CRLF and force CRLF | |
find . -not -path "./.git*" -type f | xargs file | grep "CRLF" | awk -F ':' '{ print $1 }' | xargs sfk addcr | |
# find all files detected as LF and force LF | |
find . -not -path "./.git*" -type f | xargs file | grep -v "CRLF" | awk -F ':' '{ print $1 }' | xargs sfk remcr |
View bif.js
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 Buffer(a) { | |
this.buffer = a; | |
this.position = 0; | |
} | |
Buffer.prototype = { | |
seek: function(a) { | |
this.position = a; | |
}, | |
skip: function(a) { | |
this.position += a; |
View docker-compose.yml
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
version: '3' | |
services: | |
data: | |
image: dgraph/dgraph:master | |
volumes: | |
- dgraph:/dgraph | |
zero: | |
image: dgraph/dgraph:master | |
command: dgraph zero --port_offset -2000 --my=zero:5080 |
View gist:a9e3f690527d6c4bbdc7d5053cbb49f0
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
///////////////////////////////////////////////////// TAKE 1 | |
http://localhost:8080/mutate | |
{ set { | |
_:node <__typename> "Person" . | |
_:node <name> "Tim" . | |
_:node <children> _:node0 . | |
_:node0 <parents> _:node . | |
_:node0 <__typename> "Person" . | |
_:node0 <name> "Jerry" . |
NewerOlder