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
html, body { | |
height: 100%; | |
} | |
.reeder-page { | |
min-height: 100%; | |
position: relative; | |
} | |
body { |
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
public static int Fac(int n, Func<int, int> cont) { | |
if (n == 0) return cont(1); | |
return Fac(n - 1, r => cont(n * r)); | |
} |
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
public class MyClass<T> | |
{ | |
public class Nested { } | |
} | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
Console.WriteLine(typeof(MyClass<>).GetNestedType("Nested")); // MyClass<>.Nested |
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
/// <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>(); |
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
// 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: |
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
// 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 = []; |
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
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 |
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
var supportDefineProperty = (function () { | |
var i = 0; | |
var getter = function () { | |
if (i === 0) { | |
throw new Error("Execute too soon."); | |
} | |
return i; | |
}; |
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
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, _); | |
} | |
} | |
} |
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
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) { |