Skip to content

Instantly share code, notes, and snippets.

View jade-itworkswhy's full-sized avatar
🇰🇷

Jade Park jade-itworkswhy

🇰🇷
View GitHub Profile
@jade-itworkswhy
jade-itworkswhy / array_helpers.ts
Created February 1, 2024 12:47
array_helpers.ts
/**
* Splits an array into chunks of a specified size.
* @param array The array to be chunked.
* @param size The size of each chunk.
* @returns An array of chunks.
*/
export const typedChunkByIndex = <T>(array: T[], size: number): T[][] => {
const chunked: T[][] = []
let index = 0
@jade-itworkswhy
jade-itworkswhy / node_fs_helpers.ts
Created February 1, 2024 12:45
node_fs_helpers
import { existsSync, lstatSync, readdirSync, rmdirSync, unlinkSync } from 'fs'
import path from 'path'
/**
* Clears a directory by deleting all its files and sub-folders recursively.
* @param folderPath - The path of the directory to be cleared.
* @throws Error if the folder does not exist.
*/
export function clearDir(folderPath: string) {
if (existsSync(folderPath)) {
/**
* Interface for fetch options.
*/
interface FetchOptions {
method: 'GET' | 'POST' | 'PUT' | 'DELETE'
headers?: Headers
body?: any
}
/**
<script>
jQuery( function( $ ) {
/*-----------------------------------------------------*/
/*-------------------- ON READY------------------------*/
/*-----------------------------------------------------*/
varying vec3 vPositionW;
varying vec3 vNormalW;
uniform float u_intensity;
void main() {
vec3 color = vec3(.58, .74, 1.);
float fresnelTerm = dot(vPositionW, vNormalW) * (1. - u_intensity/2.);
fresnelTerm = clamp(1.0 - fresnelTerm, 0., 1.);
gl_FragColor = vec4( color * fresnelTerm, 1.) * u_intensity;
Number.prototype.map = function(in_min, in_max, out_min, out_max) {
return ((this - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min
}
#region counting functions
public void TextCountTo (int target, Text text) {
if(countingCoroutine != null)
StopCoroutine("CountTo");
countingCoroutine = StartCoroutine(CountTo(target, text));
}
IEnumerator CountTo (int target, Text countText) {
#region counting functions
public void TextCountTo (int target, Text text) {
if(countingCoroutine != null)
StopCoroutine("CountTo");
countingCoroutine = StartCoroutine(CountTo(target, text));
}
IEnumerator CountTo (int target, Text countText) {
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "doeslab/GrabPassBlur" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_BumpAmt ("Distortion", Range (0,128)) = 10
_MainTex ("Tint Color (RGB)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Size ("Size", Range(0, 20)) = 1
}
Shader "doeslab/VertexColorShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100