Skip to content

Instantly share code, notes, and snippets.

View adnelson's full-sized avatar

Allen Nelson adnelson

View GitHub Profile
import sys
import json
import requests
import re
def get_license(package_name):
"""Find the license of an NPM package, come hell or high water."""
url = "https://registry.npmjs.org/{}".format(package_name)
resp = requests.get(url).json()
def read_license(license_):
@adnelson
adnelson / default.nix
Last active October 11, 2016 22:20
generate cabal file with nix
{
pkgs ? import <nixpkgs> {},
compiler ? "ghc7102"
}:
import ./project.nix {
inherit pkgs;
haskellPackages = pkgs.pkgs.haskell.packages."${compiler}";
}
use std::{cmp};
type ParseResult<T> = Result<T, String>;
// Parse a string containing any number of balanced parentheses
// groups. For example these are valid:
//
// () => 1 group, max depth 1
// (())() => 2 groups, max depth 2
// (()()()(())()) => 1 group, max depth 3
-- | Optionally set up a reverse HTTP proxy to a ghcjsi server.
--
-- The idea here is that you are working on an application which has a
-- GHCJS frontend and a GHC backend. The backend delivers the front-end
-- JavaScript to the browser, and also provides some kind of REST API
-- which the frontend uses. The API server is assumed to be the same
-- server which serves the frontend code, so that you don't need to set
-- up CORS.
--
-- When developing on your front-end code, you want to be able to rapidly