some tools for diagrams in software documentation
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 | |
/* | |
consider decomposing the characters to "capture" more "obscure" characters such as ṩ | |
- http://www.php.net/manual/en/normalizer.normalize.php#92592 | |
*/ | |
/** | |
* Normalize a string to only contain alphanumeric characters and dashes. | |
* |
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
<!-- { firstLevel: 3 } --> | |
<h3>First <em>Level</em> headline</h3> | |
<p>first level content</p> | |
<h4>Second Level headline alpha</h4> | |
<p>second level content alpha</p> | |
<h5>Third Level headline alpha</h5> | |
<p>third level content alpha</p> | |
<h4>Second Level headline bravo</h4> | |
<p>second level content bravo</p> |
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
// see http://rodneyrehm.de/t/url-regex.html#imme_emosol for the complete table | |
// expression by | |
var url_pattern = /^(https?|ftp|torrent|image|irc):\/\/(-\.)?([^\s\/?\.#-]+\.?)+(\/[^\s]*)?$/i; | |
var valid = [ | |
"http://foo.com/blah_blah", | |
"http://foo.com/blah_blah/", | |
"http://foo.com/blah_blah_(wikipedia)", | |
"http://foo.com/blah_blah_(wikipedia)_(again)", |
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 | |
class FileDownload | |
{ | |
public static $_response_status = array( | |
200 => 'OK', | |
201 => 'Created', | |
204 => 'No Content', | |
206 => 'Partial', | |
207 => 'Multi-Status', // WTF ?? |
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
// ==UserScript== | |
// @name anti key-grabber | |
// @description Prevent web apps from capturing and muting vital keyboard shortcuts | |
// @grant none | |
// @version 1.1 | |
// ==/UserScript== | |
(function(){ | |
var isMac = unsafeWindow.navigator.oscpu.toLowerCase().contains("mac os x"); | |
unsafeWindow.document.addEventListener('keydown', function(e) { | |
if (e.keyCode === 116) { |
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
const axios = require('axios') | |
const LinkHeader = require('http-link-header') | |
const nextPage = (header) => { | |
const link = LinkHeader.parse(header) | |
const [ next ] = link.get('rel', 'next') | |
return next && next.results === 'true' ? next.uri : null | |
} |
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 | |
mb_internal_encoding('UTF-8'); | |
/** | |
* multibyte string compatible range('A', 'Z') | |
* | |
* @param string $start Character to start from (included) | |
* @param string $end Character to end with (included) | |
* @return array list of characters in unicode alphabet from $start to $end |
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
#!/opt/local/bin/php | |
<?php | |
/* | |
1) replace the shebang (first line) with the path to your php binary | |
(probably something like /usr/bin/php) | |
2) move the file to /usr/local/bin/datauri.php | |
(this should be in your PATH) | |
3) chmod ugo+rx /usr/local/bin/datauri.php | |
(make the script executable for everyone) |
NewerOlder