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.Concurrent; | |
using System.Net; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Alchemy; | |
using Alchemy.Classes; | |
namespace WebSocketsDemo { | |
class WSServer { |
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
{# parent template for every standard (non-pjax) requests #} | |
(...) | |
<link href="{{ res }}/css/nprogress.css" rel="stylesheet" media="screen" /> | |
<script src="{{ res }}/js/jquery-2.1.0.min.js"></script> | |
<script src="{{ res }}/js/jquery.pjax.js"></script> | |
<script src="{{ res }}/js/nprogress.js"></script> |
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
open System.Threading | |
let workThenWait() = | |
async { | |
do! Async.Sleep(1000) | |
printfn "work done" | |
} | |
let demo() = | |
printfn "started" |
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
let joinseq seq1 seq2 = | |
seq { | |
yield! seq1 | |
yield! seq2 | |
} |
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
type CounterMessage = | |
| Update of float | |
| Reset | |
let inbox = MailboxProcessor.Start(fun agent -> | |
// Function that implements the body of the agent | |
let rec loop sum count = async { | |
// Asynchronously wait for the next message | |
let! msg = agent.Receive() | |
match msg with |
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
module Lexer | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
type Register = | |
| A // 8 bits | |
| B // 8 bits | |
| D // 16 bits (A + B) |
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.Tasks; | |
namespace AsyncAwaitTest { | |
class Program { | |
async static void DoIt() { | |
Console.WriteLine("Enter DoIt!"); | |
await Task.Delay(2000); | |
Console.WriteLine("DoIt has ended!"); |
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.Generic; | |
using System.Linq; | |
namespace KobInjector { | |
/// <summary> | |
/// Simple Exeption to be thrown if a paramter cannot be resolved, it displays the whole injection stack | |
/// </summary> | |
public class InjectionStackException : Exception { |
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 url = 'http://cert.europa.eu/cert/filteredition/en/CERT-LatestNews.html?&printpreview=all'; | |
var querySelector = 'a'; // All 'a' HTML elements (could be any selector) | |
var page = require('webpage').create(); | |
page.open(url, function (status) { | |
if(status === 'fail') { | |
console.log("ERROR"); | |
} else { |
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.Linq; | |
namespace GroupbyTimespan { | |
class Program { | |
static void Main(string[] args) { | |
DateTime[] dateTimes = new[]{ | |
new DateTime(2010, 8, 24, 0, 5, 0), | |
new DateTime(2010, 8, 24, 0, 10, 0), |
OlderNewer