Skip to content

Instantly share code, notes, and snippets.

@thedillonb
thedillonb / work-queue.ts
Created August 18, 2020 03:01
RXJS Work Queue
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();
}
@thedillonb
thedillonb / gist:79f3d8a538f4a56d4e42b8078e061659
Created June 4, 2018 19:02
Server Sent Events TypeScript Definition
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;
@thedillonb
thedillonb / Food
Created July 2, 2017 01:37
Creat!!
Goes in my tummy
@thedillonb
thedillonb / index.js
Last active April 23, 2017 00:59
NodeJS Graceful shutdown of a HTTP server
'use strict';
const http = require('http');
function addGracefulShutdown(server) {
const oldClose = server.close;
const connections = {};
let shouldDestroy = false;
let connectionId = 0;
function destroy(socket) {
@thedillonb
thedillonb / query.gql
Created February 19, 2017 14:52
GraphQL Introspection Query
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
@thedillonb
thedillonb / frontendDevlopmentBookmarks.md
Created November 28, 2013 04:31 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

Keybase proof

I hereby claim:

  • I am jasondrowley on github.
  • I am jdr (https://keybase.io/jdr) on keybase.
  • I have a public key whose fingerprint is 3C40 D634 61D4 50C6 F557 F4B0 A696 D7DC FAB0 76F7

To claim this, I am signing this object:

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>
@thedillonb
thedillonb / stamp.cs
Created April 1, 2016 01:01
Stamp iOS With Date
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" };