Skip to content

Instantly share code, notes, and snippets.

View adnelson's full-sized avatar

Allen Nelson adnelson

View GitHub Profile
@sw17ch
sw17ch / indented_parsec_example.lhs
Created March 16, 2012 04:31
A full example demonstrating the use of the indentation parser provided by the 'indents' package: http://hackage.haskell.org/package/indents
> module Main where
First, import all the needed modules.
> import Text.Parsec hiding (State)
> import Text.Parsec.Indent
> import Control.Monad.State
Next, define our new Parser type. This replaces the Identity monad
with the (State SourcePos) monad.
@kevincennis
kevincennis / markov.js
Last active April 7, 2023 17:44
Quick and dirty Markov chain text generator
// basic usage: new Markov(lotsOfText).generate()
// markov chain constructor
//
// @string input {example text}
// @integer len {optional # of words to output}
// @integer stateSize {optional chain order}
function Markov( input, len, stateSize ){
this.cache = Object.create(null)
this.words = input.split(/\s/)
@weavenet
weavenet / cfn-signal.sh
Last active March 10, 2023 14:49
Bash script to send Cloud Formation signals via curl.
#!/bin/bash
#
# This script will signal the provided Cloud Formation URL with success or failue.
# Result is expected to be the return code of a configuration management script.
# Success will only be signaled if the script returns 0
export result=$1
export url=$2
function help {
@scull7
scull7 / Page.re
Last active February 6, 2019 17:34
module Page = {
type action =
| NoOp;
type ledger = {
id: string,
statementId: string,
actor: string,
influencer: string,
referenceType: string,
paymentId: string,
let str = ReasonReact.string;
let url = "http://localhost:3000/users";
type user = {
id: int,
name: string,
};
type state =
@parsonsmatt
parsonsmatt / no-thanks-acid-state.md
Created December 17, 2018 18:46
acid state antirecommendation

Someone asked whether or not acid-state was production ready. I shared my experiences:

parsonsmatt [11:32 AM] @nikolap it's used by cardano-wallet and Hackage. Based on my experience with acid-state, I'd say it is not a good choice for production data storage. For local desktop apps, SQLite is a much better choice, and for real production apps, Postgresql is king.

parsonsmatt [11:44 AM] acid-state did not have a test suite, at all, until I implemented the very first tests (for TemplateHaskell code generation) earlier this year. It has picked up some tests since then, but I'm still not confident in it's correctness.

It claims to be resilient to unplugging the power cord, but I doubt that, as it's not resilient to Ctrl-C: acid-state/acid-state#79