This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Text; | |
using System.Threading; | |
public class BufferedTraceListener : TraceListener | |
{ | |
private SynchronizationContext context; | |
private StringBuilder buffer; | |
private object bufferLock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data; | |
public class LoggingCommand : IDbCommand | |
{ | |
private static void Log(string message) | |
{ | |
// ... | |
} | |
private IDbCommand @base; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class TwoWayDictionary<T1, T2> : ICollection<Tuple<T1, T2>> | |
{ | |
private static Tuple<T1, T2> ToTuple(T1 item1, T2 item2) | |
{ | |
return Tuple.Create(item1, item2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
public class InterlockedBoolean | |
{ | |
private int value; | |
public bool Value | |
{ | |
get { return Convert.ToBoolean(value); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Formatters.Binary; | |
public static class Base64Extensions | |
{ | |
private static IFormatter GetFormatter() | |
{ | |
return new BinaryFormatter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set cn=%~1 | |
if "%cn%" == "" goto :usage | |
makecert -sv "%cn%.pvk" -n "CN=%cn%" -b 01/01/2000 -e 12/31/2999 -r "%cn%.cer" | |
pvk2pfx -pvk "%cn%.pvk" -spc "%cn%.cer" -pfx "%cn%.pfx" | |
goto :eof | |
:usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel.DataAnnotations; | |
using System.Reflection; | |
public sealed class ConditionalRequiredAttribute : RequiredAttribute | |
{ | |
public override bool RequiresValidationContext | |
{ | |
get { return true; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add("columns", function (editor) { | |
function insert(count) { | |
editor.undoManager.transact(function () { | |
var row = editor.dom.create("div", { "class": "row" }); | |
var width = Math.ceil(12 / count); | |
for (var index = 0; index < count; index++) { | |
var column = editor.dom.add(row, "div", { "class": "col-sm-" + width }); | |
editor.dom.add(column, "p", {}, "Column " + (index + 1)); | |
} | |
var node = editor.selection.getNode(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add("paragraphs", function (editor) { | |
function insert(place) { | |
var body = editor.getBody(); | |
var paragraph = editor.dom.create("p"); | |
place(paragraph, body); | |
editor.selection.setCursorLocation(paragraph); | |
editor.nodeChanged(); | |
} | |
editor.addMenuItem("paragraph", { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add("glyphicons", function (editor) { | |
function insert(name) { | |
editor.insertContent("<span class='glyphicon glyphicon-" + name + "'></span>"); | |
} | |
function getMenuItem(name) { | |
return { | |
text: name, | |
onclick: function () { | |
insert(name); |