Skip to content

Instantly share code, notes, and snippets.

@chrisdone
chrisdone / local.js
Created January 17, 2012 19:41 — forked from mightybyte/local.js
Javascript for digestive-functors massInput
/*******************************************************************************
* Main entry point.
*/
$(document).ready(function(){
setupErrors();
setupDates();
setupAutoHide();
setupManageItems();
setupConfirms();
});
@chrisdone
chrisdone / headerimg.png
Created April 26, 2016 19:54
Redesigned /r/haskell design
headerimg.png
@chrisdone
chrisdone / Experiment1.hs
Last active September 1, 2016 13:17 — forked from idontgetoutmuch/Experiment1.hs
An experiment with data analysis
{-# LANGUAGE OverloadedLabels, TypeOperators, DataKinds, FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
import Labels
import Labels.Cassava
import Data.Vector ( Vector )
import Data.Text ( Text )
import Data.Text.Lazy.Encoding
import qualified Data.Text.Lazy as LT
import Data.Csv hiding ( decodeByName )
import Data.Csv.Streaming
@chrisdone
chrisdone / expression_problem.hs
Created November 2, 2016 11:34 — forked from elnygren/expression_problem.clj
Solving the Expression Problem with Haskell
{-# LANGUAGE NamedFieldPuns #-}
-- The Expression Problem and my sources:
-- http://stackoverflow.com/questions/3596366/what-is-the-expression-problem
-- http://blog.ontoillogical.com/blog/2014/10/18/solving-the-expression-problem-in-clojure/
-- http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/
-- http://www.ibm.com/developerworks/library/j-clojure-protocols/
-- To begin demonstrating the problem, we first need some
@chrisdone
chrisdone / rust-day5.rs
Created December 10, 2017 22:46 — forked from samuelhnrq/rust-day5.rs
My solution for the fifth day of advent of code
extern crate time;
use std::fs::File;
use std::io::prelude::*;
fn main() {
let mut inpt = File::open("input/xmas5.txt").expect("file not found");
let mut content = String::new();
inpt.read_to_string(&mut content).unwrap();
let tm = time::now();
@chrisdone
chrisdone / ackermann.dhall
Last active April 7, 2020 09:02 — forked from Gabriella439/ackermann.dhall
Ackermann function in Dhall
-- Credit to: https://news.ycombinator.com/item?id=15186988
let iterate
: (Natural → Natural) → Natural → Natural
= \f n ->
fold (n + 1) f 1
let increment : Natural → Natural = \n -> n + 1
let ackermann
{-
Examples:
> reify @Int $ eval $ A (reflect (abs :: Int -> Int)) (I (-9))
9
> reify @Int $ eval $ A (A (reflect ((*) :: Int -> Int -> Int)) (reflect @Int 3)) (reflect @Int 5)
15
@chrisdone
chrisdone / hell-http.hs
Created June 30, 2024 21:17 — forked from chrisdone-artificial/hell-http.hs
hell-http.hs demo
#!/usr/bin/env hell
-- How to run this:
--
-- socat TCP-LISTEN:8081,fork,reuseaddr,max-children=20 EXEC:"./handler.hell"
main = do
line <- Text.getLine
let content =
Text.concat ["<h1>Hello, World!</h1><p>This is generated by Hell.</p><pre>", line, "</pre>"]