This file contains hidden or 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 | |
/* | |
The aim is to create a functional server monitor based on the one | |
showed on Mark Zuckerberg's monitor on The Social Network movie. | |
Run so: | |
php monitor.php | |
Notes: | |
- The server LogFormat must be "Common Log Format" (%h %^[%d:%^] "%r" %s %b) |
This file contains hidden or 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
#cs | |
Range parser | |
This function parser printing-like intervals (like "1,2,3-5") and returns an array with every page number as item. | |
@author Jefrey S. Santos <jefrey[at]jefrey.ml> | |
#ce | |
Func rangeparser($interval) | |
$interval = StringReplace($interval, " ", "") | |
If Not StringRegExp($interval, "([0-9\-\,])") Then Return SetError(1, 0, False) | |
$interval = StringSplit($interval, ",") |
This file contains hidden or 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
/* | |
@author Jefrey S. Santos <github.com/jesobreira> | |
*/ | |
function currency(icoin1, icoin2, value, callback) { | |
if(typeof value == 'undefined') value = 1; | |
icoin1 = icoin1.toUpperCase(); | |
icoin2 = icoin2.toUpperCase(); | |
value = parseFloat(value); |
This file contains hidden or 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 | |
$user_rights = 3; // 1+2 (taken from database) | |
if(rights::can_read($user_rights)) echo "User can read\n"; | |
if(rights::can_write($user_rights)) echo "User can write\n"; | |
if(rights::can_modify($user_rights)) echo "User can modify\n"; | |
class rights { | |
static $READ = 1; |
This file contains hidden or 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 | |
/* | |
Based on CmdLine UDF for AutoIt (also mine): https://www.autoitscript.com/forum/topic/169610-cmdline-udf-get-valueexistenceflag/ | |
*/ | |
class cmdline { | |
function get($sKey, $mDefault = Null) { | |
global $argv,$argc; | |
for($i = 1; $i <= ($argc-1); $i++) { |
This file contains hidden or 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
/* | |
* Javascript makeslug() | |
* by J. Santos <jefrey[at]jefrey[dot]ml> | |
*/ | |
/* | |
Usage: | |
string makeslug( string val [, string replaceBy = "-" ] ) | |
Example: |
NewerOlder