Skip to content

Instantly share code, notes, and snippets.

Avatar
🐔
hacking away!

Alex Corrado chkn

🐔
hacking away!
View GitHub Profile
View Extensions.cs
static class Extensions {
#if __IOS__
public static Font ToFont (this UIKit.UIFont font)
{
return Font.OfSize (font.Name, font.PointSize);
}
#endif
}
View ButThisWorks.fsx
open System
open System.Collections.Generic
type Foo() =
let list = List<obj>()
member x.List = list
type Bar() =
let doSomething (foo : Foo) =
let inner() =
View gist:9faa94422d1e90d3d1b0
After about a year in the making for MimeKit and nearly 8 months for MailKit,
they've finally reached 1.0 status.
I started really working on MimeKit about a year ago wanting to give the .NET
community a top-notch MIME parser that could handle anything the real world could
throw at it. I wanted it to run on any platform that can run .NET (including mobile),
and do it with remarkable speed and grace. I wanted to make it such that re-serializing
the message would be a byte-for-byte copy of the original, so that no data would
ever be lost. This was also very important for my last goal, which was to support
S/MIME and PGP.
@chkn
chkn / DI.cs
Last active Aug 29, 2015
A simple stab at a dependency injector
View DI.cs
using System;
using System.Text;
using System.Linq;
using System.Threading;
using System.Reflection;
using System.Collections.Generic;
using System.ComponentModel;
public static class DI {
View monobt.py
import lldb
def monobt(debugger, command, result, dict):
target = debugger.GetSelectedTarget()
process = target.GetProcess()
thread = process.GetSelectedThread()
for frame in thread:
pc = str(frame.GetPCAddress())
if pc[0] == '0':
try:
@chkn
chkn / LocalCache.cs
Last active Dec 21, 2015
Xamarin async gems
View LocalCache.cs
public static class LocalCache {
static HashSet<string> tempKeys = new HashSet<string> ();
public static Task<Stream> GetCachedOrDownload (string key, Uri uri, bool temporary = true)
{
return GetCachedOrDownload (key, uri, CreateNativeHttpClient, temporary);
}
public static Task<Stream> GetCachedOrDownload (string key, Uri uri, Func<HttpClient> createHttpClient, bool temporary = true)
View AndroidExtensions.cs
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Android.OS;
using Android.App;
using Android.Content;
public static class AndroidExtensions {
static BinaryFormatter binaryFormatter;
View JSON.cs
// Now with more love at:
// https://github.com/chkn/JSON.cs/blob/master/JSON.cs
@chkn
chkn / mtouch
Created Apr 15, 2012
Enable IL instrumentation in MonoTouch
View mtouch
#!/bin/bash -e
# This mtouch wrapper adds an argument for a "postcompile" command to be run
# after the managed code is compiled to IL but before it is compiled to native code.
#
# It may be passed as "Additional mtouch arguments" in MD like so:
#
# -postcompile "mono ${SolutionDir}/postcompiler.exe ${TargetPath}"
#
# To use, rename mtouch to mtouch_real and put this script in its place.
@chkn
chkn / JsonReader.cs
Created Aug 12, 2011
Super easy .NET 4 JSON parser
View JsonReader.cs
//
// JsonReader.cs
// Copyright 2011 Alexander Corrado
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to