Skip to content

Instantly share code, notes, and snippets.

@Acapla
Acapla / random property increase test
Created January 26, 2015 16:51
nothing but a random property increase test
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SomeRandomTest
{
class Program
@Acapla
Acapla / chat_message.py
Last active August 29, 2015 14:02
a message class for chat potentially support hyperlink
import yaml
class Message():
__start_mark = '{'
__end_mark = '}'
__item_tag = 'item'
__order_tag = 'order'
__hyperlink_types = [__order_tag, __item_tag]
public class Queue<T>
{
private readonly ConcurrentQueue<T> _queue = new ConcurrentQueue<T>();
private long _count = 0;
private readonly Action<T> _action = null;
public Queue(Action<T> action)
{
_action = action;
}
public class EventMessage
{
public int What;
public int Arg0;
public int Arg1;
public object Obj1;
public Action<EventMessage> Handler;
}
/// <summary>
@Acapla
Acapla / simpleAwaitableQueue
Created January 22, 2014 07:59
simple awaitable queue
public class AwaitableQueue<T>
{
private readonly ConcurrentQueue<T> _queue = new ConcurrentQueue<T>();
private long _count = 0;
private readonly ConcurrentQueue<TaskCompletionSource<T>> _pending = new ConcurrentQueue<TaskCompletionSource<T>>();
/// <summary>
/// Enqueue the specified item. Blocking operation.
/// </summary>
/// <param name="item">Item.</param>