Skip to content

Instantly share code, notes, and snippets.

View mpsenn's full-sized avatar
🤠

Mike Senn mpsenn

🤠
View GitHub Profile
@mpsenn
mpsenn / postmark-1.6.c
Created December 5, 2014 15:22
postmark modified to remove compile warnings
/*
Written by Jeffrey Katcher under contract to Network Appliance.
Copyright (C) 1997-2001
Network Appliance, Inc.
This code has been successfully compiled and run by Network
Appliance on various platforms, including Solaris 2 on an Ultra-170,
and Windows NT on a Compaq ProLiant. However, this PostMark source
code is distributed under the Artistic License appended to the end
of this file. As such, no support is provided. However, please report
any errors to the author, Jeffrey Katcher <katcher@netapp.com>, or to
using System;
class HashableWeakRef<T> : IEquatable<HashableWeakRef<T>> where T : class
{
private int hash;
private WeakReference weakRef;
public T Target { get { return (T) weakRef.Target; } }
public HashableWeakRef(T target)
/*
* IE 7-9 don't trigger the onchange event when the user uses autocomplete.
* Extend the jQuery change event to fill in that trigger.
*/
(function($) {
// Keep the old change function around for later
var oldchange = $.fn.change;
$.fn.change = function(handler) {
@mpsenn
mpsenn / MulticastTest.js
Last active December 18, 2015 00:49
Determine if a string is an IPv4 or IPv6 multicast or unicast ip address.
// Tests the ipAddress string and returns whether it's unicast or multicast.
function getNetworkMode(ipAddress) {
if(ipAddress.contains(':')) {
// IPv6
if(/^ff\w{2}:/i.test(ipAddress))
return "Multicast";
return "Unicast";
}