Skip to content

Instantly share code, notes, and snippets.

View TiuTalk's full-sized avatar
🌴
Tropical Developer

Thiago Belem TiuTalk

🌴
Tropical Developer
View GitHub Profile
@TiuTalk
TiuTalk / gist:5431318
Last active December 16, 2015 11:59
Prestashop
$ ab -kc 20 -t 60 http://demo-store.prestashop.com/en/evening-dresses/27-visconti-co-evening-dress.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking demo-store.prestashop.com (be patient)
Finished 220 requests
$ ab -kc 20 -t 60 http://super-boutique-3116.spree.mx/products/ruby-baseball-jersey
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking super-boutique-3116.spree.mx (be patient)
Finished 641 requests
$ php -v
PHP 5.4.13 (cli) (built: Apr 12 2013 14:04:31)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
brew install php54-memcached php54-apc php54-xdebug
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54 --with-mysql --wihout-apache
<?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 {
<?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',
<?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
<?php
// Pontuação dos dois times em cada partida
$partidas = [
[1, 2],
[3, 4],
[5, 1],
];
foreach ($partidas as list($timeA, $timeB)) {
<?php
function xrange($start, $limit, $step = 1) {
for ($i = $start; $i <= $limit; $i += $step) {
yield $i;
}
}
echo 'Números ímpares: ';