Tipo | Regex | Testar |
---|---|---|
(12) 3456-7891 ou (12) 3456-78910 | /^\(\d{2}\) \d{4}-\d{4,5}$/gi |
🔍 |
1234567891 ou 12345678910 | /^\d{10,11}$/gi |
🔍 |
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
/** | |
* Simple multi-bytes ucfirst() | |
* @param $str | |
* @return string | |
*/ | |
function mb_ucfirst_fix($str) | |
{ | |
return mb_strtoupper(mb_substr($str, 0, 1)) . mb_substr(mb_strtolower($str), 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
/** | |
* It's a modified file_get_contents() | |
* get_contents(filename, use_include_path, context, offset, maxlen) | |
* @param $url | |
* @param bool $u | |
* @param null $c | |
* @param null $o | |
* @return bool|string | |
* @package https://stackoverflow.com/questions/8673272/php-if-file-get-contents-fails-do-this-instead | |
*/ |
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
/** | |
* FIX_BUG: filter_input() doesn't work with INPUT_SERVER or INPUT_ENV when you use FASTCGI | |
* @param $type | |
* @param $variable_name | |
* @param int $filter | |
* @param null $options | |
* @return mixed|null | |
* @package https://stackoverflow.com/questions/25232975/php-filter-inputinput-server-request-method-returns-null/25385553 | |
*/ | |
function filter_input_fix($type, $variable_name, $filter = FILTER_DEFAULT, $options = null) |
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
/** | |
* List true files and true directories inside the specified path | |
* @param $directory | |
* @return array | |
*/ | |
function true_scandir($directory) | |
{ | |
$result = []; | |
$cdir = scandir($directory); | |
foreach ($cdir as $key => $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
#!/usr/bin/env ruby | |
HOSTS_FILE = "hosts" | |
MY_HOSTS_FILE = "hosts.marciog" | |
ENTRY_MARK = "########## STARTING PERSONAL CONFIGURATION ##########\n" | |
def contains_entry? | |
contains = false | |
NewerOlder