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 | |
/** | |
* Calculate a precise time difference. | |
* @param string $start result of microtime() | |
* @param string $end result of microtime(); if NULL/FALSE/0/'' then it's now | |
* @return flat difference in seconds, calculated with minimum precision loss | |
*/ | |
function microtime_diff($start, $end = null) | |
{ | |
if (!$end) { |
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
mogrify -background transparent -gravity center -extent 20x20 -format png -colorspace sRGB -define png:color-type=6 -path resized *.png |
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
# more info: http://www.vionblog.com/linux-delete-files-older-than-x-days/ | |
find . -type f -name '*.png' -mtime +30 -exec rm {} \; | |
# better use delete flag :) | |
find . -type f -name '*.png' -mtime +30 -delete; | |
# use -mmin instead of -mtime for minutes |
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
# place in /etc/logrotate.d/ | |
{DIR}*.log { | |
daily | |
rotate 7 | |
compress | |
delaycompress | |
notifempty | |
} |
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
// good old times | |
http://www.youtube.com/watch?v=S1ULpM-lTMY |
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 | |
/** | |
* Mds_MagentoExtender_Model_Sendfriend_Sendfriend for our extension. Use your own name. | |
*/ | |
class Mds_MagentoExtender_Model_Sendfriend_Sendfriend extends Mage_Sendfriend_Model_Sendfriend { | |
public function send() | |
{ | |
if ($this->isExceedLimit()){ | |
Mage::throwException(Mage::helper('sendfriend')->__('You have exceeded limit of %d sends in an hour', $this->getMaxSendsToFriend())); |
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
mogrify -strip -interlace Plane -format jpg -colorspace sRGB -quality 85 *.png |
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
ffmpeg -i file.mp3 -f segment -segment_time 7200 -c copy out%03d.mp3 | |
# -segment_time in seconds |
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
/** | |
* Provides get_localized_links function in the Twig. | |
* | |
* Class LanguageSwitcherExtension | |
*/ | |
class LanguageSwitcherExtension extends \Twig_Extension | |
{ | |
/** | |
* Pimcore documents service which provide needed methods. | |
* |
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 | |
/** | |
* TranslateUpdateTrait | |
*/ | |
use Doctrine\DBAL\Schema\Schema; | |
/** | |
* Class TranslateUpdateTrait | |
* |
OlderNewer