Skip to content

Instantly share code, notes, and snippets.

@addrummond
addrummond / gist:4548031
Last active December 11, 2015 04:49
This is a script for generating the strong paradigm for the Icelandic adjective 'kaldur' ('cold') according to the DM analysis given in a forthcoming paper on the Movement Theory of Control by me and Norbert Hornstein.
# coding=utf-8
import sys
from itertools import *
from sets import *
vocab_items = [(x[0], Set(x[1])) for x in
(u'kalt', ()),
(u'kaldur', ('+A', '+B')),
(u'köld', ('-B',)),
(u'kaldan', ('-pl', '+acc', '+A', '+B')),
@addrummond
addrummond / kaldur.py
Last active December 16, 2015 10:39
This is a Python script for computing the strong paradigm for Icelandic 'kaldur' ('cold') given the toy analysis presented in Drummond & Hornstein (forthcoming).
# coding=utf-8
import sys
from itertools import *
from sets import *
vocab_items = [(x[0], Set(x[1])) for x in
(u'kalt', ()),
(u'kaldur', ('+A', '+B')),
(u'köld', ('-B',)),
(u'kaldan', ('-pl', '+acc', '+A', '+B')),
/* This software is licensed under a BSD license; see the LICENSE file for details. */
function boolToInt(x) { if (x) return 1; else return 0; }
define_ibex_controller({
name: "MyDashedSentence",
jqueryWidget: {
_init: function() {
this.cssPrefix = 'DashedSentence-';
// ========== START OF CODE TO COPY INTO YOUR DATA FILE ==========
var IMAGES_TO_PRELOAD = [
// CHANGE THESE TO THE URLS OF THE IMAGES THAT YOU WANT TO PRELOAD
"https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Capra_ibex_nubiana_near_Mitzpe_Ramon_in_summer_2011_%284%29.JPG/1200px-Capra_ibex_nubiana_near_Mitzpe_Ramon_in_summer_2011_%284%29.JPG",
"http://elelur.com/data_images/mammals/alpine-ibex/alpine-ibex-01.jpg"
];
define_ibex_controller({
name: "Preloader",
jqueryWidget: {

Keybase proof

I hereby claim:

  • I am addrummond on github.
  • I am alexdrummond (https://keybase.io/alexdrummond) on keybase.
  • I have a public key ASAMFkJCiG1DjIEFh9ywx_lXhw8ViQsJtN7any7dRyN2Hwo

To claim this, I am signing this object:

Appendix to the blog post.

The following assumes that the alphabet is {A, B}. The results easily generalize.

Lemma 1: Two strings S1 and S2 have no string lexicographically between them iff S1 = S2A or S2 = S1A. (Proof at end.)

Definitions:

  • Two strings S1 and S2 are adjacent iff S1 ≠ S2 and there is no S3 such that S1 < S3 < S2 or S2 < S3 < S1.
// Set up the following environment variables and then run with the path to the 'deploy' dir as the first and only argument.
//
// export IBEXFARM_DATABASE_URL=postgresql://postgres:password@localhost:6432/nmibex_dev
// export IBEXFARM_QUOTA_ID=1
// export IBEXFARM_S3_HOST=http://localhost:9000
// export IBEXFARM_S3_BUCKET=nmibex-dev
// export IBEXFARM_NO_S3_SSL=true
// export IBEXFARM_USE_MINIO=true
// export AWS_ACCESS_KEY_ID=key
// export AWS_SECRET_ACCESS_KEY=password
@addrummond
addrummond / html_lint.ex
Last active March 17, 2021 09:10
Example HTML lint plug code
defmodule HtmlLintPlug do
require Logger
def init(opts), do: opts
def call(conn, _opts) do
Plug.Conn.register_before_send(conn, &lint/1)
end
defmodule Error do
#[rustler::nif]
fn lint(env: Env, input: String) -> Result<Term, Error> {
let parse_errors = lint_html::lint(input);
return convert_errors(env, parse_errors);
}
fn convert_errors(env: Env, parse_errors: Vec<(u64, String)>) -> Result<Term, Error> {
if parse_errors.len() == 0 {
return Ok(ok().to_term(env));
} else {
defmodule HtmlLintNative do
use Rustler, otp_app: :platform, crate: "platform_plugs_htmllintnative"
def add(_a, _b), do: error()
def lint(_html_string), do: error()
defp error(), do: :erlang.nif_error(:nif_not_loaded)
end