Skip to content

Instantly share code, notes, and snippets.

View jberryman's full-sized avatar

Brandon Simmons jberryman

View GitHub Profile
@chrisdone
chrisdone / Do.hs
Last active November 8, 2017 18:19
Debug.Do
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE LambdaCase #-}
-- | Print out the values of all names bound by statments,
-- either x <- y, or let x = y in a do-expression.
--
-- * Enable {-# LANGUAGE TemplateHaskell #-} in your module.
-- * Import Debug.Do
-- * Prefix bindings with _ to ignore them e.g. _foo.
--
@3noch
3noch / .ghci
Last active October 29, 2018 09:49
Reflex-DOM Auto Reload Development with ghcid
:set prompt "> "
:set -isrc
:load Main
@daig
daig / App.hs
Last active June 27, 2017 19:14
Elm/Flux style Component Architecture for Reflex-Dom
{-# LANGUAGE OverloadedStrings #-}
module App where
import Component
import Notes
import Reflex.Dom
import Data.Semigroup ((<>))
app :: MonadWidget t m => m ()
app = do
add <- (BlankNote <$) <$> button "New Note"
@Icelandjack
Icelandjack / Constraints.org
Last active April 2, 2024 20:22
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

@nominolo
nominolo / ghc-wrap.hs
Created May 6, 2014 10:21
Profiling GHC itself.
-- Use this file to profile GHC itself while compiling a certain file, i.e.,
-- it's equivalent to running something like the following:
--
-- ghc --make <MYTARGET> [<MYFLAG> ...] +RTS -p
--
-- Except that the standard ghc binary doesn't support the RTS option "-p".
-- Note that <MYTARGET> and <MYFLAGS> are hardcoded in the binary. If you
-- change one of these, you need to recompile this binary.
--
--
@gelisam
gelisam / Main.hs
Last active August 22, 2022 18:18
IndexedMonad example
-- in reply to http://www.reddit.com/r/haskell/comments/21mja6/make_lllegal_state_transitions_unrepresentable/
--
-- We implement a tiny language with three commands: Open, Close, and Get.
-- The first Get after an Open returns 1, the second Get returns 2, and so on.
--
-- Get is only valid while the state is open, and
-- Open must always be matched by a Close.
-- We enforce both restrictions via the type system.
--
-- There are two valid states: Opened and Closed.
@jpouellet
jpouellet / zbell.sh
Last active November 24, 2023 10:49
Makes Zsh print a bell when long-running commands finish. I use this in combination with i3 and throw big compile jobs (or whatever it may be) into another workspace to get a nice visual notification (workspace indicator turns red) when it's done so I don't need to waste time regularly checking on it.
#!/usr/bin/env zsh
# This script prints a bell character when a command finishes
# if it has been running for longer than $zbell_duration seconds.
# If there are programs that you know run long that you don't
# want to bell after, then add them to $zbell_ignore.
#
# This script uses only zsh builtins so its fast, there's no needless
# forking, and its only dependency is zsh and its standard modules
#
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@mbbx6spp
mbbx6spp / ExitCodeTestsExample.hs
Created November 6, 2011 20:30
Cabal file with test-suite block and explanation in a USAGE.md file.
module Main where
import Test.QuickCheck (quickCheck)
import Your.Module (encrypt, decrypt)
prop_reverseReverse :: [Char] -> Bool
prop_reverseReverse s = (reverse . reverse) s == s
prop_encryptDecrypt :: [Char] -> Bool
prop_encryptDecrypt s = (encrypt . decrypt) s == s
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.