Skip to content

Instantly share code, notes, and snippets.

View FrankNine's full-sized avatar

Chun-Fu Chao FrankNine

View GitHub Profile

你可能其實不懂繼承 - 什麼是 Covariance 跟 Contravariance

在近代高等程式語言快(ㄏㄨˋ)速(ㄒ一ㄤ)演(ㄔㄠ)化(ㄒㄧˊ)的狀況下,很多 strong type 的程式語言都開始有了 generic 的設計, 舉例來說:

(這只是大略分類)

  • Mobile: Swift, Kotlin
  • Frontend: Flowtype, TypeScript
  • 後端語言:Python (pyre), Scala, C#, Java (沒錯!現在連 Java 都有)
@sabresaurus
sabresaurus / ConsoleCallStackHelper.cs
Last active May 2, 2020 09:56
Jump to file/line in the Unity console window callstack via this helper window
// MIT License
//
// Copyright (c) 2018 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@mafaca
mafaca / UnityStructGen.cpp
Last active July 5, 2023 07:14
Unity 2017.3.0f3 type information
// UnityStructGen - Dump the Unity Runtime base type info
// Compile with /MT(d), NOT /MD(d) (i.e. use static-linked runtime)
// Tested with VS2015 x64.
//
// To use:
// Compile Inject.cpp:
// $ cl /O2 /Zi /MT Inject.cpp
// Compile UnityStructGen.cpp:
// $ cl /O2 /Zi /MT /LD UnityStructGen.cpp
//
@valyard
valyard / TestWindow.cs
Created November 6, 2017 01:06
Export current profiler frame to Chrome Trace Event Format
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System;
using System.Text;
using System.IO;
public class TestWindow : EditorWindow
@idbrii
idbrii / botw-cedec2017.md
Last active May 7, 2024 13:54
An inline image version of Matt Walker's translation of CEDEC 2017 talks by Nintendo

本文件主要係提供使用公共運輸整合流通服務平臺(Public Transport Data eXchange)各項資料服務加值業者,在程式開發過程中常見問題的處理方式及資料使用的注意事項,使開發者能更快速地掌握PTX APIs的資料特性,並避免在旅運加值應用上資料運用錯誤。

【平臺使用會員分級說明】

交通部公共運輸整合資訊流通服務平臺會員將分為網站會員及API會員,API會員將細分為一般會員進階會員專案用戶;請詳見下列會員權益說明

更多申請會員FAQ請參閱連結

@VictorTaelin
VictorTaelin / promise_monad.md
Last active May 10, 2024 04:22
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@ByronMayne
ByronMayne / AnimatedComponent.cs
Created May 29, 2017 11:17
The source code behind my Unity tip.
using UnityEngine;
using System.Collections;
// This is not need but I just wanted to make the point clear.
public class AnimatedComponent : MonoBehaviour
{
}
@QXSoftware
QXSoftware / dependency_test.md
Last active March 25, 2024 14:59
资源依赖正确性测试

资源依赖正确性测试

本次测试包含对AssetDatabase.GetDependenciesEditorUtility.CollectDependencies这两个获取资源的依赖资源的 API 的测试,以及对于meta残留对打AssetBundle的影响。

AssetDatabase.GetDependencies

输入资源路径,例如Assets/Material/demo.mat,以路径形式返回该资源依赖的资源列表,例如Assets/Texture/demo.jpg

这个 API 返回的结果是“错误”的,也就是带残留的。比如某个材质,原本的shader引用了4个纹理,然后切换其shader为新的shader使之只引用一个纹理,这时AssetDatabase.GetDependencies返回的结果还是4个纹理。