Skip to content

Instantly share code, notes, and snippets.

View b-cancel's full-sized avatar

Bryan Cancel b-cancel

View GitHub Profile
@b-cancel
b-cancel / main.dart
Last active November 29, 2021 19:41
FLUTTER => Overriding Back Button in Flutter
import 'package:flutter/material.dart';
import 'dart:async';
void main() => runApp(new BackButtonOverrideDemoWidget());
class BackButtonOverrideDemoWidget extends StatefulWidget{
@override
_BackButtonOverrideDemoWidgetState createState() => new _BackButtonOverrideDemoWidgetState();
}
@b-cancel
b-cancel / index.html
Last active July 3, 2018 00:24
HTML => Basic HTML Setup File
<html>
<header><title>Setup File</title></header>
<body>
Hello world
</body>
</html>
@b-cancel
b-cancel / Unity3D_euclideanDistance.cs
Last active July 3, 2018 00:24
UNITY 3D => Calculate Euclidean Distance for N-Dimensional Space
static float euclideanDistance(float[] pointA, float[] pointB)
{
if (pointA.Length == pointB.Length)
{
float sum = 0;
for (int dim = 0; dim < pointA.Length; dim++)
sum += Mathf.Pow((pointA[dim] - pointB[dim]), 2);
return Mathf.Sqrt(sum); //distance is always positive
}
else
@b-cancel
b-cancel / Unity3D_character_To_KeyCode.cs
Last active June 17, 2023 15:37
UNITY 3D => Unity Key Codes to Characters (for MOST keys that display a character when pressed)
//NOTE: This is only a DICTIONARY with MOST character to keycode bindings... it is NOT a working cs file
//ITS USEFUL: when you are reading in your control scheme from a file
//NOTE: some characters SHOULD map to multiple keycodes (but this is impossible)
//since this is a dictionary, only 1 character is bound to 1 keycode
//EX: * from the keyboard will be read the same as * from the keypad... because they produce the same character in a text file
Dictionary<char, KeyCode> chartoKeycode = new Dictionary<char, KeyCode>()
{
//-------------------------LOGICAL mappings-------------------------