Skip to content

Instantly share code, notes, and snippets.

View bitinn's full-sized avatar
🔜
Personal Project

David Frank bitinn

🔜
Personal Project
View GitHub Profile
@bitinn
bitinn / .a-unity-git-config.md
Last active March 18, 2024 00:08
My Unity git config
@bitinn
bitinn / pre-commit
Last active February 2, 2024 12:35
pre-commit hook to prevent large file on git commit (and allow git-lfs tracked binary files to pass through)
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
# Redirect output to stderr.
@bitinn
bitinn / bitinn.py
Last active January 11, 2024 01:36
Blender keymap for busy Maya / Unity / Substance Designer users
# version: 1.0.1
# latest source: https://gist.github.com/bitinn/22f6fefe026d8d9e83468864edb8f835
import bpy
import os
def kmi_props_setattr(kmi_props, attr, value):
try:
setattr(kmi_props, attr, value)
@bitinn
bitinn / README.md
Last active September 21, 2023 20:36
A soft-fullscreen prompt for iOS7+

A soft-fullscreen prompt for iOS7+

Background

iOS 7.0 and iOS 8 (Beta) do not have support for minimal-ui viewport keyword, nor do they response to window.slideTo(0,1) or support Fullscreen API, which means there is no easy way to tell Mobile Safari to hide address bar/menu without user interaction.

This is a problem for Web App that mimics Native App design, where html/body are commonly set to height: 100%, so browser viewport = available screen estate. There are currently no solution besides adding apple-mobile-web-app-capable meta and ask users to manually Save to Homescreen.

Frustrated by this limit, we present a soft-fullscreen prompt design, which, coupled with proper CSS hack, can achieve soft-fullscreen with relatively small effort from users.

@bitinn
bitinn / MainLightDataNode.cs
Last active August 11, 2023 08:15 — forked from ciro-unity/MainLightNode.cs
A custom node for Unity's ShaderGraph to capture lighting and use it into the shader. Works as of Dec 2018, but the APIs might change!
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
// IMPORTANT:
// - tested with LWRP and Shader Graph 4.6.0-preview ONLY
// - likely to break in SG 5.x and beyond
// - for HDRP, add your own keyword to detect environment
[Title("Custom", "Main Light Data")]
@bitinn
bitinn / note-on-osx-pingfang.md
Last active November 3, 2022 13:47
A few notes on using OS X 10.11 (El Capitan)'s new Chinese font: PingFang (苹方/萍方).

What's this about?

OS X 10.11, aka El Capitan, comes with a new system font for Chinese users, named PingFang, it includes 6 weights for both Simplified and Traditional Chinese. The same font also appear on iOS 9 as the default UI font, though Apple didn't mention it explicitly.

How to get it?

If you are in Apple Developer Program (costs 99 USD a year), then you can get them now at their developer resource site, otherwise you can wait for their public beta to come out in July or wait for the public release this fall (a free upgrade like previous release).

Or you can get PingFang.ttc from your developer friends, though you are probably violating its font license one way or another, but I am not a lawyer so freedom to you.

@bitinn
bitinn / finder-tab-restore.applescript
Created January 2, 2019 07:05
restore finder tabs after close
tell application "Finder"
activate
-- Get current user's name
tell application "System Events"
set currentUser to (name of current user)
end tell
-- for cleanliness
close every window
@bitinn
bitinn / README.md
Created January 13, 2015 16:31
深圳电信,DNS测速,namebench 2015-01-14

https://code.google.com/p/namebench/

基于我自身浏览习惯+深圳电信线路的namebench测试,整合了以下公共DNS列表的测试结果:

个人结论是:无论使用国内还是国外的DNS,都在解析网站时受到相当的干扰,如果不是劫持和黑洞,就是纯粹的丢包超时。只有在用户端设好工具,所有海外DNS请求走加密通道,才可以杜绝触发黑洞和过滤。在用户端想办法过滤虚假的DNS结果也可行,但并不能真正解决超时的使用问题。

@bitinn
bitinn / LWRPCustomCameraEditor.cs
Created November 16, 2018 03:48
Why doesn't LWRPCustomCameraEditor add a label?
using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering.LightweightPipeline;
using UnityEditor.Experimental.Rendering.LightweightPipeline;
//[CustomEditor(typeof(Camera))]
[CustomEditorForRenderPipeline(typeof(Camera), typeof(LightweightRenderPipelineAsset))]
//public class LWRPCustomCameraEditor : Editor {
public class LWRPCustomCameraEditor : CameraEditor {
@bitinn
bitinn / depth.shader
Created May 16, 2018 04:01
depth.shader
Shader "Hidden/BeginHQ/FogMachine" {
HLSLINCLUDE
#include "PostProcessing/Shaders/StdLib.hlsl"
/* effect parameters */
TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
TEXTURE2D_SAMPLER2D(_CameraDepthTexture, sampler_CameraDepthTexture);