Skip to content

Instantly share code, notes, and snippets.

View jakesays-old's full-sized avatar

Big Jake jakesays-old

View GitHub Profile
struct Bar
{
public ushort One;
public ushort Two;
}
class Foo
{
private Bar _thing;
using System.IO;
using System.Net;
using System.Reflection;
using JetBrains.Annotations;
namespace Foo.Utility.Process
{
public static class ProcessHelpers
{
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_card {
position: absolute;
width: 300px;
height: 300px;
using System;
using System.Threading;
namespace Models.Common.Internal
{
public class ReadOnlyState
{
public bool IsReadOnly { get; set; }
}
@jakesays-old
jakesays-old / gist:ad521c9af8650f3b39d0
Created August 27, 2014 14:50
DateTime abstraction
using System;
using System.Diagnostics;
using Apex.Utility.Internal;
namespace Utility
{
/// <summary>
/// The SystemTime class provides a simple abstraction over DateTime.Now.
/// It uses a time provider to generate the current time. The default
@jakesays-old
jakesays-old / gist:9107987b882a3a3933e2
Created September 6, 2014 18:43
Using IKVM.Reflection to obtain an assembly's version
private static string GetVersionFromAssembly(byte[] fileData, string fileName)
{
var reflector = new Universe();
AssemblyName name = null;
using (var fileStream = new MemoryStream(fileData))
{
var module = reflector.OpenRawModule(fileStream, fileName);
if (module == null)
{
internal enum PacketSignature : uint
{
Valid = 0x42424242,
Failover = 0x43434343
}
[StructLayout(LayoutKind.Sequential)]
internal struct MessagePacketHeader
{
@jakesays-old
jakesays-old / AppSettings.cs
Created October 20, 2014 23:52
Simple app settings class
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Windows;
using System.Windows.Media;
using FirstFloor.ModernUI.Presentation;
@jakesays-old
jakesays-old / Base36.cs
Created November 5, 2014 02:03
Base 36 Conversion Methods
using System;
namespace Frob.Utility
{
public static class Base36
{
private static readonly char[] _digits =
{
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E',
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
@jakesays-old
jakesays-old / frob.cs
Last active August 29, 2015 14:11
Pattern matching in c#
ParseClaimIdentifiers(@ref, claim)
.Match(ReferenceQualifier.SpecialPaymentReferenceNumber,
r => claim.ServiceAuthExceptionCode = ServiceAuthExceptionCodeConverter.FromAnsi(r).Adapt())
.Match(ReferenceQualifier.OriginalReferenceNumber,
r => claim.OriginalPayerClaimControlNumber = r)
.Match(ReferenceQualifier.ReferralNumber,
r => claim.ReferralNumber = r)
.Match(ReferenceQualifier.PriorAuthorizationNumber,
r => claim.PriorAuthorization = r)
.Match(ReferenceQualifier.RepricedClaimReferenceNumber,