Skip to content

Instantly share code, notes, and snippets.

View Bradcomp's full-sized avatar

Brad Compton (he/him) Bradcomp

View GitHub Profile
@Bradcomp
Bradcomp / Vectors.hs
Created September 18, 2016 05:25
Simple Vector Library in Haskell
module Vectors where
import Data.Functor (Functor)
import Data.Function (on)
import Control.Applicative (Applicative, liftA2)
--Helper function for dealing with floating point errors
roundTo:: (RealFrac a) => Int -> a -> a
roundTo digits num = (/10^^digits) $ fromIntegral $ round $ num * (10 ^^ digits)
@Bradcomp
Bradcomp / toggle-menu.js
Created September 3, 2016 00:08
Toggles the .is-active class for a hamburger menu
(function() {
var burger = document.querySelector('.nav-toggle');
var menu = document.querySelector('.nav-menu');
burger.addEventListener('click', function() {
burger.classList.toggle('is-active');
menu.classList.toggle('is-active');
});
})();