Skip to content

Instantly share code, notes, and snippets.

@catlion
catlion / gist:1875572
Created February 21, 2012 09:58
Great programming quotes SO topic backup
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<link rel="stylesheet" href="http://www.stackprinter.com/stylesheets/export.css"/>
<style type="text/css">
.comment { color: Gray; margin-bottom:4px; }
</style>
</head>
<body>
<div id="home">
@catlion
catlion / netReps.js
Created October 7, 2011 06:13
NTLM authentication check for Firebug
isCorrectNtlm: function(file)
{
var resp = file.responseHeadersText.match(/www-authenticate:\s(.+)/i)[1]; // file.responseHeaders is undefined here
return (resp && resp.search(/ntlm|negotiate/i) >= 0);
},
isError: function(file)
{
if (file.aborted)
return true;
@catlion
catlion / gist:1204396
Created September 8, 2011 19:14
equinox
public static IEnumerable<MessageDetails> Folder(ImapClient ic, string folderName)
{
var selRes = ic.Select(folderName);
if (!selRes.IsOk) {
throw new InvalidOperationException(selRes.ReasonForFailure);
}
return ic.Messages.Where(x => x.Uid >= uidNext).Select(y => new MessageDetails {
From = y.From.FirstOrDefault().ToString(),
Uid = y.Uid,
@catlion
catlion / gist:1148977
Created August 16, 2011 12:40
ClosedXML OutOfMemoryException
private static byte[] ConvertReportToExcel(List<Dictionary<string, object>> report)
{
var file = new XLWorkbook();
var sheet = file.Worksheets.Add("Report");
if (report.Count() == 0) {
sheet.Cell("A1").SetValue("Report is empty");
} else {
// First row filled with keys
var firstRow = report.ElementAt(0);
for (int j = 0; j < firstRow.Count; j++) {