Skip to content

Instantly share code, notes, and snippets.

html, body {
height: 100%;
}
.reeder-page {
min-height: 100%;
position: relative;
}
body {
public static int Fac(int n, Func<int, int> cont) {
if (n == 0) return cont(1);
return Fac(n - 1, r => cont(n * r));
}
public class MyClass<T>
{
public class Nested { }
}
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine(typeof(MyClass<>).GetNestedType("Nested")); // MyClass<>.Nested
/// <summary>
/// The removing buffer.
/// </summary>
private readonly LinkedList<T> _itemsToAdd = new LinkedList<T>();
private readonly Dictionary<T, LinkedListNode<T>> _itemNodesToAdd = new Dictionary<T, LinkedListNode<T>>();
/// <summary>
/// The adding buffer.
/// </summary>
private readonly HashSet<T> _itemToRemove = new HashSet<T>();
// The code below would print overlapped A and B sequences like:
// ...
// A
// A
// B
// B
// ...
//
// Please add multi-threading protection code to make sure that
// As and Bs are printed in the order of:
// Usage:
// You cannot directly access Resource.state but only in
// the callback provided by Resource.register method.
// The callback would be invoked with a complete function
// when the resource is free to access. Call the function
// when you finish to use the resource to release it.
var Resource = (function () {
var waitingCallbacks = [];
public class LimitConcurrencyLevelScheduler : LocalScheduler
{
private readonly ActionBlock<Action> _actionBlock;
public LimitConcurrencyLevelScheduler(int concurrencyLevel = 0, bool singleProducerConstrained = false)
{
var options = new ExecutionDataflowBlockOptions
{
MaxDegreeOfParallelism = concurrencyLevel <= 0 ? 1 : concurrencyLevel,
SingleProducerConstrained = singleProducerConstrained
var supportDefineProperty = (function () {
var i = 0;
var getter = function () {
if (i === 0) {
throw new Error("Execute too soon.");
}
return i;
};
var bubbleSort = function (array, _) {
for (var i = 0; i < array.length; i++) {
for (var j = 0; j < array.length - i - 1; j++) {
var r = compareAsync(array[j], array[j + 1], _);
if (r > 0) swapAsync(array, j, j + 1, _);
}
}
}
server.getAsync = function (pattern, task) {
server.get(pattern, function (req, res, next) {
task(req, res).addEventListener("complete", function () {
// error would be undefined if everything's fine.
next(this.error);
}).start();
});
}
server.getAsync(":name", eval(Wind.compile("async", function (req, res) {