Instantly share code, notes, and snippets.

View tiles.html
<body style="margin:0">
<canvas></canvas>
</body>
<script>
let SCRW = document.body.clientWidth;
let SCRH = document.body.clientHeight;
let canvas = document.querySelector('canvas');
canvas.width = SCRW;
View videogram.html
<body style="margin:0"></body>
<video src="http://techslides.com/demos/sample-videos/small.webm" style="display:none" autoplay loop></video>
<script>
let SCRW = document.body.clientWidth;
let SCRH = document.body.clientHeight;
let canvas = document.createElement('canvas');
canvas.width = SCRW;
canvas.height = SCRH;
View Quad.hs
import Data.Maybe (catMaybes)
import qualified Data.Set as Set
(|>) = flip ($)
between :: Ord a => a -> (a, a) -> Bool
between x (a, b) = a <= x && x <= b
class Clamp a where
clampedBy :: a -> (a, a) -> a
View Snake.hs
import Control.Monad (guard, when)
import Data.Array (Array, (!), (//), bounds, listArray)
import System.Console.ANSI
import System.IO (stdin, hReady)
import System.Random
import System.Timeout (timeout)
import Debug.Trace
data Pos
= Pos
View EventDescriptionValidity.java
package com.company;
import java.util.Optional;
import java.util.function.Function;
class Validity { }
class Valid extends Validity { }
View CombinedSchema.hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
View Reversi.hs
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
import Control.Arrow
import Control.Monad
import Data.Array
import Data.Function
import Data.List
import Data.Maybe
import System.Environment
View HM.hs
{-# LANGUAGE TupleSections #-}
import Control.Monad.State (State, evalState, get, gets, modify, put)
import Data.Function (on)
import Data.List (unionBy)
import Data.Map (Map)
import Data.Maybe (fromMaybe)
import qualified Data.Map as Map
View fireworks.html
<!DOCTYPE html>
<html>
<head>
<title>Fireworks</title>
</head>
<body>
<script>
const SCRW = 800;
const SCRH = 800;
View fibo.py
class Vec2(object):
def __init__(self, x, y):
self.x = x
self.y = y
def dot(v, w):
return v.x * w.x + v.y * w.y
class Mat22(object):
def __init__(self, a, b, c, d):