Skip to content

Instantly share code, notes, and snippets.

View allfake's full-sized avatar

nut allfake

  • opendream
View GitHub Profile
@allfake
allfake / thai-sort.tsx
Last active February 24, 2023 06:55
thai sorting -> port form java to typescipt
// https://thai-notes.com/notes/sortingthai.html => java to typescript
const SARA_E = 0x0e40;
const SARA_AI_MAIMALAI = 0x0e44;
const MAITAIKHU = 0x0e47;
const THANTHAKHAT = 0x0e4c; // a.k.a. "garan"
export function isLeadingVowel(c: string) {
// Returns true if character is in the range from SARA E to SARA AI MAIMALAI,
// i.e. if the character is a leading vowel
@allfake
allfake / gist:7d9a51362e3305fadd2bf48ee20bec52
Created September 1, 2022 03:39
UNITY auto size ui set max width
// Not work on Awake
private void Start()
{
var rect = gameObject.GetComponent<RectTransform>();
if (rect.rect.width > ScreenSizeHelper.MaxWidth)
{
var height = rect.rect.height;
rect.anchorMin = new Vector2(0.5f, 0.5f);
rect.anchorMax = new Vector2(0.5f, 0.5f);
rect.sizeDelta = new Vector2(ScreenSizeHelper.MaxWidth, height);
@allfake
allfake / USE NVorbis for load audio in UNITY
Last active August 8, 2022 11:59
Best way to load audio (ogg) from file(byte[]) in UNITY
USE NVorbis
https://github.com/NVorbis/NVorbis
https://forum.unity.com/threads/ogg-byte-to-audioclip.1004843/
Why? When use webgl and you want to load data from IndexedDB. [File.ReadAllBytes()]
UnityWebRequestMultimedia.GetAudioClip Request will not work. (Load direct file from Native iOS and android or PC is OK)
People will say that you should use assetbundle or steaming asset.
But i want to download DIRECT FILE FROM INTERNET and save for cache (self cache).
Why i don't use assetbundle? Because i don't want to build asset for EACH platfrom. (switch target is pain)
With direct download give you have only one file for all platfrom. (iOS, Android, Webg, ...)
a84eb4e8-e35a-4370-a72a-8207fd6190d4:3597 MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "DynamicExpresso.Resources.ErrorMessages.resources" was correctly embedded or linked into assembly "DynamicExpresso.Core" at compile time, or that all the satellite assemblies required are loadable and fully signed.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing (System.String fileName) [0x00000] in <00000000000000000000000000000000>:0
Use pipeline
when any commit come to master pileline will build deploy and rsync(atlassian/rsync-deploy:x.x.x) to server
you need to create SSH keys in bitbucket to have Known hosts
-> Repository setting -> SSH keys
Make sure you set [SSH key] in authorized_keys
Exameple of build Vuejs and upload to server
pipelines:
branches:
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
namespace Scripts.Utils
{
public class AutoFadeImage : MonoBehaviour
{
public Image image;
public float fadeTime = 0.25f;
public static class ThaiVowel
{
// Lower level characters
private const int SARA_U = 3640;
private const int SARA_UU = 3641;
private const int PHINTHU = 3642;
// Lower level characters after pullDown
private const int SARA_U_DOWN = 63256;
private const int SARA_UU_DOWN = 63257;
@allfake
allfake / Unity Screen Capture only RectTransform
Last active August 9, 2022 09:37
Unity Canvas - Use screen space Camera
using System.Collections;
using System.IO;
using UnityEngine;
namespace Utils
{
public static class CaptureRect
{
public static IEnumerator Capture(RectTransform rectT, string savePath)
{
มองลองดูจุดนั้นสิ ความฝันของเธออยู่ที่ใด
แหงนมองฟ้าดูความจริง ฉันนั้นยังคงยังยืนยังมองอยู่เหมือยเคย
เจออีกแล้วกับเช้าของวันจันทร์ แรงดึงดูดพาฉันกลับมาที่เดิม
นั่งทานข้าวตอนกลางวัน รสชาตินั้นจืดชืดเหมือนเช่นเคย
ปลายทางนั้นนั้นอยู่ที่ใด จะก่าวไปไหนในเขาวงกตนี่
มีเพียงทางเดียวที่จะพบเจอ คือเธอเริ่มเดินและก้าวออกไป
เผชิญกับเส้นทางหนามนับร้อย เส้นทางโอนเอียง เส้นจะพาเธอเฉียงออกไป
ความเป็นจริง ซึ่งไม่มีความเป็นจริง
ฉันไม่รู้จะเชื่อใคร
ทุกคนบอว่าจริง ไม่มีใครบอกคือจริง
ฉันจะเชื่อสิ่งใด ฉันว่าฉันไม่เชื่อสิ่งใด
ว่ากันว่าไม่ตัวตน ว่าคือมันคือตัวตน
ฉันมองออกไปนอกหน้าต่าง หลังบานนั้นไม่เจอสิ่งใด
เพราะแบบนี้และเพราะแบบนั้นทุกคนเลยพูดว่างั้น
เพราะคิดแบบนี้เพราะทำแบบนั้น ผลมันเลยเหมือนที่เค้าว่า