Skip to content

Instantly share code, notes, and snippets.

View zcyemi's full-sized avatar
⚗️
Transform code into magic

Zheng Chu zcyemi

⚗️
Transform code into magic
  • ECNU
  • Shanghai
View GitHub Profile
@zcyemi
zcyemi / chaining.cs
Created September 27, 2018 03:31
Method chaining Pattern with generic derivation.C# and Typescript
public class A<T> where T :A<T>{
protected T t;
public T funcA(){
return t;
}
}
public class A:A<A>{
private A(){
@zcyemi
zcyemi / octahedral.shader
Created January 25, 2025 08:06 — forked from pyalot/octahedral.shader
octahedral mapping
#define sectorize(value) step(0.0, (value))*2.0-1.0
#define sum(value) dot(clamp((value), 1.0, 1.0), (value))
#define PI 3.141592653589793
vec2 normalToUvRectOct(vec3 normal){
normal /= sum(abs(normal));
if(normal.y > 0.0){
return normal.xz*0.5+0.5;
}
else{
@zcyemi
zcyemi / pre-commit
Created July 22, 2025 08:45
Git Pre-Commit Hook for filter non UTF-8 encoding.
#!/usr/bin/env bash
#
# .git/hooks/pre-commit
# Prevent committing non–UTF‑8 files, but only for certain extensions
set -e # exit on any error
# Define which file extensions to check (without the leading dot)
EXTENSIONS=(cs)