Skip to content

Instantly share code, notes, and snippets.

@athanclark
athanclark / haskell-curl-curlc
Created June 16, 2014 03:20
Haskell curl package "error adding symbols"
athan@research1 $> cabal unpack curl && cd curl*
Downloading curl-1.3.8...
Unpacking to curl-1.3.8/
athan@research1 $> cabal sandbox init
Writing a default package environment file to
/home/athan/dev/curl-1.3.8/cabal.sandbox.config
Creating a new sandbox at /home/athan/dev/curl-1.3.8/.cabal-sandbox
athan@research1 $> cabal install
@athanclark
athanclark / input.md
Created June 23, 2014 15:30
Kramdown incorrectly identifies html closing tags as invalid
layout title tagline
page
Résumé
A (hopefully) accurate measure of Athan Clark

{% include JB/setup %} {::options parse_block_html="true" /}


@athanclark
athanclark / output.txt
Created June 23, 2014 15:33
Improper xhtml parsing
Warning: Found invalidly used HTML closing tag for 'ul' - ignoring it
Warning: Found invalidly used HTML closing tag for 'ul' - ignoring it
Warning: Found invalidly used HTML closing tag for 'ul' - ignoring it
Warning: Found invalidly used HTML closing tag for 'ul' - ignoring it
Warning: Found invalidly used HTML closing tag for 'td' - ignoring it
Warning: Found invalidly used HTML closing tag for 'tr' - ignoring it
Warning: Found invalidly used HTML closing tag for 'table' - ignoring it
Warning: Found no end tag for 'li' - auto-closing it
<hr />
<p>layout: page
@athanclark
athanclark / BNF.cf
Created August 10, 2014 01:02
BNF in LBNF
--| I kinda made lists explicit, here: I was able to implement
--| Kleene plusses and stars with the inductive lists. I haven't
--| found much material on properly making list productions in
--| BNFC (*prays to shrine for more material*), but would gladly
--| take in suggestions!
token NonTerminal ('<' (letter | digit | '_' | '-')* '>') ;
SyntaxNil . Syntax ::= ;
@athanclark
athanclark / LexBNF.x
Created August 10, 2014 04:04
Lex File
-- -*- haskell -*-
-- This Alex file was machine-generated by the BNF converter
{
{-# OPTIONS -fno-warn-incomplete-patterns #-}
module LexBNF where
import qualified Data.Bits
import Data.Word (Word8)
@athanclark
athanclark / ParBNF.y
Created August 10, 2014 04:04
Parser File
-- This Happy file was machine-generated by the BNF converter
{
{-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns #-}
module ParBNF where
import AbsBNF
import LexBNF
import ErrM
}
$> cat input.txt
<postal-address> ::= <name-part> <street-address> <zip-part>
<name-part> ::= <personal-part> <last-name> <opt-suffix-part> <EOL> | <personal-part> <name-part>
$> ./TestBNF input.txt
input.txt
Parse Failed...
@athanclark
athanclark / bench
Created November 27, 2014 04:47
Hello World Benchmark
athan@namek ~/d/A/LM-scotty-port> ab -n 100000 -c 1000 http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
@athanclark
athanclark / students.js
Created May 16, 2015 22:21
Syntax error on line 12...?
'use strict';
angular.module('myApp.students', [])
.controller('StudentsCtrl', [function() {
var students = {};
var idCount = 0;
// create :: {name, grade} -> id
this.create = function(student) {
@athanclark
athanclark / needless-duplication.js
Created May 16, 2015 21:57
How can I reduce this duplication?
// lookupKey :: id -> [{id, name, grade}] -> Maybe {id, name, grade}
function lookupKey(id, map) {
var index = 0;
while (index < map.length()) {
if (map[index].id === id) {
return map[index];
} else {
index++;
}
}