Skip to content

Instantly share code, notes, and snippets.

View mscharley's full-sized avatar

Matthew Scharley mscharley

View GitHub Profile
@mscharley
mscharley / loadSchemas.js
Created September 10, 2021 14:35
Simple merging algorithm for multiple GraphQL schema files into AppSync
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
// ==UserScript==
// @name Nuklear Power keyboard advancer
// @namespace http://matt.scharley.me/
// @version 1.0
// @updateURL https://gist.github.com/mscharley/cb2302fb97454e874db30a6be2f2445c/raw/8bit-theater-keyboard.user.js
// @downloadURL https://gist.github.com/mscharley/cb2302fb97454e874db30a6be2f2445c/raw/8bit-theater-keyboard.user.js
// @description Adds keyboard shortcuts for easily navigating the 8-bit Theater webcomic.
// @author Matthew Scharley
// @match *://www.nuklearpower.com/*
// @grant none
@mscharley
mscharley / Generator.re
Last active January 19, 2022 02:45
Example of using JavaScript generators in ReasonML.
/* Note, this is only for library interop code. This is *not* a good way to do things in pure Reason code. */
module type GeneratorType {
type value('a);
type t('a);
type fn('a) = unit => t('a);
let valueGet: value('a) => option('a);
let doneGet: value('a) => bool;
@mscharley
mscharley / Dockerfile.web
Last active February 16, 2021 22:05
Example Dockerfile for static compilation of ReasonML / OCaml projects using esy.
# vim: set filetype=dockerfile :
FROM node:10.13-alpine as build
ENV TERM=dumb \
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
# Create a subuser so that NPM doesn't whine about running as root
RUN adduser -D -H -h /usr/src/app web && \
mkdir -p /usr/src/app && \
chown web:web /usr/src/app && \
@mscharley
mscharley / Session.re
Created November 2, 2018 23:58
Sample Session handler for bs-auth0-js
open Belt.Option;
open Js.Nullable;
open BsQuerystringify.QueryStringify;
open BsAuth0Js;
type accessToken = string;
type id = {
email: option(string),
name: option(string),
@mscharley
mscharley / compile-string.ts
Created November 11, 2017 04:20
Compile a string in TypeScript using imports and type-checking.
import * as ts from "typescript";
// tslint:disable
export const transpileModule = (input: string, transpileOptions: ts.TranspileOptions): ts.TranspileOutput => {
let diagnostics: ts.Diagnostic[] = [];
const options: ts.CompilerOptions = transpileOptions.compilerOptions || ts.getDefaultCompilerOptions();
options.isolatedModules = true;
@mscharley
mscharley / circe.scala
Last active May 7, 2017 09:26
Decoding many, many fields with Circe.
import cats._
import cats.implicits._
import io.circe._
import io.circe.generic.semiauto._
implicit lazy val guildDecoder: Decoder[Guild] =
(c: HCursor) =>
implicitly[Monad[Either[DecodingFailure, ?]]] sequence Vector(
c.downField("id").as[Snowflake],
c.downField("name").as[String],
@mscharley
mscharley / Dockerfile
Last active May 16, 2016 21:30 — forked from lussoluca/dockerfile
Dockerfile for logstash-input-acquia
FROM logstash:1.5
# RUN apt-get update && apt-get install -y \
# ruby \
# git \
# vim \
# zip \
# openssl \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*
@mscharley
mscharley / skype.ps1
Created December 27, 2014 09:09
Open multiple Skype instances (Windows/Powershell)
$skypePath = (Get-ItemProperty -Path hkcu:\SOFTWARE\Skype\Phone).SkypePath
if (!(Test-Path $skypePath -pathType leaf)) {
Write-Host "Unable to find Skype for Desktop. Is it installed correctly?"
pause
exit 1
}
$dataPath = "$($env:localappdata)\SkypePortable"
$instanceCount = 2
@mscharley
mscharley / homestuck-keyboard.user.js
Last active April 9, 2022 11:18
Tampermonkey script - Adds keyboard shortcuts for easily navigating the Homestuck webcomic. May work for other MSPA comics.
// ==UserScript==
// @name Homestuck Keyboard Advancer
// @namespace http://matt.scharley.me/
// @version 1.13
// @updateURL https://gist.githubusercontent.com/mscharley/2d73c81d1d70c504d58d/raw/homestuck-keyboard.user.js
// @downloadURL https://gist.githubusercontent.com/mscharley/2d73c81d1d70c504d58d/raw/homestuck-keyboard.user.js
// @description Adds keyboard shortcuts for easily navigating the Homestuck webcomic. May work for other MSPA comics.
// @author Matthew Scharley
// @match *://www.homestuck.com/*
// @grant none