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 | |
// Valor salvo no banco de dados | |
$hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; | |
// Senha digitada pelo usuário | |
$senha = 'rasmuslerdorf'; | |
if (password_verify($senha, $hash)) { | |
echo 'Senha correta'; | |
} 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 | |
// Usando as opções default | |
echo password_hash("rasmuslerdorf", PASSWORD_DEFAULT) . "\n"; | |
// $2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a | |
// Definindo o custo e o salt | |
$options = [ | |
'cost' => 7, | |
'salt' => 'BCryptRequires22Chrcts', |
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 | |
// Velha sintaxe de arrays | |
$nome = array('Thiago', 'Fulano', 'Silva')[1]; // Fulano | |
// Nova sintaxe de arrays | |
$nome = ['Thiago', 'Fulano', 'Silva'][2]; // Silva | |
// Também funciona com strings: | |
$letra = 'Thiago'[0]; // T |
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 | |
// Pontuação dos dois times em cada partida | |
$partidas = [ | |
[1, 2], | |
[3, 4], | |
[5, 1], | |
]; | |
foreach ($partidas as list($timeA, $timeB)) { |
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 xrange($start, $limit, $step = 1) { | |
for ($i = $start; $i <= $limit; $i += $step) { | |
yield $i; | |
} | |
} | |
echo 'Números ímpares: '; |
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
> 2d7f605 Transformar a tabela do monitoramento em blocos de texto | |
> a2343ef Project version | |
> d609564 cliente precisa que se insira no relatório CSV os dados da última atualização do monitoramento | |
> 8f4c7e1 Identificador no CSV | |
> d5b660f KMZs | |
> 20ef2f6 Project version | |
> 15378be Fix: perímetros da comunidade e da UPP não estão sendo mostrados no mapa | |
> e868609 Fix: verificar users/monitoring | |
> b8d64cc Fix for PHP 5.2 | |
> 684546f Mapas e gráficos por território |
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
<phpunit colors="true" stopOnFailure="true" encoding="utf-8"> | |
<filter> | |
<whitelist> | |
<directory>Controller</directory> | |
<directory>Model</directory> | |
<directory>View</directory> | |
<directory>Lib</directory> | |
<directory>Console</directory> | |
</whitelist> | |
</filter> |
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 | |
$id = $d["Palestrante"]["id"]; | |
$nome = Inflector::slug(strtolower($d["Palestrante"]["nome"]), "-"); | |
echo $this->Html->link("Ver", array("controller" => "palestrantes", "action" => "ver", "id" => $id, "nome" => $nome))); |
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 getGitHubStats(callback, page, items) { | |
var page = page || 1, | |
items = items || [], | |
maxPage = 3; | |
$.ajax({ | |
type: 'GET', | |
url: 'https://api.github.com/users/TiuTalk/events', | |
data: { page: page }, | |
async: 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
rake about # List versions of all Rails frameworks and the environment | |
rake assets:clean # Remove compiled assets | |
rake assets:precompile # Compile all the assets named in config.assets.precompile | |
rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config) | |
rake db:drop # Drops the database using DATABASE_URL or the current Rails.env (use db:drop:all to drop all databases) | |
rake db:fixtures:load # Load fixtures into the current environment's database. | |
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false). | |
rake db:migrate:status # Display status of migrations | |
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n). | |
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR |