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
export const socketProcedure = publicProcedure.use(connectionSocket); | |
export const socketConnectProcedure = socketProcedure.use(connectionSocketConnect); | |
export const socketDisconnectProcedure = socketProcedure.use(connectionSocketDisconnect); | |
export const socketRequestProcedure = socketProcedure.use(connectionSocketRequest); | |
export const socketEventProcedure = socketProcedure.use(connectionSocketEvent); | |
export const mySocketRouter = router({ | |
connect: socketConnectProcedure.mutation(async ({ctx, input}) => { | |
// aws connection connect 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
function test() { | |
const rapierEventQueue = new EventQueue(true); | |
let world = new World({x: 0.0, y: 0, z: 0.0}); | |
// create the kinematic controller | |
const characterController = createObjectFromDesc( | |
world, | |
{ |
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
let result = new Vector3(0, 0, 0); | |
world.contactPair(myCollider!.handle, collider.handle, (overlap, flipped) => { | |
const contacts = overlap.numContacts(); | |
if (contacts === 0) { | |
// strange | |
return; | |
} | |
const contactResults: {direction: Vector3; distance: number}[] = []; | |
const resultAvg = new Vector3(0, 0, 0); |
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
export class AwaitLocker { | |
private static lockerCallbacks: {[key: string]: {callback?: () => void}[]} = {}; | |
static async startLock(key: string) { | |
if (!AwaitLocker.lockerCallbacks[key]) { | |
AwaitLocker.lockerCallbacks[key] = []; | |
} | |
if (AwaitLocker.lockerCallbacks[key].length > 0) { | |
let callback: () => void; | |
const promise = new Promise<void>((res) => { |
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
export type Discriminate<T, TField extends keyof T, TValue extends T[TField]> = T extends {[field in TField]: TValue} | |
? T | |
: never; | |
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; | |
type IsUnion<T, U extends T = T> = T extends unknown ? ([U] extends [T] ? false : true) : false; | |
type IsStringUnion<T> = IsUnion<T> extends true ? (T extends string ? true : false) : false; |
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
let glob = require('glob'); | |
let fs = require('fs'); | |
const prettier = require('prettier'); | |
var readJson = (path, cb) => { | |
fs.readFile(require.resolve(path), (err, data) => { | |
if (err) cb(err); | |
else cb(JSON.parse(data)); | |
}); | |
}; |
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 m = [ | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 10}, | |
{firstOrder: false, secondOrder: true, thirdOrder: false, rank: 15}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 12}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 16}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 21}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 54}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 13}, | |
{firstOrder: false, secondOrder: false, thirdOrder: false, rank: 30}, | |
{firstOrder: true, secondOrder: false, thirdOrder: false, rank: 35}, |
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
import React from 'react'; | |
import {Image, ScrollView, StyleProp, TextStyle, View, ViewProps, ViewStyle} from 'react-native'; | |
export interface WithCssProps { | |
classNames?: string[]; | |
parentComponentTree?: ComponentTree; | |
siblingsLength?: number; | |
childIndex?: number; | |
style?: StyleProp<TextStyle>; | |
} |
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
import React from 'react'; | |
import {StyleProp, TextStyle, View, ViewProps, ViewStyle} from 'react-native'; | |
export interface WithClassProps { | |
classNames?: string[]; | |
componentTree?: ComponentTree; | |
style?: StyleProp<TextStyle>; | |
} | |
type ComponentTree = { |
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
export class Screen extends Component<Props, State> { | |
constructor(props: Props) { | |
super(props); | |
this.state = {}; | |
} | |
render() { | |
return ( | |
<CView classNames={['a']}> | |
<CView classNames={['b']}> |
NewerOlder