Skip to content

Instantly share code, notes, and snippets.

View wetmore's full-sized avatar

Matthew Wetmore wetmore

View GitHub Profile
@wetmore
wetmore / gist:25a968bd4ffbaf67416a
Created October 4, 2014 20:44
Tex source for a homework assignment with code and math
\documentclass[a4paper,english]{article}
%% Use utf-8 encoding for foreign characters
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{siunitx}
%% Vector based fonts instead of bitmaps
assignment = __dirname.substr(__dirname.lastIndexOf('/') + 1)
module.exports = (grunt) ->
grunt.initConfig
watch:
files: ['!full.tex', '*.tex']
tasks: 'exec:pdf'
options:
event: ['changed']
exec:
@wetmore
wetmore / stocks.hs
Last active November 8, 2015 08:16
Find the maximum profit from buying and selling once.
data StockState = StockState { hi :: Int, lo :: Int, lowest :: Int }
deriving Show
solve xs = (hi st) - (lo st)
where
st = solve' xs
solve' [] = StockState 0 0 0
solve' (x:xs) = foldl go (StockState 0 0 x) xs
where
{-# LANGUAGE GADTs, RankNTypes, TypeFamilies, DataKinds, DeriveFunctor, TypeOperators #-}
import Data.Type.Equality
import Data.List (intercalate)
import Data.Maybe (catMaybes)
data HasVars = Var | NoVar
data SHasVars a where
SVar :: SHasVars Var
from django.conf import settings
from django.db import models
# A Batch represents one batch, and may be assigned to multiple
# users.
class Batch(models.Model):
name = models.CharField(max_length=200)
assigned_users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True)
def __str__(self):