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 | |
namespace Cygnus\ApplicationBundle\EventListener; | |
use Doctrine\Common\EventSubscriber; | |
use Doctrine\MongoDB\Event\AggregateEventArgs; | |
use Doctrine\MongoDB\Event\FindEventArgs; | |
use Doctrine\MongoDB\Event\MutableEventArgs; | |
use Symfony\Bridge\Monolog\Logger; |
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 ParseEmbeddedImages { | |
public function __construct(array $doc = []) | |
{ | |
$this->date = new \DateTime($doc['created']); | |
return $this->parse($doc['body']); | |
} |
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 | |
conf="/Applications/MAMP/bin/php/php5.6.10/conf/php.ini" | |
extension='zend_extension="/Applications/MAMP/bin/php/php5.6.10/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"' | |
extension_e='zend_extension="\/Applications\/MAMP\/bin\/php\/php5.6.10\/lib\/php\/extensions\/no-debug-non-zts-20131226\/xdebug.so"' | |
mode=$1 | |
if [ "disable" == "$mode" ]; then | |
echo "Disabling Xdebug in PHP CLI configuration." | |
sed -i.bak s/.*zend_extension\=.*xdebug\.so.*/\;$extension_e/g $conf | |
exit 0 |
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 | |
path="/Applications/MAMP/bin/php/php5.4.38/" | |
conf="$path/conf/php.ini" | |
extension='zend_extension="/Applications/MAMP/bin/php/php5.4.38/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"' | |
extension_e='zend_extension="\/Applications\/MAMP\/bin\/php\/php5.4.38\/lib\/php\/extensions\/no-debug-non-zts-20100525\/xdebug.so"' | |
mode=$1 | |
if [ "disable" == "$mode" ]; then | |
echo "Disabling Xdebug in PHP CLI configuration." | |
sed -i.bak s/.*zend_extension\=.*xdebug\.so.*/\;$extension_e/g $conf |
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
/** | |
* Automatically includes hard linked images into Battle.net forum posts | |
* | |
* @host http://us.battle.net | |
* @require jQuery 1.11.0 | |
* @author solocommand <solocommand@gmail.com> | |
*/ | |
$('.post-detail').each(function() { | |
var text = $(this).text(); | |
var images = text.match(/https?:\/\/(?:\S){1,}\.(?:\w){2,4}\/(?:\S){1,}\.(?:\w){2,4}/ig); |
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 | |
namespace MyApp\Documents; | |
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; | |
class Post | |
{ | |
/** | |
* @MongoDB\ReferenceOne(targetDocument="User", inversedBy="posts", simple=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 | |
namespace Cygnus\Ldap; | |
use Symfony\Component\HttpKernel\Log\LoggerInterface; | |
class Connection | |
{ | |
private $params = array(); | |
private $logger; |
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 | |
namespace Cygnus\BaseBundle\Composer; | |
use Composer\Script\Event; | |
use Sensio\Bundle\GeneratorBundle\Manipulator\KernelManipulator; | |
class ScriptHandler | |
{ |
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 | |
# | |
# Usage: ./cpimages.sh oldPath newPath | |
# Example: ./cpimages.sh /data/media/files/cygnus/KBDN/image /data/media/files/base/sola/kbdn/image | |
# | |
mediaPath=$1 | |
newPath=$2 | |
#set -x | |
cd $mediaPath |
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 | |
// .. | |
$start = time(); | |
$jobs = array('processed' => array()); | |
// For one minute, iterate over available jobs and run them. | |
while (time() > $start + 60) { | |
$query = sprintf('SELECT * FROM job WHERE status = 1 AND priority = "%s" AND (type = "onetime" OR (type = "reoccuring" AND (start is null OR NOW() >= start) AND (stop is null or NOW() < stop) AND NOW() >= DATE_ADD(last_started, INTERVAL `interval` MINUTE))) LIMIT 1;', (int) $priority); | |
fbl($query); |