This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; init-basic.el | |
;; A barebones emacs init file for beginners. Removes most common annoyances. | |
;; | |
;; Author: Matthew Chan <[email protected]> | |
;; Date: November 2014, Last updated January 2015 | |
;; License: GNU GPL | |
;; | |
;; Usage: Put in .emacs.d as init.el. Run | |
;; $ cd | |
;; $ git clone https://gist.github.com/112f4a71294aec281fa9.git .emacs.d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AsideBlock | |
# Insert toggle-able text segments with ease in Jekyll blog posts. | |
# Requires Bootstrap | |
# | |
# Author: Matthew Chan <[email protected]> | |
# Date: January 2015 | |
# License: GNU GPL | |
# | |
# Usage: | |
# {% aside <title> %} ==> auto expands to "(aside) <title>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MarkdownBlock | |
# Insert & parse Markdown anywhere, even nested in html | |
# | |
# Author: Matthew Chan <[email protected]> | |
# Date: January 2015 | |
# License: GNU GPL | |
# | |
# Usage: | |
# {% markdown %} | |
# <md_text> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Golf where | |
import Data.List | |
skips :: [a] -> [[a]] | |
skips xs = map (map snd) $ zipWith filter filters (replicate len ids) | |
where len = length xs | |
ids = zip [1..len] xs | |
filters = map (\n (a,_) -> a `mod` n == 0) [1..len] | |
localMaxima :: [Integer] -> [Integer] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
#| | |
Simplified SXML grammar | |
<Element> ::= (<Symbol> <Children>...) | |
| (<Symbol> <AttribList> <Children>...) | |
<Children> ::= <Element> | <Value> | |
<AttribList> ::= (<Attribute> ...) | (@ <Attribute> ...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require test-engine/racket-tests) | |
(define (rotations lst) | |
(letrec ((go (λ (n acc) | |
(if (= n 0) acc | |
(go (sub1 n) (let ((c (car acc))) | |
`(,`(,@(cdr c) ,(car c)) ,@acc))))))) | |
(reverse (go (length lst) (list lst))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require xml) | |
(require xml/xexpr) | |
(define to-html (compose display | |
xexpr->string)) | |
(define CONFIGS '((siteName "Andromeda") | |
(latitude 1234.567) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- LANGUAGE TupleSections -} | |
import Control.Monad | |
import qualified Data.Set as S | |
--type State = String | |
type Symbol = Char | |
data DFA st = DFA { states :: [st], | |
alphabet :: [Symbol], | |
delta :: st -> Symbol -> st, | |
startSt :: st |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* Folds *) | |
let rec fold_right f a xs = match xs with | |
| [] -> a | |
| x :: xs -> f (fold_right f a xs) x | |
let rec fold_left f a xs = match xs with | |
| [] -> a | |
| x :: xs -> fold_left f (f a x) xs | |
(* TODO: implement monoids and the foldable typeclass with modules*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% Listings hacks to emulate the math-style Haskell from Functional Pearls, | |
% Programming in Haskell, Pearls of Functional Algorithm Design. and other books. | |
% | |
% This is probably as close an emulation of the math-style generated with lhs2tex as I can get. | |
% | |
% Modified from: | |
% https://raw.githubusercontent.com/UCSD-PL/230-web/master/templates/haskellListings.tex | |
% |
OlderNewer