Skip to content

Instantly share code, notes, and snippets.

View kthompson's full-sized avatar
😀

Kevin Thompson kthompson

😀
View GitHub Profile
@kthompson
kthompson / SyncCollection.cs
Created February 17, 2011 06:12
SyncCollection
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace Gitty
{
class SyncCollection<T> : ICollection<T>
@kthompson
kthompson / Option.cs
Created February 22, 2011 22:39
Simple Ruby-esque option/hash value passing.
class Option
{
public string Name { get; private set; }
public string Value { get; private set; }
private Option(Expression<Func<string, string>> action)
{
this.Name = ToCommand(action.Parameters[0].Name);
if (this.Name == "klass")
this.Name = "class";
@kthompson
kthompson / synccall.js
Created April 26, 2011 15:57
Javascript Synchronous Caller
function SyncCall(method, errorCallback, successCallback)
{
var complete = false;
var retValue = null;
var errorCall = function(){
retValue = errorCallback();
complete = true;
}
@kthompson
kthompson / Messaging.cs
Created May 26, 2011 21:20
Utilities Module Messaging
using System;
using System.Collections.Generic;
using System.Text;
namespace UtilitiesBase
{
public class MessageEventArgs : EventArgs
{
public MessageEventArgs(object request, Action<object> callback)
{
@kthompson
kthompson / require.js
Created June 28, 2011 00:31
Javascript module implementation.
(function() {
function Module(id) {
this.id = id;
this.exports = {};
this.filename = null;
this.loaded = false;
this.exited = false;
}
@kthompson
kthompson / DoEventsHelper
Created November 11, 2011 17:32
Short-circuiting Application.DoEvents
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Jeter
{
public class DoEventsHelper
{
// Retry once if necessary
bool hasDrivers = false;
for (int i = 1; i <= 2; i++)
{
// Start the service and then we'll wait for drivers to load
using (ServiceController service = new ServiceController("dsvideoserver"))
{
try
{
// Wait for the service to fully start before checking the drivers
@kthompson
kthompson / stacktrace.txt
Created November 15, 2011 00:02
DoEvents FTL Wowzers
DSControlPointS.exe!Jeter.RenderPanelHelper.GenerateBasicSearchPlaybackRenderPanel(Integral.Client.Sources.RenderGroup inputRenderGroup = {Integral.Client.Sources.RenderGroup}) Line 180 C#
DSControlPointS.exe!Jeter.Tasks.QuickReviewTask.RenderOutput(Integral.Client.Sources.ISearch search = {Search[3]: 11:58 PM - 11:59 PM}, Integral.Client.Sources.RenderGroup rg = {Integral.Client.Sources.RenderGroup}, Integral.Client.Sources.UI.IRenderPanel oldRenderPanel = {Integral.Client.Sources.UI.RenderPanel}) Line 336 + 0x8 bytes C#
DSControlPointS.exe!Jeter.Tasks.QuickReviewTask.Search_Completed(object sender = {Search[3]: 11:58 PM - 11:59 PM}, System.ComponentModel.AsyncCompletedEventArgs e = {System.ComponentModel.AsyncCompletedEventArgs}) Line 299 + 0x25 bytes C#
Integral.Client.Sources.dll!Integral.Client.Sources.Search.OnSearchCompleted(object args = {System.ComponentModel.AsyncCompletedEventArgs}) Line 248 + 0x1c bytes C#
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.
private bool DoSearch(SearchParams searchParams)
{
bool success = false;
try
{
if (searchParams.Cameras.Count > 0)
{
ISearch search = new Search();
search.InputStreams.AddRange(searchParams.Cameras);
@kthompson
kthompson / gist:1604161
Created January 13, 2012 01:33
eric's code refactored
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace ConsoleApplication3
{
class Program