Skip to content

Instantly share code, notes, and snippets.

José Lorenzo Rodríguez lorenzo

View GitHub Profile


A library to calculate a metric indicating the string distance between two strings.

This library was extracted from the Elm implementation of mailcheck

The lcs and lcsLimit functions are more general and support more than just Char as list elements.

View brittany.yaml
conf_version: 1
lconfig_indentAmount: 4
lconfig_cols: 100
lconfig_alignmentLimit: 30
lconfig_indentListSpecial: true
lconfig_alignmentBreakOnMultiline: true
lconfig_indentPolicy: IndentPolicyLeft
lconfig_indentWhereSpecial: true
View stack.Dockerfile
FROM fpco/stack-build:lts-12.9 AS stack-build
RUN stack setup --resolver=lts-12.9
COPY ./stack.yaml ./package.yaml ./
RUN stack build --only-dependencies
COPY . .
RUN stack install
FROM ubuntu:16.04 as base
View choose.hs
module Main where
import qualified Data.Char
main = print go
go =
let l = ['a', 'b', 'a', 'A', 'b', 'B']
in foldr choose [] l
View fib.hs
fib :: Int -> Int
fib n =
let fib = 0:1:zipWith (+) fib (tail fib)
in fib!!n
View example.hs
sitesQuery :: Query
sitesQuery = "select id, name from sites"
queryUsersAndCreateCheckpoints :: IO ()
queryUsersAndCreateCheckpoints = do
conn <- mysqlConnect -- my own helper function
statement <- prepareStmt conn sitesQuery
results <-
queryStmtResults conn statement [] >>= -- Query all the sites so they can be processed concurrently
Streams.toList -- The list is small, so we need no streaming
View lens.hs
import qualified Data.HashMap.Strict as HM
import qualified Data.Vector as V
case a of
Array objs -> mapMaybe (HM.lookup key) (V.toList objs)
_ -> []
View DebuggingQuery.php
namespace App\ORM;
use Cake\Error\Debugger;
use Cake\ORM\Query;
class DebuggingQuery extends Query
public function __construct($connection, $table)
lorenzo / Dockerfile
Created Apr 30, 2018
Fast multi-stage docker builds for haskell
View Dockerfile
FROM base-haskell:lts-11.7 AS builder
# Copy all local files and build the app
COPY . .
RUN stack install
FROM debian:stretch-slim AS distro
# Copy the executable from the builder stage
View bench.php
* Configuration options
$iterations = 1000000;
* Actual Benchmarks to run
You can’t perform that action at this time.