Skip to content

Instantly share code, notes, and snippets.

View netgfx's full-sized avatar
💻
Working...

Michael Dobekidis netgfx

💻
Working...
View GitHub Profile
@netgfx
netgfx / logger.ts
Created February 2, 2024 09:15
typescript logger
/* modification of the logger https://github.com/mohitagrawal1305/nextjs-custom-logger/blob/main/helpers/logger.js */
/* typescript and small fix for nextjs usage */
/* use on your layout.tsx or high level provider
* declare global {
* interface Window {
* logger: any;
* }
* }
@netgfx
netgfx / stripe-tax-id-validation.js
Created December 22, 2023 13:31
Stripe TaxID validation function
// code is A.I generated, use with care
function isValidTaxId(taxId, country) {
let regex;
switch (country) {
case 'US':
// US EIN format: 00-0000000
regex = /^(\d{2}-\d{7})$/;
break;
case 'DE':
@netgfx
netgfx / useHLSVideoTexture.js
Created October 11, 2023 07:35
R3F HLS Video texture
import * as THREE from 'three'
import { useEffect, useRef } from 'react'
import { useThree } from '@react-three/fiber'
import { suspend, preload, clear } from 'suspend-react'
import Hls from 'hls.js'
export function useHLSVideoTexture(src, props) {
const { unsuspend, start, crossOrigin, muted, loop, ...rest } = {
unsuspend: 'loadedmetadata',
crossOrigin: 'Anonymous',
@netgfx
netgfx / animation.js
Created October 4, 2023 06:20 — forked from rtpHarry/animation.js
Three.js - play an AnimationAction in reverse. There are a bunch of threads saying this isn't possible but I found a way so I wanted to post it online in a place that people will hopefully stumble upon it.
// The class itself is based on the animation helper class in
// https://github.com/paulmg/ThreeJS-Webpack-ES6-Boilerplate
// but I have changed almost everything except for the class name and the update function.
import * as THREE from 'three';
export default class Animation {
constructor(scene, animations) {
this.scene = scene;
this.animations = animations;
@netgfx
netgfx / gist:6195da08cc46a23951749e0ab53633b3
Created July 31, 2023 13:39
Massively convert FBX files to GTLF on Windows
#!/bin/bash
input_folder="C:\Users\..."
output_folder="C:\Users\..."
for file in "$input_folder"/*; do
if [[ -f "$file" ]]; then
filename=$(basename -- "$file")
extension="${filename##*.}"
filename="${filename%.*}"
@netgfx
netgfx / Main.tsx
Created April 12, 2023 10:12
Framer + Supabase realtime (receiver)
import { ComponentType, useRef, useState } from "react"
import { useEffect } from "react"
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0"
import { randomColor } from "https://framer.com/m/framer/utils.js@^0.9.0"
import * as SupabaseJs from "https://jspm.dev/@supabase/supabase-js@rc"
import _ from "lodash"
// Learn more: https://www.framer.com/docs/guides/overrides/
export const useStore = createStore({
background: "#0099FF",
@netgfx
netgfx / Main.tsx
Created April 12, 2023 10:11
Framer + Supabase realtime (sender)
import { ComponentType, useRef, useState } from "react"
import { useEffect } from "react"
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0"
import { randomColor } from "https://framer.com/m/framer/utils.js@^0.9.0"
import * as SupabaseJs from "https://jspm.dev/@supabase/supabase-js@rc"
import _ from "lodash"
// Learn more: https://www.framer.com/docs/guides/overrides/
export const useStore = createStore({
@netgfx
netgfx / TextWrapper.tsx
Created November 28, 2022 16:57
Framer Text Wrapper
// Welcome to Code in Framer
// Get Started: https://www.framer.com/docs/guides/
import { addPropertyControls, ControlType } from "framer"
import { ScrambleText } from "./ScrambleText.tsx"
/**
* These annotations control how your component sizes
* Learn more: https://www.framer.com/docs/guides/auto-sizing
*
@netgfx
netgfx / ScrambleText.tsx
Created November 28, 2022 16:56
Framer Scramble text
import React from "react"
import { useInterval } from "usehooks-ts"
export const ScrambleText = (props) => {
const { children, size } = props
if (typeof children !== "string")
throw new Error("Children of scramble text must be a single string")
const [scrambledText, setScrambledText] = React.useState(
scrambleText(children.slice(0, size))
@netgfx
netgfx / Main.tsx
Created August 19, 2022 10:22
Framer + Airtable calculate total
export function getTotal(Component): ComponentType {
return (props) => {
const [store, setStore] = globalStore()
useEffect(() => {
var total = 0
var selectedData = []
_.forEach(store.selectedProducts, (item) => {
var filteredArray = _.filter(