This file contains 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
//Pipe definition: | |
Object.defineProperty(Object.prototype, 'pipe',{ | |
value: function(...f){ return f.reduce((val, fun) => fun(val), this)}, | |
writable: true, | |
configurable: true, | |
enumerable: false | |
}); | |
//Easier logging to console: | |
log = console.log; |
This file contains 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
createArray = (x, y, fill = 0) => { | |
for (var ary = []; ary.push(Array(x).fill(fill)) < y;); | |
return ary; | |
} | |
board = createArray(10, 10, 3); | |
display = (ary = board) => console.table(ary) // function that draws the board in the console | |
has4 = (ary) => ary.filter(x => x >= 4).length > 0 // Is there a 4 or more in 1 dimensional array? | |
Has4 = (ary = board) => ary.filter((x) => has4(x)).length > 0 // Is there a 4 or more in 2 dimensional array? | |
split = () => { | |
let board2 = createArray(10, 10); |
This file contains 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 UnityEditor; | |
using UnityEngine; | |
public class ScreenCaptureEditor : EditorWindow | |
{ | |
private static string directory = "Screenshots/Capture/"; | |
private static string latestScreenshotPath = ""; | |
private bool initDone = false; |
This file contains 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
// Create a bew branch and move there | |
git checkout -b feature/myAwesomeFunctionality develop | |
// ... Implement the feature, add, commit, as normal | |
// push changes | |
git push --set-upstream origin feature/myAwesomeFunctionality |
This file contains 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 UnityEngine; | |
using UnityEngine.UI; | |
[RequireComponent(typeof(AspectRatioFitter))] | |
[RequireComponent(typeof(RectTransform))] | |
[ExecuteInEditMode] | |
public class WorkingAspectRatioFitter : MonoBehaviour | |
{ | |
AspectRatioFitter aspectRatioFitter; | |
RectTransform rectTransform; |
This file contains 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 UnityEngine; | |
using UnityEngine.UI; | |
/// <summary> | |
/// Use a number of cells and columns instead of cell width and height | |
/// </summary> | |
[RequireComponent(typeof(GridLayoutGroup))] | |
[ExecuteInEditMode] | |
public class GridLayoutGroupCells : MonoBehaviour | |
{ |
This file contains 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 UnityEngine; | |
public static class SingletonInitializer | |
{ | |
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] | |
static void InitializeSingletons() | |
{ | |
var singletons = Resources.Load<GameObject>("SINGLETONS"); | |
Object.DontDestroyOnLoad(Object.Instantiate(singletons)); | |
} |