Skip to content

Instantly share code, notes, and snippets.

public class UdpTraceListener : TraceListener
{
// For 3.5/2 you can use a List but the class is no longer thread safe.
//private Stack<string> _messageBuffer;
private UdpClient _udpClient;
private ConcurrentStack<string> _messageBuffer;
private string _loggerName;
private static readonly string _xmlPrefix = "log4j";
local MAJOR, MINOR = "LibAddonMenu-1.0", 7
local lam, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not lam then return end --the same or newer version of this lib is already loaded into memory
--UPVALUES--
lam.lastAddedControl = {}
local lastAddedControl = lam.lastAddedControl
local wm = GetWindowManager()
local strformat = string.format
local tostring = tostring
public static class DictionaryExtensions
{
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key)
{
return dictionary.GetValueOrDefault(key, x=>default(TValue));
}
public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key,
Func<TKey, TValue> func)
{
@wilson0x4d
wilson0x4d / gist:d01a1459c7709be66cc0
Created May 16, 2015 01:38
JS helpers for consistent callback behavior
// helpers for consistent callback behavior
__nop = function (err) { if (err) alert(err); };
__cbfix = function (cb) {
// for example: cb = __cbfix(cb);
return typeof (cb) !== 'function'
? __nop
: cb;
};
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace CanwriteReadOnlyReflection
{
[TestClass]
public class UnitTest1
{
public class TargetType
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.FSharp.Core;
namespace CanUseFsharpOptionFromCsharp
{
[TestClass]
public class CanUseFsharpOptionFromCsharp
{
[TestMethod]
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
namespace LookingGlass
{
class Program
{
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@wilson0x4d
wilson0x4d / gist:5506778
Created May 3, 2013 02:14
Here is the code for "PS3 Emulator" from "http://hackingnation.org/ps3-emulator/" ~ Yes, it's fake. Yes, the "update" is a malware pushing, cardjacking website.
[DesignerGenerated]
public class Form1 : Form
{
// Fields
[AccessedThroughProperty("AboutToolStripMenuItem")]
private ToolStripMenuItem _AboutToolStripMenuItem;
[AccessedThroughProperty("AudioToolStripMenuItem")]
private ToolStripMenuItem _AudioToolStripMenuItem;
[AccessedThroughProperty("CloseToolStripMenuItem")]
private ToolStripMenuItem _CloseToolStripMenuItem;
using System;
using System.Diagnostics.Contracts;
using System.Linq;
namespace Merkator.Tools
{
public class ArrayHelpers
{
public static T[] ConcatArrays<T>(params T[][] arrays)
{