Skip to content

Instantly share code, notes, and snippets.

View patrixr's full-sized avatar
🌱
Slow growth

Patrick R patrixr

🌱
Slow growth
View GitHub Profile
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
// Time varying pixel color
vec3 lightColor = vec3(
clamp(mod(float(iFrame + 50), 100.0) / 100.0, 0.0, 1.0),
clamp(mod(float(iFrame + 100), 100.0) / 100.0, 0.0, 1.0),
clamp(mod(float(iFrame), 100.0) / 100.0, 0.0, 1.0)
);
vec3 pixelColor = vec3(0.0, 1.0, 1.0);
vec2 toLight = vec2(iMouse.x - fragCoord.x, iMouse.y - fragCoord.y);
@patrixr
patrixr / sample.txt
Created September 26, 2021 02:43
Tezos link
I am attesting that this GitHub handle patrixr is linked to the Tezos account tz1WPQ824uvHhzp95sZVRnWPjfgBtLarDgVL for tzprofiles
sig:edsigtiRUPezs6RP74tssQbRFsg5E1VjsCxBV7TEEgpq53EESWPphbsx9fhiy9aLSGfGqJbarPQ2sHeKX3zsBwXiaMiVe2qwS3g
@patrixr
patrixr / testMatrix.ts
Last active August 11, 2021 07:50
Typed Test Matrix
// ---------------------------
// ~ Helpers
// ---------------------------
const capitalize = (s : string) => s.charAt(0).toUpperCase() + s.slice(1);
// ---------------------------
// ~ TYPES
// ---------------------------
@patrixr
patrixr / useAsync.ts
Last active August 4, 2021 07:57
Vue UseAsync
import { onMounted, ref } from 'vue'
type AsyncFunc = () => Promise<any>
type ReturnType<F extends AsyncFunc> = F extends () => Promise<infer R> ? R : any
type UseAsyncOptions = {
lazy?: boolean
}
@patrixr
patrixr / docker-compose.yml
Last active May 25, 2021 08:22
GoodChat Docker Compose
version: "3.9"
services:
goodchat:
image: goodregistry.azurecr.io/goodchat/goodchat:latest
ports:
- "8000:8000"
environment:
- PORT=8000
- GOODCHAT_AUTH_URL=https://api-staging.goodcity.hk/api/v2/auth/goodchat
- DB_HOST=postgres_goodchat
//
// E2E Test Setup
// e2e_helpers.js
//
import { getMainDefinition } from '@apollo/client/utilities'
import { AuthPayload } from '../../lib/typings/goodchat'
import { WebSocketLink } from '@apollo/client/link/ws'
import { promisify } from 'util'
import fetch from 'cross-fetch'
@patrixr
patrixr / matcher.ts
Last active February 3, 2021 07:22
Lodash & Typescript pattern matching
import _, { LoDashStatic } from 'lodash'
type PredicateMethod = (
"has" |
"isEqual" |
"isString" |
"isObject" |
"isArray" |
"isBoolean" |
"isMatch"
import React, { useState } from "react";
// -------------------------
// Typing
// -------------------------
type Maybe<T> = T | null;
type AnyFunction = (...args: any[]) => any;
import React, { useState } from "react";
type Maybe<T> = T | null;
type AnyFunction = (...args: any[]) => any;
type Awaited<T> = T extends { then(onfulfilled: (value: infer U) => any): any }
? U
: T extends { then(...args: any[]): any }
? never
@patrixr
patrixr / lazy.ts
Created January 22, 2021 02:38
Typescript Spec Lazy Vars
import _ from 'lodash'
interface LazyVarEntry<T = any> {
gen : () => T,
val? : T
}
interface LazyCache {
[key: string]: LazyVarEntry[]
}