Os títulos mais votados (até dez) formarão uma nova enquete, onde o autor do título vencedor ganhará um incrível prêmio!
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 slug($string) | |
{ | |
$string = utf8_decode($string); | |
$string = html_entity_decode($string); | |
$string = strip_tags($string); | |
$string = strtr($string, utf8_decode('ÀÁÃÂÉÊÍÓÕÔÚÜÇàáãâéêíóõôúüç'), 'AAAAEEIOOOUUCaaaaeeiooouuc'); | |
$string = preg_replace('/[^\\w\\d_\\s-]/si', '', $string); | |
$string = preg_replace('/\\s/', '-', $string); | |
$string = strtolower($string); |
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 interval($seconds, $granularity = 2) | |
{ | |
$units = array( | |
'1 year|:count years' => 31536000, | |
'1 week|:count weeks' => 604800, | |
'1 day|:count days' => 86400, | |
'1 hour|:count hours' => 3600, | |
'1 min|:count min' => 60, | |
'1 sec|:count sec' => 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 | |
function progress($current, $total = null, $extra = null) | |
{ | |
static $width = null; | |
static $startTime = null; | |
if ( $width === null ) { | |
if ( strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ) | |
$width = 80; | |
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 | |
function galvao(array $a) { | |
$b = array('e', array_pop($a)); | |
echo implode(', ', $a) . ' ' . implode(' ', $b); | |
} | |
function tassoevan(array $times) { | |
echo implode(', ', array_slice($times, 0, -1)), ' e ', end($times); | |
} |
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
{ | |
... | |
"scripts": { | |
"newman": "php -S 127.0.0.1:8080 -t public_html public_html/index.php & newman -c tests.json.postman_collection -e environment.json && kill $!" | |
} | |
} |
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 first() | |
{ | |
echo "#1\n"; | |
return false; | |
} | |
function second() | |
{ | |
echo "#2\n"; |
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 | |
$env = $app->environment(); | |
if ($env['REQUEST_METHOD'] == 'POST') { | |
$contentLength = intval($env['CONTENT_LENGTH']); | |
$postMaxSize = ini_get('post_max_size'); | |
if (preg_match('/^(\\d+)([PTGMK])$/iu', $postMaxSize, $matches)) { | |
$postMaxSize = intval($matches[1]); | |
switch (strtoupper($matches[2])) { |
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
<!-- I have this --> | |
<hgroup class="page-header"> | |
<h1><a href="{{ site.url }}{{ page.url }}">{{ 'Using `DateTime` class' }}</a></h1> | |
</hgroup> | |
<!-- Rendering as --> | |
<hgroup class="page-header"> | |
<h1><a href="/posts/using-datetime-class">Using `DateTime` class</a></h1> | |
</hgroup> | |
<!-- I want this --> |
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
#!/bin/bash | |
# We need mplayer | |
if [ -z `which mplayer` ]; then | |
sudo apt-get install mplayer | |
fi | |
# We need lame | |
if [ -z `which lame` ]; then | |
sudo apt-get install lame |
OlderNewer