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 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 | |
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
/** | |
* 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 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 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 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 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
/** | |
* Checks if the class has been defined and Checks if the class method exists | |
* @param $class_object | |
* @param $method_name | |
* @return bool | |
*/ | |
function class_method_exists($class_object, $method_name) | |
{ | |
return class_exists($class_object) && method_exists($class_object, $method_name); | |
} |
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 base_url = 'https://api.github.com'; | |
function httpGet(theUrl, return_headers) { | |
var xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open("GET", theUrl, false); // false for synchronous request | |
xmlHttp.send(null); | |
if (return_headers) { | |
return xmlHttp | |
} | |
return xmlHttp.responseText; |
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="refresh" content="0; url=https://example.com.br"> | |
<script type="text/javascript"> | |
window.location.href = "https://example.com.br" | |
</script> | |
<title>Page Redirection</title> | |
</head> |
OlderNewer