Skip to content

Instantly share code, notes, and snippets.

@munr
munr / vs-localization-tools.vb
Created January 10, 2012 21:13
Visual Studio Localization Tools
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports EnvDTE90a
Imports EnvDTE100
Imports System.Diagnostics
Imports System.Resources
Imports System.IO
Imports System.Text.RegularExpressions
@munr
munr / Receiver.cs
Created February 28, 2012 20:37
RabbitMQ Example
// RabbitMQReceiver Console Application
using System;
using DataContracts;
using RabbitMQ.Client;
using RabbitMQ.Client.MessagePatterns;
namespace RabbitMQReceiver
{
internal class Program
@munr
munr / gist:3503540
Created August 28, 2012 20:04
RangeField
public class RangeField<T>
{
private T Start { get; set; }
private T End { get; set; }
public RangeField()
{
Start = default(T);
End = default(T);
}
@munr
munr / gist:4282463
Created December 14, 2012 03:20
Helper class to simplify executing command line applications from C# and retrieving their output.
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using NLog;
namespace CLE
{
/// <summary>
@munr
munr / umbDebugShowTraceBookmarklet.js
Last active December 14, 2015 16:49
Javascript code for bookmarklet to easily add or remove the umbDebugShowTrace querystring used by Umbraco
javascript:var l=window.location.toString();if(l.indexOf("umbDebugShowTrace=true")>=0){window.location=l.replace(/\?umbDebugShowTrace=true/ig,"")}else{window.location=l+"?umbDebugShowTrace=true";}
@munr
munr / UmbracoMacro.cshtml
Created March 27, 2013 18:55
Umbraco - Render .Net User Control (ascx) macro with Razor
@*
Render Umbraco macro from within Razor macro
http://stackoverflow.com/questions/10689284/umbraco-render-net-user-control-ascx-macro-with-razor
Yes, it looks like a server control but it does work from a Razor macro.
The example below is for rendering a Contour form
*@
<umbraco:Macro runat="server" language="cshtml">
@{
var writer = new HtmlTextWriter(Output);
public static class ReflectionExtensions
{
public static T GetCustomAttribute<T>(this PropertyInfo pi)
{
var attrs = pi.GetCustomAttributes(typeof(T), true);
return (T)attrs.FirstOrDefault();
}
public static object GetValue(this PropertyInfo pi, object o)
{
@munr
munr / FormPoster
Last active August 29, 2015 14:15
Class for easily posting JSON or XML Data in C#
public class FormPoster
{
#region Private Variables
private readonly Dictionary<string, Header> m_HeaderList = new Dictionary<string, Header>();
private readonly Dictionary<string, Parameter> m_ParameterList = new Dictionary<string, Parameter>();
private CookieContainer m_CookieContainer = new CookieContainer();
private string m_RawPostData;
#endregion

Keybase proof

I hereby claim:

  • I am munr on github.
  • I am mun (https://keybase.io/mun) on keybase.
  • I have a public key whose fingerprint is 2DB7 CE35 D86B 3C41 3C5D 3114 E509 4B3A 95B5 B4CF

To claim this, I am signing this object: