Skip to content

Instantly share code, notes, and snippets.

miguelgrinberg / .vimrc
Last active Jan 12, 2021
My .vimrc configuration for working in Python with vim
View .vimrc
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
let need_to_install_plugins = 1
call plug#begin()
Plug 'tpope/vim-sensible'
isaacabraham / io-monad.fsx
Last active May 28, 2019
F# port of the first half of John De Goes "FP to the max" (
View io-monad.fsx
#load @".paket\load\net452\FSharpPlus.fsx"
open FSharpPlus
open System
module rec IO =
let run (IO computation) = computation()
type IO<'T> =
View Differ.fs
type DifferenceType<'TKey, 'T> =
| Added of 'TKey * 'T
| Removed of 'TKey * 'T
| Modified of 'TKey * 'T * 'T * seq<string * (string * string)> with
member this.Key =
match this with
| Added (key, _)
| Removed (key, _)
| Modified (key, _, _, _) -> key
CarstenKoenig / Hylo.fs
Last active Feb 19, 2018
Factorial using a Hylomorphism in F#
View Hylo.fs
type List<'i,'r> = Nil | Cons of 'i*'r
type FixList<'i> = FixList of List<'i,FixList<'i>>
let rec fmap (f : 'a -> 'b) (l : List<'i,'a>) : List<'i,'b> =
match l with
| Nil -> Nil
| Cons (x, tail) -> Cons (x, f tail)
// you can express hylo directly without using ana and cata (by either following the
vjeux /
Last active Jun 19, 2019
Ocaml / functional programming

I'm taking down this post. I just posted this as a side comment to explain a sentence on my latest blog post. This wasn't meant to be #1 on HN to start a huge war on functional programming... The thoughts are not well formed enough to have a huge audience. Sorry for all the people reading this. And please, don't dig through the history...

decisionmechanics / spark_random_forest.R
Created Mar 21, 2017
Predicting wine quality using a random forest classifier in SparkR
View spark_random_forest.R
url <- ""
df <-
read_delim(url, delim = ";") %>%
dplyr::mutate(taste = as.factor(ifelse(quality < 6, "bad", ifelse(quality > 6, "good", "average")))) %>%
battermann / io.fsx
Last active Jul 6, 2020
IO Monad in F#
View io.fsx
module IO =
type IO<'a> =
| Return of (unit -> 'a)
| Suspend of (unit -> IO<'a>)
let rec run x =
match x with
| Return v -> v()

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
robert-claypool / app_offline.htm
Created Jul 21, 2015
A simple "app offline" template for ASP.NET
View app_offline.htm
<!DOCTYPE html>
<meta charset="UTF-8">
<body style="margin:3em;font-family:sans-serif">
<p>This site is offline for maintenance.</p>
phrawzty /
Last active Jan 22, 2021
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):