Skip to content

Instantly share code, notes, and snippets.

@jstedfast
jstedfast / gist:1220774
Created September 15, 2011 23:20
email address regex
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
@jstedfast
jstedfast / gist:1227424
Created September 19, 2011 19:57
Storyboard support patch
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
index 3feb9b1..d47aebd 100644
--- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
+++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
@@ -46,6 +46,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
class XcodeMonitor
{
FilePath originalProjectDir;
+ bool updating = false;
int nextHackDir = 0;
tell application "Xcode"
set theProject to first project
set theTarget to first target of theProject
set theBuildPhase to compile sources phase of theTarget
tell first group of theProject
set theFileRef to make new file reference with properties {full path:"/Users/fejj/Projects/XcodeTest/XcodeTest/MyViewController.h", name:"MyViewController.h", path:"XcodeTest/MyViewController.h", path type:group relative}
--add theFileRef to theProject
end tell
tell theBuildPhase to make new build file with properties {build phase:theBuildPhase, name:"MyViewController.h", file reference:theFileRef, target:theTarget, project:theProject}
end tell
@jstedfast
jstedfast / gist:4119319
Created November 20, 2012 17:11
How to run a modal dialog & pump the main loop
IntPtr session = NSApplication.SharedApplication.BeginModalSession (window);
NSRunResponse result = NSRunResponse.Continues;
// Loop until some result other than continues:
while (result == NSRunResponse.Continues) {
using (var pool = new NSAutoreleasePool ()) {
// Run the window modally until there are no events to process:
result = (NSRunResponse) NSApplication.SharedApplication.RunModalSession (session);
// Give the main loop some time:
public static ImageInfo ReadPng (string fileName)
{
int w, h;
if (GetPngImageSize (fileName, out w, out h))
return new ImageInfo { FileName = fileName, Width = w, Height = h };
return new ImageInfo ();
}
public static ImageInfo ReadJpg (string fileName)
@jstedfast
jstedfast / EmailValidator.cs
Created October 7, 2013 21:18
Email address validator
//
// EmailValidator.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013 Xamarin Inc.
//
// 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
@jstedfast
jstedfast / startrek.msg
Created January 14, 2014 14:22
Star Trek email message used in performance testing MimeKit against other .NET MIME parser implementations.
Return-Path: <nsb>
Received: by greenbush.bellcore.com (4.1/4.7)
id <AA12840> for nsb; Thu, 19 Sep 91 12:41:43 EDT
Date: Thu, 19 Sep 91 12:41:43 EDT
From: nsb (Nathaniel Borenstein)
Message-Id: <[email protected]>
To: abel, bianchi, braun, cameron, carmen, jfp, jxr, kraut, lamb, lowery, lynn,
mlittman, nancyg, sau, shoshi, slr, stornett@flash, tkl
Cc: nsb, trina@flash
Subject: Star Trek Party!
@jstedfast
jstedfast / limilabs.txt
Created April 24, 2014 17:49
Email exchange with LimiLabs
On Thu, Apr 24, 2014 at 1:09 PM, Pawel Lesnikowski <[email protected]
> wrote:
> In many places you claim that Mail.dll does not include proper parsing,
>
Where do I make this claim? It says only that MimeKit is faster, which is
true.
diff --git a/MailKit/Net/Imap/ImapFolder.cs b/MailKit/Net/Imap/ImapFolder.cs
index 3de9c2f..9667d2f 100644
--- a/MailKit/Net/Imap/ImapFolder.cs
+++ b/MailKit/Net/Imap/ImapFolder.cs
@@ -2009,7 +2009,8 @@ namespace MailKit.Net.Imap {
if (token.Type != ImapTokenType.OpenParen)
throw ImapEngine.UnexpectedToken (token, false);
- token = engine.ReadToken (ic.CancellationToken);
+ // Note: GMail's IMAP implementation is broken and does not quote strings with square brackets like it should
using System;
using System.IO;
using System.Net;
using System.Linq;
using System.Text;
using System.Threading;
using System.Security.Cryptography;
using MailKit.Net.Imap;
using MailKit.Net.Pop3;