Skip to content

Instantly share code, notes, and snippets.

Avatar

Chun-Fu Chao FrankNine

View GitHub Profile
@FrankNine
FrankNine / UnityStructGen.cpp
Created Mar 21, 2020 — forked from mafaca/UnityStructGen.cpp
Unity 2017.3.0f3 type information
View UnityStructGen.cpp
// 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
//
@FrankNine
FrankNine / twittermute.txt
Last active Jan 25, 2020 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
View twittermute.txt
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@FrankNine
FrankNine / promise_monad.md
Created Aug 17, 2019 — forked from VictorTaelin/promise_monad.md
async/await is just the do-notation of the Promise monad
View promise_monad.md

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

View BlockRotation.cs
using UnityEngine;
public class BlockRotation : MonoBehaviour
{
private bool _isOverlapped;
private void Update()
{
if (Input.GetKeyDown(KeyCode.E) && _isOverlapped)
{
View gist:46a268e66eaa8ad3270697b3a96a928f
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//
// Buffer Definitions:
//
// cbuffer ModelViewProjectionConstantBuffer
// {
//
// float4x4 worldmat; // Offset: 0 Size: 64 [unused]
@FrankNine
FrankNine / .gitattributes
Created Jun 13, 2018 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
View .gitattributes
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
View AddFramework.cs
static void _AddFrameWork(string pathToBuiltProject)
{
string pbxProjectPath = Path.Combine (pathToBuiltProject, "./Unity-iPhone.xcodeproj/project.pbxproj");
PBXProject pbxProject = new PBXProject ();
pbxProject.ReadFromFile (pbxProjectPath);
string targetGUID = pbxProject.TargetGuidByName ("Unity-iPhone");
pbxProject.AddFrameworkToProject (targetGUID, "CoreData.framework", weak:false);
pbxProject.AddFrameworkToProject (targetGUID, "Social.framework", weak:false);
View gist:3971671
function getXMLConfig() : XML
{
var conf = new Config()
var ba:ByteArrayAsset = ByteArrayAsset( conf );
var xml:XML = new XML( ba.readUTFBytes( ba.length ) );
return xml;
}
function create_gallery(e:Event):void