Skip to content

Instantly share code, notes, and snippets.

View FrankNine's full-sized avatar

Chun-Fu Chao FrankNine

View GitHub Profile
@FrankNine
FrankNine / UnityStructGen.cpp
Created March 21, 2020 12:33 — forked from mafaca/UnityStructGen.cpp
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
//
@FrankNine
FrankNine / twittermute.txt
Last active January 25, 2020 03:07 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
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 August 17, 2019 17:38 — forked from VictorTaelin/promise_monad.md
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

using UnityEngine;
public class BlockRotation : MonoBehaviour
{
private bool _isOverlapped;
private void Update()
{
if (Input.GetKeyDown(KeyCode.E) && _isOverlapped)
{
//
// 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 June 13, 2018 16:31 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## 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
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);
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