This file contains hidden or 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 Acme\ForumBundle\Twig; | |
use Symfony\Component\DependencyInjection\ContainerInterface as Container; | |
use Symfony\Component\Security\Core\SecurityContext as SecurityContext; | |
class SubscriptionsStatExtension extends \Twig_Extension | |
{ | |
public function __construct(SecurityContext $securityContext, Container $container) |
This file contains hidden or 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
#-*- coding: utf-8 -*- | |
def split_vertical(im, separator_color=None): | |
""" | |
Split the image into several vertical images. | |
Split points defined by solid vertical strip of a background color | |
""" | |
# Original image size | |
image_width = im.size[0] |
This file contains hidden or 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 safe_nl2br($string) { | |
$string = str_replace("\n", "<br />", $string); | |
foreach (array('pre', 'code') as $tag) { | |
if(preg_match_all("/$tag>(.*?)<\/$tag/", $string, $match)) { | |
foreach($match as $a){ | |
foreach($a as $b){ | |
$string = str_replace("<$tag>".$b."</$tag>", "<$tag>".str_replace("<br />", "", $b)."</$tag>", $string); |
NewerOlder