Skip to content

Instantly share code, notes, and snippets.

@JoeRobich
JoeRobich / json.pegjs
Created April 5, 2013 20:12
Simple incomplete JSON parser written in pegjs
{
function createObject(kvps) {
var object = {};
for (var index = 0; index < kvps.length; index++) {
var value = kvps[index].value;
value = value == undefined ? null : value;
object[kvps[index].key] = value;
}
return object;
}
@JoeRobich
JoeRobich / Program.cs
Created February 4, 2013 22:40
Developer interview problem
void Main()
{
var unsortedNames = GetNames();
var sortedNames = SortNames(unsortedNames);
PrintArray(sortedNames);
}
// Formats and sorts an array of name strings.
// Input: An unordered array of strings in the format '{LastName}, {FirstName}'
// Output: An ordered array of strings in the format '{FirstName} {LastName}'
@JoeRobich
JoeRobich / ProcessRunner.cs
Created January 27, 2013 19:32
Quick stab at an architecture for running processes over data.
public interface IRunProcesses<T>
{
void RegisterProcess(IProcessItems<T> process);
}
public interface IProcessItems<T>
{
void Process(IEnumerable<T> items);
}
@JoeRobich
JoeRobich / KeyValueStore.cs
Created January 15, 2013 22:21
Simple KeyValueStore that I wrote and was unable to use.
public interface IKeyValueStore
{
object this[string key] { get; set; }
}
public static class KeyValueStoreExtensions
{
public static DateTime GetDateTime(this IKeyValueStore store, string key)
{
var val = store[key];
@JoeRobich
JoeRobich / JsFactory.ts
Created October 7, 2012 05:01
Port of AsFac ( https://github.com/thedevstop/asfac ) to TypeScript. Greatly simplified since there is no reflection in TypeScript. Passes no parameters when invoking a constructor and does not perform property injection.
interface ICallback {
(factory:JsFactory, scopeName:string):any;
}
interface ICallbackDictionary {
[name:string]:ICallback;
}
class JsFactory {
static DefaultScopeName = '';
@JoeRobich
JoeRobich / HashMap.as
Created September 14, 2012 04:26
ActionScript IoC
package com.thedevstop.utilities
{
import flash.utils.Dictionary;
public class HashMap extends Dictionary
{
public function get(key:*):*
{
return this[key];
}
@JoeRobich
JoeRobich / Settings.vb
Created August 11, 2011 20:38
The Visual Studio macros for creating a Settings menu/toolbar.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Public Module Settings
Private Const FONT_SIZE_CATEGORY As String = "FontsAndColors"
@JoeRobich
JoeRobich / Vink.tmTheme
Last active September 16, 2015 19:18
Vink for VsCode v0.8
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Vink</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@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);
}
@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"