Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Denny micdenny

View GitHub Profile
@micdenny
micdenny / BusExtensions.cs
Last active Mar 19, 2019
EasyNetQ BusExtensions ConnectionAwaiter
View BusExtensions.cs
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);
};
View Python SimpleHTTPServer: Serve specific directory
#! /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 Jan 24, 2018 — forked from KeithGillette/MessageService.ts
Simple AngularJS 1.X TypeScript Message Bus
View MessageService.ts
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 Sep 29, 2020
How to detect a click event on a cross domain iframe (iframe.tracker)
View iframe-tracker.component.html
<div>
<iframe appIframeTracker (iframeClick)="onIframeClick()" src="http://www.google.com"></iframe>
</div>
@micdenny
micdenny / Program.cs
Last active Jan 5, 2018
BinaryData: how to manage an optional property using ReadObject
View Program.cs
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
Super Mario theme song w/ piezo buzzer and Arduino!
View super-mario.ino
/*
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 — forked from nicksort/star_wars.ino
Arduino Star Wars Song for Piezo
View star-wars.ino
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 Feb 14, 2017
ChannelPoolingClientCommandDispatcher
View ChannelPoolingClientCommandDispatcher.cs
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 Dec 21, 2016
Application insights extension to track an event and record the duration of it as a metric associated to the Event
View TrackEventOperation.cs
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 Dec 1, 2016
EFCore.PsToolsIssue7146
View App\Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EFCore.PsToolsIssue7146.App
{
public class Program
{
public static void Main()
You can’t perform that action at this time.