I hereby claim:
- I am ubermichael on github.
- I am ubermichael (https://keybase.io/ubermichael) on keybase.
- I have a public key ASAjm4-rj1faxQCbVfkmiP5lkSRekgClKpG5wOO1mihjbwo
To claim this, I am signing this object:
| $(function(){ | |
| var hostname = window.location.hostname.replace('www.', ''); | |
| $('a').each(function(){ | |
| var link_host = $(this).attr('hostname').replace('www.', ''); | |
| if(link_host !== hostname) { | |
| $(this).attr('target', '_blank'); | |
| } | |
| }); | |
| }); |
I hereby claim:
To claim this, I am signing this object:
| declare namespace xhtml="http://www.w3.org/1999/xhtml"; | |
| let $wc := | |
| for $p in collection('/db/apps/wilde-data/data')//xhtml:p | |
| return count(tokenize($p, '\s')) | |
| return sum($wc) | |
| Based heavily on https://gist.github.com/gmcharlt/f7e3bcb3680a5bf748aacd7e21c13175 | |
| ```perl | |
| #!/usr/bin/env perl | |
| use 5.014; | |
| use utf8; | |
| use strict; | |
| use warnings; |
| xquery version "3.0"; | |
| (: | |
| Sadly, the eXist 2.2 normalize-unicode() function is broken. So we call out | |
| to the java one. | |
| :) | |
| declare namespace normalizer = "java:java.text.Normalizer"; | |
| declare namespace form = "java:java.text.Normalizer$Form"; | |
| declare function local:normalize($string as item()) as xs:string { |
| <?php | |
| foreach(array(true, false, null, 'a') as $a) { | |
| var_dump($a); | |
| switch($a) { | |
| case true: | |
| print "true"; | |
| break; | |
| case null: | |
| print "null"; |
| set_error_handler(function($number, $msg, $file, $line, $vars){ | |
| print "$msg:$file:$line\n"; | |
| }); |
| # OS X | |
| sudo lsof -i tcp:3000 | |
| # Older OS X - PID is second to last number. | |
| netstat -vanp tcp | grep 3000 |
| git submodule deinit -f path/to/submodule | |
| rm -rf .git/modules/path/to/submodule | |
| git rm -f path/to/submodule |
| $nodes = $xp->query('/tei:TEI/tei:text//node()[self::text() or self::tei:pb]'); | |
| for($n = 0; $n < $nodes->length; $n++) { | |
| $node = $nodes->item($n); | |
| if($node instanceof DOMNode && $node->nodeType === XML_ELEMENT_NODE) { | |
| $pageCount++; | |
| $content = preg_replace("/[[:space:]]{2,}/u", ' ', $text) . "\n"; | |
| $fn = sprintf("%s/%s_%04d", $dir, $id, $pageCount); | |
| file_put_contents($fn, $content); | |
| $text = ''; | |
| } |