Skip to content

Instantly share code, notes, and snippets.

@JoeRobich
JoeRobich / GeometryConverter.cs
Created April 7, 2012 18:43
Abstraction to allow System.Web.Extension JavaScriptConveters to run as JSON.Net JsonConverters.
using System;
using System.Collections.Generic;
using Serialization.Text
namespace Drawing.Geometry
{
public class GeometryConverter : IJsonConverter
{
public object Deserialize(IDictionary<string, object> dictionary, Type type, IJsonSerializer serializer)
{
@JoeRobich
JoeRobich / Visual Studio Dark Style.json
Last active May 7, 2019 22:03
Visual Studio Styles for VS for Mac
{
"name": "Visual Studio Dark",
"version": "1.0.0",
"description": "Reminiscent of Microsoft Visual Studio's default dark colors",
"originator": "Microsoft",
"palette": [
{ "name": "text-white", "value": "#dcdcdc" },
{ "name": "background-black", "value": "#1e1e1e" },
{ "name": "comment-green", "value": "#57a64a" },
@JoeRobich
JoeRobich / keybase.md
Last active February 8, 2017 19:59
keybase.io

Keybase proof

I hereby claim:

  • I am joerobich on github.
  • I am joeyrobichaud (https://keybase.io/joeyrobichaud) on keybase.
  • I have a public key whose fingerprint is E069 C2C9 753A F124 6FC2 D4C5 F34B 212E FEE6 787E

To claim this, I am signing this object:

@JoeRobich
JoeRobich / mxml.rb
Created July 16, 2016 16:24
Attempt at a MXML Lexer for the rouge ruby gem.
# -*- coding: utf-8 -*- #
module Rouge
module Lexers
class MXML < ActionScript
title "MXML"
desc "MXML"
tag 'mxml'
filenames '*.mxml'
mimetypes 'application/xv+xml'
@JoeRobich
JoeRobich / ThingTemplateSelector.cs
Created June 30, 2016 14:21
XAML DataTemplateSelector Example
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace DataTemplates
{
public class ThingTemplateSelector : DataTemplateSelector
{
private readonly Dictionary<Type, Func<DataTemplate>> TemplatesByType;
@JoeRobich
JoeRobich / isNullOrEmpty.as
Created November 12, 2013 19:28
An API I was calling into was returning empty objects in addition to null. I made this helper function to simplify the handling logic.
public static function isNullOrEmpty(object:Object):Boolean
{
if (!object)
return true;
if (object is Array ||
object is IList)
return !object.length;
for (var key:String in object)
@JoeRobich
JoeRobich / CSVReader.as
Last active December 25, 2015 03:29
Asynchronous CSV Reader. Reads CSV file into an array of record objects. If header row exists then objects will have properties named after the headers, otherwise it will generate header names (ex. "A", "B",...,"AA","BB",...). Conforms to RFC4180 (http://tools.ietf.org/html/rfc4180) except that the separator character is now configurable.
package com.thedevstop
{
import flash.events.ErrorEvent;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.utils.setTimeout;
[Event(name="complete", type="flash.events.Event")]
[Event(name="error", type="flash.events.ErrorEvent")]
public class CSVReader extends EventDispatcher
@JoeRobich
JoeRobich / Program.cs
Created July 11, 2013 20:32
Use Linq expressions to test for `null`s in chained member access. For instance `ValidateNotNull(() => person.Address.State);` would return false if `person`, `person.Address`, or `person.Address.State` were `null`.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace TestNullCheckingExpressions
{
class Program
@JoeRobich
JoeRobich / ConfidenceStore.cs
Last active December 16, 2015 07:38
Helpful utility for tracking which item in a group occurs at high enough of a frequency to call the confident item.
public class ConfidenceStore<T> where T : class
{
public event EventHandler<EventArgs<T>> Changed;
private Queue<T> queue;
private int length;
private int threshold;
private T confidentItem;
public ConfidenceStore(int length, int threshold)