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
%% | |
/** | |
* Anderson Jean Fraga | |
* 13180375 | |
* Compiladores - Trabalho 1 - Exercicio 1 | |
*/ | |
%public | |
%class Lexica_01 |
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 | |
class IPv4Subnet | |
{ | |
private $address, $mask; | |
function __construct($ip) | |
{ | |
list($this->address, $this->mask) = $this->toBin($ip); | |
} |
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
(******************** | |
Especifique a função mediaListaSemPares que recebe uma lista de inteiros umaLista e retorna a média dos elementos de umaLista, descartando os valores pares (listas com 1 ou nenhum elemento, retornam vazias) | |
********************) | |
fun listaSemPares umaLista = List.filter (fn x => x mod 2 <> 0) umaLista; | |
fun somaLista [] = 0 | |
| somaLista (x::res) = x + somaLista res; | |
fun mediaListaSemPares [] = 0.0 | |
| mediaListaSemPares umaLista = |
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
class Conta | |
{ | |
private BigDecimal saldo; | |
public Teste() | |
{ | |
saldo = new BigDecimal(0.0); | |
} | |
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
# alias | |
alias la='ls -la --color=auto' | |
alias ..='cd ..' | |
alias .='pwd' | |
alias www='cd /www' | |
alias cntfiledir='ls -l | awk "!/^d/{print }" | wc -l' | |
alias g='git' | |
export PATH=$HOME/local/bin:$PATH |
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/php | |
<?php | |
require '../phpwatcher.php'; | |
phpwatcher(['./tests/unit/', './module/'], '(.*)\.php', function ($file) { | |
echo ($exec = "php-cs-fixer fix {$file} --level=all") . PHP_EOL; | |
system($exec); | |
echo PHP_EOL; | |
}); |
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 | |
function dateFormat($date) { | |
if (!$date) { | |
return ''; | |
} | |
$nowDay = new DateTime('now'); | |
$pastDay = new DateTime($date); |
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/php | |
<?php | |
require '../phpwatcher.php'; | |
phpwatcher(['./module/','./tests/unit/'], '(.*)\.php', function ($_, $objfile) { | |
echo "\nChanged {$_}\n"; | |
echo ($exec = 'cd ./tests/unit/ && phpunit .') . PHP_EOL; | |
system($exec); | |
echo PHP_EOL; |
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 | |
$diff = array_diff_assoc(array(array('dsa' => '2')), array(array(),array())); | |
if (count($diff)) { | |
print_r($diff); | |
} | |
echo '<br />Gerou um "PHP Notice: Array to string conversion" na linha 3'; | |
echo '<br />----'; |
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 | |
$request = $e->getRequest(); | |
$needHttps = (preg_match($listNeedHttps, $request->getRequestUri()) != false); | |
$isHttps = ($request->getUri()->getScheme() == 'https'); | |
$isGetMethod = ('GET' == $request->getMethod()); | |
$url = new Http($request->getUri()); | |
if ($needHttps and !$isHttps and $isGetMethod) { | |
$url->setScheme('https'); |