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
/* mg.c - my-grep implementation, portable regex and search implementation in pure C | |
* | |
* should build on UNIX/Linux-like OSes no problem, should also work on Windows Subsystem for Linux (WSL) | |
* | |
* regex syntax: read the second comment block in this file | |
* | |
* compile like: | |
* $ cc mg.c -o mg | |
* | |
* then you can run like: |
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 | |
/* | |
* PHP array_reduce_key (v0.11) - array_reduce with additional parameters | |
* array_reduce with key, | |
* (javascript like reduce method) | |
* (if initial value of carry is not specified, null is used) | |
* | |
* PHP array_reduce_JS (v0.12) - array_reduce with additional parameters | |
* (javascript like reduce method) | |
* if initial value of carry is not specified, first item of input ARRAY is used, and CALLBACK starts on the second item |
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
/** | |
* Converts a JS object to PHP object | |
**/ | |
function jsObj2phpObj(object){ | |
var json = '{'; | |
for(property in object){ | |
var value = object[property]; | |
if(typeof(value) == 'string'){ | |
json += '"' + property + '":"' + value + '",' | |
} else { |