Skip to content

Instantly share code, notes, and snippets.

Delivered-To: [email protected]
Received: by 10.224.135.8 with SMTP id l8csp316922qat;
Thu, 19 Jun 2014 03:12:05 -0700 (PDT)
X-Received: by 10.180.37.230 with SMTP id b6mr5037071wik.47.1403172724974;
Thu, 19 Jun 2014 03:12:04 -0700 (PDT)
Return-Path: <[email protected]>
Received: from DUB004-OMC2S17.hotmail.com (dub004-omc2s17.hotmail.com. [157.55.1.156])
by mx.google.com with ESMTPS id ck8si6631066wjc.8.2014.06.19.03.12.04
for <[email protected]>
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
@jstedfast
jstedfast / atomic.patch
Created August 29, 2014 22:40
Atomically read the first token of a line when in the IDLE state
diff --git a/MailKit/Net/Imap/ImapCommand.cs b/MailKit/Net/Imap/ImapCommand.cs
index 3d9f2b6..f6d9160 100644
--- a/MailKit/Net/Imap/ImapCommand.cs
+++ b/MailKit/Net/Imap/ImapCommand.cs
@@ -500,7 +500,7 @@ namespace MailKit.Net.Imap {
try {
Engine.Stream.ReadTimeout = -1;
- token = Engine.ReadToken (idle.LinkedToken);
+ token = Engine.AtomicReadToken (idle.LinkedToken);
It's been about a year in the making for MimeKit and nearly 8 months for MailKit,
but they've finally both 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 on any platform that can run .NET (including mobile platforms) 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.
@jstedfast
jstedfast / charsets.cs
Created February 27, 2015 13:55
Lists available charset encodings for .NET
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Charsets
{
class Program
{
using (var client = new ImapClient ()) {
var inbox = client.Inbox;
client.Connect(_currEmailAccountInfoAcct.Servername, 993, true, _emailCancellationTokenSource.Token);
inbox.Open(FolderAccess.ReadOnly); // this throws NullReferenceException
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate(_currEmailAccountInfoAcct.UserName, _currEmailAccountInfoAcct.Password);
@jstedfast
jstedfast / gist:a0a971cf191699fbd0d2
Created June 12, 2015 19:34
HtmlEntityDecoder.g.cs
// WARNING: This file is auto-generated. DO NOT EDIT!
namespace HtmlKit {
public partial class HtmlEntityDecoder {
bool PushNamedEntity (char c)
{
switch (c) {
case '1':
switch (state) {
case 436: state = 437; break; // &blk -> &blk1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MessageListTableViewCell">
<connections>
<outlet property="FromLabel" destination="7" id="name-outlet-7"/>
<outlet property="SubjectLabel" destination="4" id="name-outlet-4"/>
// WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
using System;
using System.Text;
namespace Blah {
public class Program
{
public static void Main (string[] args)
{
const string base36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ulong value = ulong.MaxValue;
class CustomOrdinalIgnoreCaseComparer : IEqualityComparer<string>
{
static int ToLower (int c)
{
if (c >= 0x41 && c <= 0x5A)
return c + 0x20;
return c;
}