This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# pproc | |
# Runs multiple subprocesses in parallel, serializing stdout. | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Wed Jun 14 15:20:05 2017 -0400 | |
# | |
# Copyright (C) 2017 Bengfort.com | |
# For license information, see LICENSE.txt | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function xpathEscape($query, $default_delim = '"') | |
{ | |
if (strpos($query, $default_delim) === false) | |
return $default_delim . $query . $default_delim; | |
preg_match_all("#(?:('+)|[^']+)#", $query, $matches); | |
list($parts, $apos) = $matches; | |
foreach ($parts as $i => &$part) { | |
$delim = $apos[$i] ? '"' : "'"; | |
$part = $delim . $part . $delim; |