Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System.Collections;
public class Level {
public Mesh mesh;
private bool drawDebugMesh;
private Path path;
private Face[] faces;
@ircnelson
ircnelson / StateMachine
Created May 25, 2016 03:11 — forked from elandau/StateMachine
Rx based state machine
package com.netflix.experiments.rx;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.Observable.OnSubscribe;
@ircnelson
ircnelson / remove-dotnet-cli-osx
Created December 13, 2016 01:38 — forked from sandrovicente/remove-dotnet-cli-osx
Steps to uninstall a DotNet CLI version on Mac OS X
# delete the dotnet folder under /usr/local/share/dotnet
1. cd /usr/local/share/dotnet && ls
2. sudo rm -rf dotnet
# delete the dotnet reference file at /etc/paths.d/dotnet
1. cd /etc/paths.d && ls
2. sudo rm dotnet
@ircnelson
ircnelson / Program.cs
Created January 12, 2017 12:59 — forked from TerribleDev/Program.cs
parsing args in dotnet core
public static void Main(string[] args)
{
var app = new Microsoft.Extensions.CommandLineUtils.CommandLineApplication();
var catapult = app.Command("catapult", config => {
config.OnExecute(()=>{
config.ShowHelp(); //show help for catapult
return 1; //return error since we didn't do anything
});
config.HelpOption("-? | -h | --help"); //show help on --help
});
@ircnelson
ircnelson / ExecutionResult.cs
Created March 21, 2017 21:17 — forked from vladikk/ExecutionResult.cs
Command execution result object for CQRS based systems
using System;
namespace Example
{
public abstract class ExecutionResult
{
protected ExecutionResult(Guid aggregateId, Guid commandId, DateTime executedOn)
{
AggregateId = aggregateId;
CommandId = commandId;
@ircnelson
ircnelson / person.rs
Last active April 1, 2017 16:14 — forked from anonymous/playground.rs
Rust design struct
#[derive(Debug)]
struct Person {
name: String,
never_change_this: i32,
}
impl Person {
fn new(name: String, never_change_this: i32) -> Person {
Person {
name: name,
never_change_this: never_change_this,
@ircnelson
ircnelson / rust-lifetime-examples.rs
Last active April 6, 2017 14:25 — forked from anonymous/playground.rs
Rust Playground (Lifetime examples)
pub struct TextEditor {
text: String //Private member variable
}
impl TextEditor {
pub fn new() -> TextEditor {
TextEditor{text: String::new()}
}
pub fn add_char(&mut self, ch : char) {
@ircnelson
ircnelson / rust-lifetime-examples-2.rs
Created April 6, 2017 16:29 — forked from anonymous/playground.rs
Rust Lifetime Playground
use std::collections::HashMap;
fn main() {
struct User<'a> {
name: &'a str,
}
impl<'a> User<'a> {
fn new(uname: &'a str, pwd: &'a str) -> User<'a> {
User { name: uname }
@ircnelson
ircnelson / WebApiSimplePatchSample.cs
Created February 19, 2018 16:40 — forked from tugberkugurlu/WebApiSimplePatchSample.cs
ASP.NET Web API Patch Sample.
public class Car {
public int Id { get; set; }
[Required]
[StringLength(20)]
public string Make { get; set; }
[Required]
[StringLength(20)]
using UnityEngine;
public class Grid : MonoBehaviour
{
[SerializeField]
private float size = 1f;
public Vector3 GetNearestPointOnGrid(Vector3 position)
{
position -= transform.position;