Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@antecedent
antecedent / fix-lit-transcription.py
Last active March 17, 2020 15:31
Fixes (mostly redoes) Lithuanian phonological transcription from Wiktionary-derived data
import csv
import sys
import logging
def transcribe(spelling):
defaults = {
'a': '?A', # Either long/tense or short/lax; use Wiktionary transcription to resolve
'ą': 'aː',
'b': 'b',
'c': 'ts',
@antecedent
antecedent / adresai.html
Created December 14, 2017 15:02
Mini užduotis
<!DOCTYPE html>
<html lang="lt">
<head>
<meta charset="utf-8">
<title>Pašto indeksai</title>
<script
src="https://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>
<style type="text/css">
@antecedent
antecedent / ad-hoc.php
Last active August 29, 2015 13:57
"Wrapping" a method using Patchwork 1.2
<?php
# Ad-hoc code for a hypothetical method named Filesystem::contains.
$replacement = function($path) use (&$replacement, &$handle) {
# Run code before the original function
echo 'Before', PHP_EOL;
# Make this replacement function disable itself
Patchwork\undo($handle);
# Call the original function
<?php
require __DIR__ . "/path/to/Patchwork.php";
use Patchwork\Preprocessor as pp;
pp\attach(array(function(pp\Source $s)
{
$needle = "var_dump"; # The function to replace
$replacement = "customDump"; # The replacement