Skip to content

Instantly share code, notes, and snippets.

Dillon Buchanan thedillonb

Block or report user

Report or block thedillonb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thedillonb
thedillonb / gist:79f3d8a538f4a56d4e42b8078e061659
Created Jun 4, 2018
Server Sent Events TypeScript Definition
View gist:79f3d8a538f4a56d4e42b8078e061659
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;
View Food
Goes in my tummy
@thedillonb
thedillonb / query.gql
Created Feb 19, 2017
GraphQL Introspection Query
View query.gql
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
View Dwifft.cs
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 Apr 1, 2016
Stamp iOS With Date
View stamp.cs
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" };
@thedillonb
thedillonb / index.js
Last active Apr 23, 2017
NodeJS Graceful shutdown of a HTTP server
View index.js
'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 / permute-characters.js
Last active Aug 30, 2015 — forked from h2non/permute-characters.js
Recursive implementation of string characters permutation covering all possible cases without duplication
View permute-characters.js
/**
* Recursive implementation of string characters permutation
* covering all possible cases without duplication
*/
function permute(str) {
var stack = []
if (str.length === 1) {
return [ str ]
}
@thedillonb
thedillonb / program.fs
Created Jul 26, 2015
A very simple F# example using OWIN
View program.fs
open System
open Owin
open Microsoft.Owin
let doStuff (x:IOwinContext) =
x.Response.StatusCode <- 200
x.Response.WriteAsync "Hello!"
[<EntryPoint>]
let main argv =
@thedillonb
thedillonb / logstash-sentry.rb
Created Jun 26, 2015 — forked from clarkdave/logstash-sentry.rb
(Logstash) Sentry output plugin. Moo
View logstash-sentry.rb
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
You can’t perform that action at this time.