This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
using System.Security.Cryptography; | |
using System.Text; | |
using UnityEngine; | |
public static class SecurePlayerPrefs | |
{ | |
private static readonly string _encryptionKey = DeriveKey(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Security.Cryptography; | |
using System.Text; | |
using UnityEngine; | |
using UnityEngine.Networking; | |
using static UnityEngine.Networking.UnityWebRequest.Result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ExtensionMethods | |
{ | |
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp) | |
{ | |
var tcs = new TaskCompletionSource<object>(); | |
asyncOp.completed += obj => { tcs.SetResult(null); }; | |
return ((Task)tcs.Task).GetAwaiter(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
; CTRL+ALT+SPACE sends a non-breaking space character | |
^!Space::Send {U+00A0} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class EventManager<T> | |
{ | |
private static event Action<T> Event; | |
public static void AddListener(Action<T> handler) => Event += handler; | |
public static void RemoveListener(Action<T> handler) => Event -= handler; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Space Cadet Shift - If the shift key is tapped without being used to uppercase a key then it acts as a curly bracket key instead. | |
~LShift:: | |
KeyWait, LShift | |
If (A_TimeSinceThisHotkey < 150 and A_PriorKey = "LShift") { | |
SendRaw, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) | |
Shader "Standard (Double Sided)" | |
{ | |
Properties | |
{ | |
_Color("Color", Color) = (1,1,1,1) | |
_MainTex("Albedo", 2D) = "white" {} | |
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const blobUrl = URL.createObjectURL(blob); | |
const link = document.createElement('a'); | |
link.href = blobUrl; | |
link.download = fileName; | |
document.body.appendChild(link); | |
// link.click() does not work on the latest Firefox and some modern browsers. | |
link.dispatchEvent( | |
new MouseEvent('click', { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using System.Runtime.Serialization.Formatters.Binary; | |
static public class DeepCloning | |
{ | |
static public T DeepClone<T>(this T source) | |
{ | |
var formatter = new BinaryFormatter(); | |
using var stream = new MemoryStream(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
void Main() | |
{ | |
string foo = "Hello"; | |
// a.then(f).then(g).then(j) | |
foo.Then(x => x.Trim().Ret()) | |
.Then(x => x.Substring(0, 5).Ret()) | |
.Then(x => x.Length.Ret()) |
NewerOlder