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
import * as rx from 'rxjs'; | |
import { concatMap, onErrorResumeNext, tap } from 'rxjs/operators'; | |
export class WorkQueue<T = unknown> { | |
private queue = new rx.Subject<[rx.Observable<T>, rx.Subscriber<T>]>(); | |
constructor() { | |
this.queue.pipe(concatMap(this.doWork)).subscribe(); | |
} |
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
declare module 'server-sent-events' { | |
import express = require('express'); | |
interface Middleware extends express.RequestHandler {} | |
function MiddlewareFn(): Middleware; | |
export = MiddlewareFn; | |
} | |
declare namespace Express { | |
export interface ISSEResponse { | |
sse(value: string): void; |
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
Goes in my tummy |
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
query IntrospectionQuery { | |
__schema { | |
queryType { | |
name | |
} | |
mutationType { | |
name | |
} | |
subscriptionType { | |
name |
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.Collections.Generic; | |
using System.Linq; | |
using System; | |
using System.Text; | |
public static class ArrayExtensions | |
{ | |
public static Diff<T> Diff<T>(IEnumerable<T> @this, IEnumerable<T> other) | |
where T : IEquatable<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
public static class UIApplicationDelegateExtensions | |
{ | |
/// <summary> | |
/// Record the date this application was installed (or the date that we started recording installation date). | |
/// </summary> | |
public static DateTime StampInstallDate(this UIApplicationDelegate @this, string name) | |
{ | |
try | |
{ | |
var query = new SecRecord(SecKind.GenericPassword) { Service = name, Account = "account" }; |
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
'use strict'; | |
const http = require('http'); | |
function addGracefulShutdown(server) { | |
const oldClose = server.close; | |
const connections = {}; | |
let shouldDestroy = false; | |
let connectionId = 0; | |
function destroy(socket) { |
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
Hello |
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
/** | |
* Recursive implementation of string characters permutation | |
* covering all possible cases without duplication | |
*/ | |
function permute(str) { | |
var stack = [] | |
if (str.length === 1) { | |
return [ str ] | |
} |
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 | |
open Owin | |
open Microsoft.Owin | |
let doStuff (x:IOwinContext) = | |
x.Response.StatusCode <- 200 | |
x.Response.WriteAsync "Hello!" | |
[<EntryPoint>] | |
let main argv = |
NewerOlder