Skip to content

Instantly share code, notes, and snippets.

View jmackie's full-sized avatar
🕺

Jordan Mackie jmackie

🕺
View GitHub Profile
@jmackie
jmackie / roll_nunif.R
Created December 7, 2015 12:23
Rolling average for non-uniform time-sampled data.
##################################################################
# A rolling average function for non-uniform time-sampled data. #
##################################################################
# Create some awkward time sampled data.
time <- cumsum(round(runif(1000, 0, 2), 2))
x <- runif(1000, 300, 400)
df <- data.frame(t = time, x)
# Rcpp, otherwise R would take all day...
@jmackie
jmackie / reader.go
Last active April 25, 2024 20:51
Pass a single io.Reader to multiple goroutines
/*
Package fan is a little concurrent io experiment.
Example Use Case
----------------
You have a function that takes a single io.Reader as an argument. You would like
to pass that reader to several processing functions. You could just make the
function accept an io.ReadSeeker, invoke each function serially in a for loop,
seeking after each call. But that's not cool.
@jmackie
jmackie / sheets.css
Created October 18, 2017 13:36
Paper-like formatting for HTML documents.
/* ====================================
* sheets.css
* Author: Jordan Mackie
* License: none (public domain)
*
*
* USAGE
* -----
*
* <body class="sheets" size="A4">
@jmackie
jmackie / README.md
Last active February 2, 2018 03:03
W' balance modelling with Haskell
@jmackie
jmackie / Main.purs
Last active February 12, 2018 12:27
Back squat model using purescript's flare library
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Data.List (List(..), (:), fromFoldable)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype, unwrap, over, over2)
import Data.Ord (abs)
@jmackie
jmackie / load.js
Last active February 21, 2018 09:52
OpenSearchDescription for purescript's API search engine (Pursuit)
var url =
'https://gist.githubusercontent.com/jmackie/' +
'1b147dd1ab5fb4484515bfbf82eef249/raw/' +
'661eb53afa3ac392967db4a1d4cb32906603cfba/search.xml';
window.external.AddSearchProvider(url);
@jmackie
jmackie / README.md
Last active February 23, 2018 16:04
Dependently typed printf in Idris

Paranoid printf

My first foray into the land of dependent types.

$ idris printf.idr -o printf-demo && ./printf-demo
@jmackie
jmackie / quicksort.idr
Last active February 23, 2018 16:05
Quicksort, Idris style
module Main
-- data List a = (::) a (List a) | Nil
quicksort : Ord a => List a -> List a
quicksort [] = []
quicksort (x :: xs) = (sort lower) ++ [x] ++ (sort upper)
where lower = filter (<x) xs
upper = filter (>=x) xs
@jmackie
jmackie / git-tips.md
Last active March 21, 2018 00:13
Helpful Git tips

Git Tips

A friendly cheatsheet that answers the questions I find myself asking embarrassingly often...

"I should probably work today, how do I sync up with everyone?"

git fetch origin               # update everything you're not working on
git diff master origin/master  # see what's changed
git merge origin/master # update what you're working on
@jmackie
jmackie / elm-compilation-notes.md
Last active March 27, 2018 16:58
99 Elm compilation problems

Rebuild all the things (worse case scenario):

[ReallyBigProject](master)$ find client/elm -type f -exec touch {} +
[ReallyBigProject](master)$ elm-make +RTS -N4 -s -RTS client/elm/Main.elm --output $(mktemp --suffix .js)

Here's the output (with some overhead from profiling stuff in the build):