Skip to content

Instantly share code, notes, and snippets.

@huseyint
huseyint / comaprison.cs
Created June 15, 2011 06:41 — forked from jakcharlton/comaprison.cs
Property equality comparison on two objects
// Shamelessly stolen and adapted from http://stackoverflow.com/questions/506096/comparing-object-properties-in-c
public static class Comparisons
{
public static bool PublicInstancePropertiesEqual<T>(this T self, T to, params string[] ignore) where T : class
{
if (self != null && to != null)
{
var type = typeof(T);
foreach (var propertyName in type.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).Select(pi => pi.Name).Except(ignore))
{
@kiwidev
kiwidev / ExceptionWrappingSynchronizationContext.cs
Created October 26, 2012 10:53
SynchronizationContext that allows for catching and dealing with unhandled exceptions. Very useful in WinRT.
using System;
using System.Threading;
namespace TestExceptions
{
/// <summary>
/// Wrapper around a standard synchronization context, that catches any unhandled exceptions.
/// Acts as a facade passing calls to the original SynchronizationContext
/// </summary>
/// <example>
var toast = ToastContentFactory.CreateToastText02();
var item = x.First();
toast.TextHeading.Text = item.Subject.Type;
toast.TextBodyWrap.Text = "DO IT";
toast.Lang = "en_US";
toast.BaseUri = "http://google.com";
toast.Duration = BoxKite.Notifications.ToastDuration.Long;
toast.StrictValidation = false;
@webframp
webframp / keybase.md
Created July 25, 2017 18:14
Signing git commits on github using keybase.io gpg key

Probably one of the easiest things you'll ever do with gpg

Install Keybase: https://keybase.io/download and Ensure the keybase cli is in your PATH

First get the public key

keybase pgp export | gpg --import

Next get the private key