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 useAuth = (): AuthContextInterface => { | |
const context = useContext(AuthContext); | |
if (!context) { | |
throw new Error('useAuth must be used within a AuthProvider'); | |
} | |
return context; | |
}; |
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 | |
/** | |
* Convert a multidimensional array to an object recursively. | |
* For any arrays inside another array, the result will be an array of objects. | |
* | |
* @author Marcos Freitas | |
* @param array|any $props | |
* @return array|any | |
*/ |
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
function PressKeyToContinue() { | |
printf "\n"; | |
question="Pressione S para continuar ou qualquer outra tecla para pular essa parte execução do script"; | |
expected_key_pressed='s'; | |
abort_script=false; | |
if [ ! -z "$1" ]; then | |
question="${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
<?php | |
# check for palindrome words | |
# if the word have almost 1 letter to be changed to be a plindrome, it will be a palíndrome. | |
function isAlmostPalindrome($word) { | |
$count_diference = 0; | |
$word_reverse = strrev($word); | |
$word_as_array = str_split($word); |
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 | |
namespace App\Controllers\Site\Ads; | |
use Silex\Application; | |
use Symfony\Component\HttpFoundation\Request; | |
use Silex\Api\ControllerProviderInterface; | |
class AdsControllerProvider implements ControllerProviderInterface { |
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
<title> | |
<?php | |
if(is_home()): | |
bloginfo('name'); | |
elseif( is_category() || is_tag() ): | |
single_cat_title(); echo ' • '; bloginfo('name'); | |
elseif( is_single() || is_page() ): | |
single_post_title(); | |
else: |
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 | |
/** | |
* Check if a string is a valid based on $formats['input'], then format an output based on $formats['output'] | |
* @author Marcos Freitas | |
* @param string $value The string of the date | |
* @param array $formats The given input and wanted output formats of the date. | |
* @return string|boolean | |
*/ | |
public static function getDate($value, $formats){ |
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
<style> | |
.mf-pagination { | |
display: block; | |
list-style: none; | |
margin: 2em 0 0 0; | |
width: 100%; | |
padding: 1em; | |
text-align: right; | |
font-size: 1.2em; | |
} |
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
# Project'a Structure | |
# localhost/projects/myProject/ | |
# -- .htacess | |
# | -- RewriteEngine On | |
# | -- RewriteBase /projects/myProject/ | |
# | -- DirectoryIndex web/index.php | |
# -- src/ | |
# ----- App/ | |
# -- web/ |
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 | |
namespace App; | |
/** | |
* Esta classe é apenas um Wrapper para a classe SoapClient e realiza as requisições e recebe as respostas de forma padrão. | |
*/ | |
class Soap { | |
public | |
$__client, |
NewerOlder