Skip to content

Instantly share code, notes, and snippets.

@Muzietto
Muzietto / writer_monad_validation.html
Created October 11, 2015 17:41
Validating a form with a writer monad
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>monadic validation</title>
<style>
body { font-family: Verdana; font-size: 1.5em; }
.horizon { width: 500px; margin: 0 auto; padding: 10px; border: 2px solid red; }
.horizon input, .horizon label { margin: 10px; }
@Muzietto
Muzietto / slice_country.js
Created September 29, 2015 12:35
google/i18n/libphonenumber - node.js script to prepare single-country metadata files
/*
SCLEXE - single-country libphonenumber executable
Author: Marco Faustinelli ([email protected])
Web: http://faustinelli.net/
http://faustinelli.wordpress.com/
Version: 1.0
The MIT License - Copyright (c) 2015 SCLEXE Project
*/
var fs = require('fs');
@Muzietto
Muzietto / build.xml
Last active September 29, 2015 12:36
google/i18n/libphonenumber - ant project to compile single-country JS executables using the Closure compiler
<?xml version="1.0" ?>
<!--
SCLEXE - single-country libphonenumber executable
Author: Marco Faustinelli ([email protected])
Web: http://faustinelli.net/
http://faustinelli.wordpress.com/
Version: 1.0
The MIT License - Copyright (c) 2015 SCLEXE Project
-->
<project basedir="." name="libphonenumber-javascript" default="all">
@Muzietto
Muzietto / WEBSTORM_EXPRESS_INSTALL_REPORT.txt
Created September 12, 2015 06:30
A bunch of ECONNRESET from npmjs.org
Error creating Node.js Express App. Failed command:
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install
Exit code: -1
Standard error:
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
npm info attempt registry request try #1 at 08:22:57
npm http request GET https://registry.npmjs.org/cookie-parser
module Mycont_01 where
import Control.Monad.Cont
fattoriale :: Int -> Int
Cont (\c -> c (fattoriale 0)) = return 1
Cont (\c -> c (fattoriale n)) = Cont (\c -> c (fattoriale (n - 1)))
>>= (\x -> Cont (\c -> c (n*x)))