Skip to content

Instantly share code, notes, and snippets.

View zhenlinyang's full-sized avatar

Zhenlin Yang zhenlinyang

View GitHub Profile
@zhenlinyang
zhenlinyang / ExtractZipFile.cs
Created September 27, 2016 05:45 — forked from r2d2rigo/ExtractZipFile.cs
Using SharpZipLib to extract zip files from Unity in a coroutine-friendly way
// This sample function uses SharpZipLib (http://icsharpcode.github.io/SharpZipLib/) to extract
// a zip file without blocking Unity's main thread. Remember to call it with StartCoroutine().
// Byte data is passed so a MemoryStream object is created inside the function to prevent it
// from being reclaimed by the garbage collector.
public IEnumerator ExtractZipFile(byte[] zipFileData, string targetDirectory, int bufferSize = 256 * 1024)
{
Directory.CreateDirectory(targetDirectory);
using (MemoryStream fileStream = new MemoryStream())
@zhenlinyang
zhenlinyang / 0_reuse_code.js
Created August 19, 2016 02:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console