Skip to content

Instantly share code, notes, and snippets.

View micdenny's full-sized avatar

Michael Denny micdenny

View GitHub Profile
@micdenny
micdenny / BusExtensions.cs
Last active March 19, 2019 17:29
EasyNetQ BusExtensions ConnectionAwaiter
public static class BusExtensions
{
public static Task ConnectionAwaiter(this IBus bus)
{
var cts = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
bus.Advanced.Connected += (s, e) =>
{
cts.TrySetResult(true);
};
#! /usr/bin/env python
import posixpath
import argparse
import urllib
import os
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer
@micdenny
micdenny / MessageService.ts
Last active January 24, 2018 18:23 — forked from KeithGillette/MessageService.ts
Simple AngularJS 1.X TypeScript Message Bus
import * as angular from 'angular';
import { Observable, Subject, Subscription } from '@reactivex/rxjs';
export interface Message {
channel: Function;
content: any;
}
/**
* @description AngularJS service singleton implementing simple publish/subscribe message bus to provide decoupled communication of commands & events
@micdenny
micdenny / iframe-tracker.component.html
Last active March 25, 2024 20:20
How to detect a click event on a cross domain iframe (iframe.tracker)
<div>
<iframe appIframeTracker (iframeClick)="onIframeClick()" src="http://www.google.com"></iframe>
</div>
@micdenny
micdenny / Program.cs
Last active January 5, 2018 16:15
BinaryData: how to manage an optional property using ReadObject
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
using Syroot.BinaryData;
using Syroot.BinaryData.Extensions;
namespace ConsoleApp1
@micdenny
micdenny / super-mario.ino
Created May 5, 2017 20:57
Super Mario theme song w/ piezo buzzer and Arduino!
/*
Arduino Mario Bros Tunes
With Piezo Buzzer and PWM
Connect the positive side of the Buzzer to pin 3,
then the negative side to a 1k ohm resistor. Connect
the other side of the 1 k ohm resistor to
ground(GND) pin on the Arduino.
by: Dipto Pratyaksa
@micdenny
micdenny / star-wars.ino
Last active May 5, 2017 21:00 — forked from eznj/star_wars.ino
Arduino Star Wars Song for Piezo
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
@micdenny
micdenny / ChannelPoolingClientCommandDispatcher.cs
Last active February 14, 2017 13:12
ChannelPoolingClientCommandDispatcher
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using EasyNetQ;
using EasyNetQ.Producer;
using RabbitMQ.Client;
namespace EasyNetQSlowerThanRabbitMQ
{
@micdenny
micdenny / TrackEventOperation.cs
Created December 21, 2016 15:02
Application insights extension to track an event and record the duration of it as a metric associated to the Event
public static class TelemetryClientExtensions
{
public static IOperationHolder<TrackEventOperation> StartEventOperation(this TelemetryClient client, string eventName)
{
return new TrackEventOperationHolder(eventName, client);
}
}
public class TrackEventOperationHolder : IOperationHolder<TrackEventOperation>
{
@micdenny
micdenny / App\Program.cs
Last active December 1, 2016 10:22
EFCore.PsToolsIssue7146
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EFCore.PsToolsIssue7146.App
{
public class Program
{
public static void Main()