Skip to content

Instantly share code, notes, and snippets.

@jkachmar
jkachmar / 1README.md
Last active December 24, 2021 15:06
Small Docker images with Alpine, Haskell, and Stack

All actions should be performed in the root directory of a Haskell project that uses stack. The following lines should be present in the project's stack.yaml file:

docker:
  enable: true

Additionally, the BaseImage and Dockerfile files from this gist should also be present in the project's root directory.

@jkachmar
jkachmar / .vimrc
Created January 31, 2017 17:10
Vim Setup
" -----------------------------------------------------------------------------
" Plugins
" -----------------------------------------------------------------------------
call plug#begin('~/.vim/plugged')
" User Interface
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'terryma/vim-multiple-cursors'
@jkachmar
jkachmar / Tree.purs
Created February 23, 2017 00:12
Free/Cofree
module Tree where
import Data.List
import Data.Maybe
--------------------------------------------------------------------------------
data Pair a
= Pair a a
@jkachmar
jkachmar / .spacemacs.el
Created February 27, 2017 15:45
Spacemacs Config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
dotspacemacs-distribution 'spacemacs
@jkachmar
jkachmar / contramap.js
Created April 7, 2017 21:20
Contravariance in JS
const daggy = require('daggy');
/* ------------------------------------------------------------------------- */
// type Predicate a = a -> Bool
// a is the _input_ to the function
const Predicate = daggy.tagged('f');
// :: (a -> Bool) -> (b -> a) -> b -> Bool
// :: Predicate a ~> (b -> a) -> Predicate b
@jkachmar
jkachmar / index.js
Last active April 25, 2017 22:14
partial.lenses tutorial
const R = require('ramda');
const L = require('partial.lenses');
/* -------------------------------------------------------------------------- */
const arr = [1, 2, 3];
// 'get', pulls value from some data structure
L.get(L.index(0), arr);
// > 1
@jkachmar
jkachmar / ThisIsWeird.hs
Created April 25, 2017 22:08
Showable HList
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module ThisIsWeird where
import ClassyPrelude
import Data.Kind (Constraint)
@jkachmar
jkachmar / main.c
Created May 3, 2017 14:42
Mongoose OS WDT Reset Repro
#include <stdio.h>
#include "common/cs_dbg.h"
#include "common/platform.h"
#include "frozen/frozen.h"
#include "fw/src/mgos_app.h"
#include "fw/src/mgos_adc.h"
#include "fw/src/mgos_aws_shadow.h"
#include "fw/src/mgos_gpio.h"
@jkachmar
jkachmar / AuthTest.hs
Last active June 14, 2017 20:51
Tasty Scaffold
module Handler.AuthTest where
-- * Prelude.
import ClassyPrelude
-- * Database imports.
import Database.Persist
import Database.Persist.Sql
-- * Testing imports.
@jkachmar
jkachmar / DumbThing.purs
Last active June 27, 2017 23:25
My Dumb PureScript Thing
module Main where
import Prelude
import Control.Monad.Aff (Aff, launchAff)
import Control.Monad.Aff.AVar (AVAR, AVar, makeVar', putVar, takeVar)
import Control.Monad.Aff.Class (class MonadAff, liftAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (log)