(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // Sample generation: | |
| // | |
| // Types in assembly: MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null | |
| // Generated 01/28/2013 13:11:37 | |
| // | |
| module myInterfaces { | |
| // | |
| // Type: MyAssembly.Models.Client | |
| // |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| public static IEnumerable<Tuple<double, double>> LargestTriangleThreeBuckets(List<Tuple<double, double>> data, int threshold) | |
| { | |
| int dataLength = data.Count; | |
| if (threshold >= dataLength || threshold == 0) | |
| return data; // Nothing to do | |
| List<Tuple<double, double>> sampled = new List<Tuple<double, double>>(threshold); | |
| // Bucket size. Leave room for start and end data points | |
| double every = (double)(dataLength - 2) / (threshold - 2); |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Http; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace Knapcode.Http.Handlers | |
| { |
Unity has built-in support for hotswapping, which is a huge productivity booster. This feature works not only with graphics assets like bitmaps and meshes, but also with code: if you edit the source and save it, the editor will save the state of the running game, compile and load the new code, then load the saved state and continue where it left off. Unfortunately, this feature is very easy to break, and most available 3rd party plugins have little regard for it.
It looks like there’s a lot of confusion about hotswapping in Unity, and many developers are not even aware of its existence – which is no wonder if their only experience is seeing lots of errors on the console when they forget to stop the game before recompiling... This document is an attempt to clear up some of this confusion.
Nota bene, I’m not a Unity developer, so everything below is based on blog posts and experimentation. Corrections are most welcome!
| #if UNITY_EDITOR | |
| using UnityEditor; | |
| using UnityEditor.Callbacks; | |
| #endif | |
| using System; | |
| using System.Linq; | |
| using UnityEngine; | |
| using S = UnityEngine.SerializeField; | |
| /// <summary> |
| using UnityEngine; | |
| using MoonSharp.Interpreter; | |
| using System; | |
| /// <summary> | |
| /// These are custom converters for Vector2 and Vector3 structs. | |
| /// | |
| /// Add the following call to your code: | |
| /// LuaCustomConverters.RegisterAll(); | |
| /// |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
| Shader "Name" { | |
| Properties { | |
| _Name ("display name", Range (min, max)) = number | |
| _Name ("display name", Float) = number | |
| _Name ("display name", Int) = number | |
| _Name ("display name", Color) = (number,number,number,number) | |
| _Name ("display name", Vector) = (number,number,number,number) |