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 { useMemo } from "react"; | |
| import { useSearchParams } from "react-router-dom"; | |
| type ParseConfig = Record< | |
| string, | |
| | { type: "string"; defaultValue?: string } | |
| | { type: "number"; defaultValue?: number } | |
| | { parse: (value: URLSearchParams) => unknown } | |
| >; |
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
| public static class FileComparer | |
| { | |
| public static bool CompareEquals(string filePath1, string filePath2, int bufferSize = 65536) | |
| { | |
| if (filePath1 == filePath2) return true; | |
| var buffer1 = ArrayPool<byte>.Shared.Rent(bufferSize); | |
| var buffer2 = ArrayPool<byte>.Shared.Rent(bufferSize); | |
| try | |
| { |
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
| type ReactiveToVanilla<Obj> = { | |
| [Property in keyof Obj]: | |
| Obj[Property] extends ScalarSignal ? number : | |
| Obj[Property] extends StringSignal ? string : | |
| Obj[Property] extends BoolSignal ? boolean | |
| : any | |
| }; |
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 Scene from 'Scene'; | |
| import FaceTracking from 'FaceTracking'; | |
| import Animation from 'Animation'; | |
| /* | |
| Model structure: | |
| - Model | |
| - skeleton (null) | |
| - Armatures (null objs) | |
| - Petal & pollen (meshes) |
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 { useRef } from 'react'; | |
| const safeDocument: Document = document; | |
| /** | |
| * Usage: | |
| * const [blockScroll, allowScroll] = useScrollBlock(); | |
| */ | |
| export const useScrollBlock = (): [() => void, () => void] => { | |
| const scrollBlocked = useRef(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
| const t = require('Time'); | |
| const D = require('Diagnostics'); | |
| const Scene = require('Scene'); | |
| const objText = Scene.root.find('2dText0'); | |
| let frame = 0; | |
| const round = (val, precision = 1) => { | |
| const multiplier = Math.pow(10, precision || 0); | |
| return Math.round(val * multiplier) / multiplier; |
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
| ////////////////////////////////////////////////////////////////////////// | |
| ////////////////////////////////////////////////////////////////////////// | |
| ////////////////////////////////////////////////////////////////////////// | |
| // Laser Focused | |
| // Ben Ursu | Afrosquared | |
| // Spark AR Studio | |
| // Instagram | https://www.instagram.com/a/r/?effect_id=206763150244323 | |
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
| varying vec2 hdConformedUV; | |
| varying vec2 uv; | |
| uniform sampler2D inputImage; | |
| uniform int passIndex; | |
| uniform vec2 uRenderSize; | |
| uniform float uTime; | |
| float random (in vec2 st) | |
| { | |
| return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123); |
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
| tell application "Unity" to activate -- needs to be in front | |
| tell application "System Events" to tell application process "Unity" | |
| try | |
| get properties of window 1 | |
| set size of window 1 to {1280, 720} | |
| on error errmess | |
| log errmess | |
| -- no window open | |
| end try | |
| end tell |
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
| using UnityEngine.UI; | |
| [RequireComponent(typeof(RectTransform), typeof(LayoutElement))] | |
| [ExecuteInEditMode] | |
| public class LayoutElementFitParent : MonoBehaviour | |
| { | |
| [SerializeField] private float aspectRatio = 1; | |
| [SerializeField] private bool updateMin = false; | |
| [SerializeField] private bool updatePreferred = false; |
NewerOlder