Skip to content

Instantly share code, notes, and snippets.

@imalsogreg
imalsogreg / xmonad.hs
Last active February 24, 2021 23:15
My xmonad config - programmer's dvorak ok workspace switching, caps=ctrl, working matlab, laptop volume keys
import qualified Data.Map as M
import XMonad
import qualified XMonad as XMonad
import XMonad.Hooks.SetWMName
import qualified XMonad.StackSet as W
myWorkspaces = map show [1..9]
myNumRow = [xK_ampersand
, xK_bracketleft
, xK_braceleft
@imalsogreg
imalsogreg / changelogs.md
Last active August 29, 2015 14:14
Survey of changelogs on hackage

Authoritative sources

Source Notes
Wikipedia entry
  • Custom format from GNU
  • Date (YYYY-MM-DD), name, email per entry
Keep a changelog
  • Use markdown
  • Emphasis on human readability
  • Attempt at modern standard
  • Never dump git logs there
  • Subsections tagged by [VERSION]
  • Top version always [UNRELEASED]
  • Many more tips at their site

Examples from hackage

| Package | Notes |

@imalsogreg
imalsogreg / pointers.md
Last active August 29, 2015 14:14
Pointers for mom

Pointers

Some background things to keep in mind:

  • A variable is the combination of a name and a location in memory.
  • Initializing a variable tells C what the variable's type is, and sets aside some space for the variable's value
  • Then, using the variable causes C to look into that variable's memory address.
  • Assigning value to a variable means looking up the address and copying bites there
  • Reading a variable means looking up the memory address, reading the bytes, and using the variable's types to interpret the bytes (without the type, there'd be no way to know how to interpret the bytes)
  • Types give values meaning. The meaning of a char is "a single character". This meaning isn't necessarily part of the language. Instead it's for you to have a mental model of what the program does.
@imalsogreg
imalsogreg / Main.hs
Created May 29, 2015 23:18
Lucid circles and shadows
module Main where
import Data.Foldable
import qualified Data.Text as T
import Lucid.Svg
import qualified Lucid.Svg.Attributes as A
import qualified Lucid.Svg.Elements as E
@imalsogreg
imalsogreg / taurusBug
Created June 2, 2015 23:01
Debugging by taurus wedge code...
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
import Data.Fixed (mod')
import qualified Data.Text as T
import Lucid.Svg
import qualified Lucid.Svg as L
import qualified Lucid.Svg.Elements as E
module Main where
import Data.Map
import Data.Monoid
import Data.Bool
import Reflex.Dom
main :: IO ()
main = mainWidget $ do
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TemplateHaskell #-}
import Control.Monad (mzero)
import Control.Monad.IO.Class (liftIO)

Keybase proof

I hereby claim:

  • I am imalsogreg on github.
  • I am imalsogreg (https://keybase.io/imalsogreg) on keybase.
  • I have a public key whose fingerprint is 85E5 FA73 674F A3D2 EE78 26D4 2966 5DFD 258A A249

To claim this, I am signing this object:

@imalsogreg
imalsogreg / beforeafter.html
Created November 4, 2015 14:22
Sticking together some example code from http://codepen.io/ace/pen/BqEer to make a before-after slider
<!DOCTYPE HTML>
<html>
<head>
<!-- Import jQuery library -->
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<!-- Inline style-->
<!-- Adjust width/height according to picture size -->
@imalsogreg
imalsogreg / Main.hs
Created December 15, 2015 05:34
Use of Reflex.Dom.Contrib.Widgets.ButtonGroup
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RecursiveDo #-}
module Main where
import Data.Bool
import Data.Char
import Data.Default