Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / CsGuard.cs
Created March 13, 2014 14:03
Port of AsGuard to C#.
using System;
using System.Collections.Generic;
namespace TheDevStop.CsGuard
{
public class Contracts
{
public enum Kind
{
PreCondition,
@JoeRobich
JoeRobich / UITask.cs
Last active August 29, 2015 14:01
Class to simplify running tasks on the UI thread.
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;
namespace TheDevStop.Mobile.Framework
{
public class UITask
{
static readonly CoreDispatcher _dispatcher;
@JoeRobich
JoeRobich / Func.cs
Created June 20, 2014 19:35
Methods that allow partial application of arguments to a function.
public class Func
{
//Two Params
public static Func<T2, TR> Apply<T1, T2, TR>(Func<T1, T2, TR> func, T1 arg1)
{
return (arg2) => func(arg1, arg2);
}
//Three Params
public static Func<T2, T3, TR> Apply<T1, T2, T3, TR>(Func<T1, T2, T3, TR> func, T1 arg1)
@JoeRobich
JoeRobich / HipChatAppendFix.js
Created July 24, 2014 16:29
This is a GreaseMonkey script that fixes HipChat's annoying behavior of breaking up multiple consecutive chats into different chat blocks.
// ==UserScript==
// @name       HipChat append fix
// @namespace  http://joeyrobichaud.com/
// @version    0.1
// @description  Sending multiple messages in a row will create multiple chat blocks even though you are the sender of each of them. this fixes that.
// @match      https://*.hipchat.com/chat
// @copyright  2014+, Joey Robichaud
// ==/UserScript==
window.addEventListener("load", function(e) {
@JoeRobich
JoeRobich / jsFaddle.html
Last active August 29, 2015 14:05
jsFaddle Bookmark
data:text/html,<title>jsFaddle</title><link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.min.css"/><link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/theme/vibrant-ink.css"/><link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/hint/show-hint.css"/><link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/lint/lint.css"/><script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/codemirror.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/hint/show-hint.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/hint/anyword-hint.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/hint/xml-hint.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/codemirror/4.4.0/addon/hint/html-hint.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/cod
@JoeRobich
JoeRobich / VInkStyle.json
Last active August 29, 2015 14:08
The Vink theme is a modified WikiRoad Ink theme for Xamarin Studio/MonoDevelop.
{
"name": "VInk",
"version": "1.0",
"description": "The Vink theme is a modified WikiRoad Ink theme.",
"originator": "Joey Robichaud <[email protected]>",
"palette": [
{ "name": "comment", "value": "#808080" },
{ "name": "keyword", "value": "#CC7832" },
{ "name": "type", "value": "#FFC66A" },
{ "name": "interface", "value": "#6897BB" },
@JoeRobich
JoeRobich / MainWindow.mxml
Created March 4, 2015 23:37
WPF AttachedProperty to show the on-screen keyboard when the control get focused by touch then hide it when the control loses focus. Code in this Gist is MIT Licensed.
<Window x:Class="TouchKeyboardTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TouchKeyboardTest"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Touch Keyboard Test"
@JoeRobich
JoeRobich / DarkCodeForHipChatBeta
Last active August 29, 2015 14:16
DarkCode Stylish script to for the new HipChat Beta redesign
@-moz-document domain("hipchat.com") {
.date-divider {
margin: 0;
text-align: left;
color: #fff;
}
.date-block {
width: calc(100% - 10px);
}