Skip to content

Instantly share code, notes, and snippets.

View pedrohugorm's full-sized avatar

Pedro Matos pedrohugorm

View GitHub Profile
@boca
boca / crgp01 - product.cs
Created September 29, 2016 19:48
The Curiosly Recursive Generic Pattern
void Main()
{}
public class Manufacturer
{
public Manufacturer(string id, string name) {Id = id;Name = name;}
public string Id { get; set; }
public string Name { get; set; }
}
@boca
boca / monad01 - unit.cs
Created September 29, 2016 20:39
Monads!
void Main()
{
"Hello".Unit().Dump();
5.Unit().Dump();
DateTime.Today.Unit().Dump();
new List<char> { 'a', 'b' }.Unit().Dump();
(3 * 1.5).Unit().Dump();
}
public class Identity<T>
@brihernandez
brihernandez / FloatingOrigin.cs
Last active April 29, 2024 16:04
Floating origin to handle large worlds in Unity.
// Based on the Unity Wiki FloatingOrigin script by Peter Stirling
// URL: http://wiki.unity3d.com/index.php/Floating_Origin
using UnityEngine;
using UnityEngine.SceneManagement;
public class FloatingOrigin : MonoBehaviour
{
[Tooltip("Point of reference from which to check the distance to origin.")]
public Transform ReferenceObject = null;