Skip to content

Instantly share code, notes, and snippets.

// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Unlit/FlashingMaker"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Color (RGBA)", Color) = (1, 1, 1, 1) // add _Color property
}
@MathieuAuclair
MathieuAuclair / set-of-regex-for-tag-catch.cs
Last active May 3, 2019 18:05
Set of regex to catch @tag in a text
RegexDictionary = new Dictionary<string, Regex>
{
{"tests", new Regex("@tests\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"fixed", new Regex("@fixed\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"review", new Regex("@review\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"tested", new Regex("@tested\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"submitassistant", new Regex("@submitassistant\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"releasenotes", new Regex("@releasenotes\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"change", new Regex("@change\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
{"waswarned", new Regex("@waswarned\\((.*?)\\)(.*?)@.*?\\(.*?\\)", option)},
@MathieuAuclair
MathieuAuclair / mock-all-the-things.md
Last active March 19, 2019 16:18
When an object require too much stuff, like instances

Mock all the Goodies things

If you have a variable that requires a context, simply Mock it like this!

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

[TestClass]
class SomeUnitTests
@MathieuAuclair
MathieuAuclair / how-to-create-tests-with-reflexion.md
Last active March 19, 2019 16:08
Testing private members using reflexion

Creating test for private members!

Note that this is not a regular use case. Reflexion should be avoided, and your code structure should always be adapted for tests. Perhaps if you don't have the choice, private properties can still be tested!

let's see an example here with a selfish encapsulated class

public class SelfishClass
{
    private string[] Goodies {get; set;}
@MathieuAuclair
MathieuAuclair / ASCII.js
Created July 20, 2018 07:41
Check if a string is encoded in ASCII with javascript
isAscii("é") //false
function isAscii(str) {
for (var i = 0, strLen = str.length; i < strLen; ++i) {
if (str.charCodeAt(i) > 125) return false;
}
return true;
}
@MathieuAuclair
MathieuAuclair / keybase.md
Last active December 30, 2017 02:18
keybase auth

Keybase proof

I hereby claim:

  • I am MathieuAuclair on github.
  • I am mathieuauclair (https://keybase.io/mathieuauclair) on keybase.
  • I have a public key whose fingerprint is EEB0 97F9 612C C8E1 A9BB D628 D363 9532 E6E2 3FDD

To claim this, I am signing this object: