Eventually, this will become a script. Until then…
First, find all strings of bases (except the last)
/\v([0-9]*1) .{-} ([0-9]*0)/e
WARNING: You must copy the commands from the raw
version of this document. The markdown converter doesn’t like it…
Do you have a file with weird encoding errors? Perhaps instead of ’
you have á^€™
. The cause is a mix up between latin1 (usually — and especially if mysql is involved — the windows cp1252 encoding) and utf8.
Many solutions drop bytes. This has the advantage that you can see every change that is made, as it happens, should you wish.
It requires the file to be encoded in ISO 8859–1.
Ever been faced with an old website that needs an upgrade best done incrementally? At http://www.parsonsmatt.org/2016/06/24/take_over_an_api_with_servant.html, Matt Parsons describes an approach to incrementally take over an old API using Servant and a reverse proxy, which is worth a read!
On occasions, though, your predecessor may not have written a considered, documented API. Sometimes all that exists is a sprawl of tangled php, html and javascript that just about works, until there’s a change in business logic and the code gets touched — at which point everything breaks. Unlike the example in Matt’s post, it has an index.php
route with all the pages at index.php?page=<PAGE>
, instead of using path pieces separated by solidus.
Matt’s approach works in this case too, and we don’t even need to change the haskell server he supplies! We simply change how we use the reverse proxy and add some url rewriting middleware.
This example copies Matt’s woofing and meowing server, for simplicity of comparison.
--- | |
title: passhte | |
author: David Baynard | |
date: 22 May 2017 | |
fontfamily: libertine | |
csl: chemical-engineering-science.csl | |
link-citations: true | |
abstract: | | |
Paste over ssh | |
... |
--- | |
title: Forestay | |
author: David Baynard | |
date: 05 Jun 2017 | |
fontfamily: libertine | |
csl: chemical-engineering-science.csl | |
link-citations: true | |
abstract: | | |
... |
-- | | |
-- Module : diagonal-span | |
-- Copyright : David Baynard 2018 | |
-- License : BSD-3-Clause OR Apache-2.0 | |
-- | |
-- Maintainer : haskell@baynard.me | |
-- Stability : experimental | |
-- Portability : unknown | |
-- | |
-- A proposal for a correct by construction abstract syntax tree for pandoc |
--- | |
title: Jindosh puzzle | |
author: David Baynard | |
date: 16 Jan 2019 | |
fontfamily: libertine | |
csl: chemical-engineering-science.csl | |
link-citations: true | |
abstract: | | |
... |
#!/usr/bin/env zsh | |
# | |
# Review github PRs. | |
# | |
# This script makes reviewing github PRs simple. Supply the requester's branch | |
# in the form it is presented at the top of the PR on github (i.e. user:branch). | |
# This adds: | |
# | |
# - a new remote corresponding to the user, with only the PR branch | |
# - a new local branch (unless a branch with that name exists already, in |
resolver: lts-13.5 | |
name: 8.6.3-13.5-baynard-snapshot | |
compiler: ghc-8.6.3 | |
packages: | |
- git: https://github.com/jameysharp/corrode | |
commit: 34053342c2f1ca04f23ad94d67057f14e74d9fb9 | |
- git: https://github.com/mgattozzi/curryrs | |
commit: 6d3ecbc3d1786ccc16e2ff20c6d6da53734f6b03 |