Skip to content

Instantly share code, notes, and snippets.

View corbanbrook's full-sized avatar

Corban Brook corbanbrook

  • Horizon Blockchain Games
  • Toronto, Canada
  • X @corban
View GitHub Profile
@corbanbrook
corbanbrook / index.css
Created January 23, 2023 02:59
Tailwind Color Schemes
@tailwind base;
@tailwind components;
@tailwind utilities;
:root {
--color-heading: theme(colors.slate.800);
--color-body: theme(colors.slate.500);
--color-ui-background: theme(colors.slate.200);
--color-backgroud: theme(colors.slate.50);
}
@corbanbrook
corbanbrook / multi-wallet-extension-support.md
Last active May 12, 2022 08:49
Multi Wallet Extension Support

Multi Wallet Extension Support

As more and more web3 wallet projects enter the space, each with their own stregnths and weaknesses, users will have a great deal of choice for not only which wallet they use but which combination of wallets they use. This presents a problem for browser extensions which all expose the window.ethereum provider object.

How do we allow multiple providers to "play nice" with each other?

Problems

1. When multiple wallets extensions are installed which wallet is used?

const uvChopPlaneGeometry = new BufferGeometry()
uvChopPlaneGeometry.setIndex([
0,
4,
1,
4,
5,
1,
1,
5,
8.968s message 1 started (0.002s)
jsUtils.ts?158a:39 10.538s store update:0 (1.570s)
jsUtils.ts?158a:39 10.540s gameAction: EnterPlayerAction0 (0.002s)
jsUtils.ts?158a:39 10.541s gameAction: CardInstantiated1 (0.001s)
jsUtils.ts?158a:39 10.542s gameAction: EnterParallelPhases2 (0.001s)
jsUtils.ts?158a:39 10.542s gameAction: EnterPhase3 (0.000s)
jsUtils.ts?158a:39 10.543s gameAction: CardUpdated4 (0.000s)
jsUtils.ts?158a:39 10.543s gameAction: ExitPhase5 (0.000s)
jsUtils.ts?158a:39 10.543s gameAction: ExitParallelPhases6 (0.000s)
jsUtils.ts?158a:39 10.544s gameAction: EnterParallelPhases7 (0.000s)
import {
getUrlFlag,
getUrlFloat,
getUrlInt,
getUrlParam
} from './utils/location'
const asStringUnion = <T extends string>(arr: T[]) => arr
const flags = asStringUnion([
[
{
"type": "player_action",
"action": {
"type": "[player]ATTACK_TOKEN",
"playerID": "BOT-A",
"attackTokenID": "32",
"targetTokenID": "1"
},
"children": [
@corbanbrook
corbanbrook / GeometryUtils.js
Created January 14, 2019 18:29
Old Geometry Merge
merge: function ( geometry1, object2 /* mesh | geometry */ ) {
var matrix, matrixRotation,
vertexOffset = geometry1.vertices.length,
uvPosition = geometry1.faceVertexUvs[ 0 ].length,
geometry2 = object2 instanceof THREE.Mesh ? object2.geometry : object2,
vertices1 = geometry1.vertices,
vertices2 = geometry2.vertices,
faces1 = geometry1.faces,
faces2 = geometry2.faces,
type TaskComputation<A, B> = (
resolve: (value?: A) => void,
reject: (reason?: B) => void
) => void
type SuccessCallback<A> = (a: A) => any
type ErrorCallback<B> = (b: B) => any
type PromiseCreator<A> = () => Promise<A>
const noop = (): any => undefined
ShowsStore = {
shows: new Map(),
getById: function(id) {
return this.shows.get(id)
},
add: function(data) {
this.shows.set(data.id, data)
}
};
+class ProxyObject {
+ _target: Object
+
+ constructor(target) {
+ this.proxy(target)
+
+ Object.keys(target).forEach(key => {
+ Object.defineProperty(this, key, {
+ enumerable: true,
+ configurable: true,