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 SimplePaginator | |
{ | |
protected $pageCount; | |
protected $pageRangeLength = 5; | |
public function __construct($pageCount, $pageRangeLength) | |
{ |
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 | |
// Disable layouts. | |
$this->_helper->layout->disableLayout(); | |
// Disable view. | |
$this->_helper->viewRenderer->setNoRender(true); |
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 | |
if ($argc < 2) { | |
echo 'Usage: json2csv.php [input.json] output.csv', PHP_EOL; | |
exit(1); | |
} | |
$input = fopen($argc === 3 ? $argv[1] : 'php://stdin', 'r'); |
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
UPDATE | |
wp_options | |
SET | |
option_value = REPLACE(option_value, 'oldhost/somedirectory', 'newhost') | |
WHERE | |
option_value LIKE '%oldhost/somedirectory%'; |
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
<div class="hidden-sm-up">XS</div> | |
<div class="hidden-md-up hidden-xs-down">SM</div> | |
<div class="hidden-lg-up hidden-sm-down">MD</div> | |
<div class="hidden-xl-up hidden-md-down">LG</div> | |
<div class="hidden-lg-down">XL</div> |
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 | |
// Assumes that the lower and upper bounds are exclusive | |
$scenarios = [ | |
// [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA] | |
// [BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB] | |
['14:00', '15:00', '14:00', '15:00', true], |
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 mb_ucfirst($value) | |
{ | |
return mb_strtoupper(mb_substr($value, 0, 1)) . mb_substr($value, 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 | |
/** | |
* This function fixes string lengths before unserializing a value, | |
* in case some content was found and replaced, for example. | |
* | |
* @param string $str | |
* @param array $options | |
* @return mixed | |
*/ |
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 | |
\DB::enableQueryLog(); | |
$foo = Foo::find(1); | |
dd(\DB::getQueryLog()); |
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
# IMPORTANT: if there are another rules, put these ones right after "RewriteEngine on" | |
# Force non-www | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com [NC] | |
RewriteRule ^(.*)$ http://mydomain.com/$1 [L,R=301] | |
# Force www | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com [NC] |
OlderNewer