Skip to content

Instantly share code, notes, and snippets.

Add-Type -AssemblyName presentationframework
[xml]$XAML = @'
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="100" Width="20">
<StackPanel>
<TextBox Name="textWeather" />
<Button Name="buttonGet" Content="Get"/>
@JamesTryand
JamesTryand / IPAddress2IPNumber.sql
Created December 20, 2013 11:28
MSSql Scalar Function that converts an IPAddress to its Numerical equivalent.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: James Tryand
-- Create date: 2013-12-20
-- Description: Converts An IPAddress to it's numerical equivalent
-- =============================================
CREATE FUNCTION IPAddress2IPNumber
apt-get install -y wget build-essential gettext autoconf automake libtool
wget http://download.mono-project.com/sources/mono/mono-3.2.3.tar.bz2
bunzip2 -df mono-3.2.3.tar.bz2
tar -xf mono-3.2.3.tar
cd mono-3.2.3
./configure --prefix=/usr/local; make; make install
rm -rf /tmp/*
apt-get remove --purge wget build-essential gettext autoconf automake libtool
@JamesTryand
JamesTryand / doc.md
Created November 26, 2013 03:35 — forked from anaisbetts/doc.md

File => Attach To Process, pick devenv.exe

First, fix the symbols and shit

.symfix
.reload
.loadby sos clr
@JamesTryand
JamesTryand / gist:7640273
Created November 25, 2013 12:00
C# Immutable Builders
// Basically the important bit is near the bottom
public class MyFancyImmutableObject {
public string FirstValue { get; private set; }
public string SecondValue { get; private set; }
public string ThirdValue { get; private set; }
public string FourthValue { get; private set; }
public MyFancyImmutableObject(string firstValue, string secondValue, string thirdValue,string fourthValue){
FirstValue = firstValue;
public class Server
{
private readonly NetMQContext _context;
private readonly string _id;
public Server(NetMQContext context, string id)
{
_context = context;
_id = id;
}
@JamesTryand
JamesTryand / windowsstatuscodes.ps1
Created October 10, 2013 09:26
Windows Http Status Codes
$windowsHttpCodes = [net.httpstatuscode]|gm -s|?{$_.membertype -eq 'Property'}|select name, @{n='code';e={ iex "[int][net.httpstatuscode]::$($_.Name)" } }
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
// As opposed to magic validation libraries that rely on reflection and attributes,
// applicative validation is pure, total, composable, type-safe, works with immutable types, and it's easy to implement.
public abstract class Result<T> {
private Result() { }
@JamesTryand
JamesTryand / quickstart.cs
Created July 25, 2013 16:56
A quick template to get on with stuff...
class Program
{
public static void L()
{
Console.WriteLine();
}
public static void L(string message)
{
Console.WriteLine(message);
}
@JamesTryand
JamesTryand / BurgerMonkey.cs
Last active December 19, 2015 21:39
Abuse of yield to expose to the statemachine within it.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Reflection;
namespace BurgerMonkey
{
class Program