Skip to content

Instantly share code, notes, and snippets.

@alexshen
alexshen / Promise.cs
Created August 18, 2018 03:21
A simple promise implementation
using System;
using System.Collections.Generic;
public delegate void ProducerDelegate<T>(Action<T> resolve, Action<Exception> reject);
public class Promise<T>
{
private T m_result;
private Exception m_error;
private bool m_fufilled;
@alexshen
alexshen / CustomInputModule.cs
Last active August 30, 2017 11:50
A simple pinch event input module for Unity
#define DEBUG_PINCH
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
public abstract class PinchEventData : BaseEventData
#! /usr/bin/env python
'''
This simple script can build a ttf with specified character subsets from a file.
The script utilizes fontforge, so it must be available on the system.
'''
import fontforge
import argparse
import codecs
#include <xmmintrin.h>
#include <chrono>
#include <iostream>
#include <iomanip>
using namespace std;
using namespace chrono;
#ifdef _MSC_VER
__declspec(align(16)) struct matrix44
#else
#include <xmmintrin.h>
#include <chrono>
#include <iostream>
using namespace std;
using namespace chrono;
#ifdef _MSC_VER
__declspec(align(16)) struct vector4
#else
struct alignas(16) vector4
#! /usr/bin/lua
--[[
A simple coroutine manager inspired by Unity and the example in <<Python Essential Reference>>.
--]]
--for debugging coroutine in ZeroBrane
--require('mobdebug').coro()
__call_mt = {}