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 randomStringGenerator($length) | |
{ | |
$string = ''; | |
$start_frequency = ['a' => 1160,'b' => 470,'c' => 351,'d' => 267,'e' => 201,'f' => 378,'g' => 195,'h' => 723,'i' => 629,'j' => 60,'k' => 59,'l' => 271,'m' => 438,'n' => 237,'o' => 626,'p' => 255.,'q' => 17,'r' => 165,'s' => 776,'t' => 1667.,'u' => 149,'v' => 65,'w' => 675,'x' => 2,'y' => 162,'z' => 3]; | |
$letter_frequency = ['a' => 817,'b' => 149,'c' => 278,'d' => 425,'e' => 1270,'f' => 223,'g' => 202,'h' => 609,'i' => 697,'j' => 15,'k' => 77,'l' => 403,'m' => 241,'n' => 675,'o' => 751,'p' => 193,'q' => 10,'r' => 599,'s' => 633,'t' => 906,'u' => 276,'v' => 98,'w' => 236,'x' => 15,'y' => 197,'z' => 7]; | |
$starters = array(); |
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 | |
foreach ($data as $method=>$value) { | |
$reflect_class = new \ReflectionClass($task); | |
$reflect_method = $reflect_class->getMethod($method); | |
$reflection_params = $reflect_method->getParameters(); | |
// The first param should always be an object, if it is one at all | |
$param_class = $reflection_params[0]; | |
if ($param_class) { |
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 AppBundle\EventSubscriber; | |
use FOS\UserBundle\Event\FormEvent; | |
use FOS\UserBundle\FOSUserEvents; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Symfony\Component\HttpFoundation\Session\Session; | |
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
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 AppBundle\Form\Type; | |
use Symfony\Component\Form\AbstractType; | |
use Symfony\Component\Form\FormBuilderInterface; | |
use Symfony\Component\OptionsResolver\OptionsResolverInterface; | |
class CampaignFormType extends AbstractType | |
{ |
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 AppBundle\Entity\Traits; | |
use Doctrine\ORM\Mapping as ORM; | |
trait TimestampTrait | |
{ | |
/** | |
* @var \DateTime |
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
/** | |
* @param $text | |
* | |
* @return mixed|string | |
*/ | |
private function preprocessText($text) | |
{ | |
// Remove the first two lines | |
$text = implode("\n", array_slice(explode("\n", $text), 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule {your rule here} | |
</IfModule> |
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 MyVendor\AppBundle\Security\Authorization\Voter; | |
use MyVendor\AppBundle\Entity\Profile; | |
use MyVendor\AppBundle\Entity\User; | |
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; | |
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; | |
class ProfileAccessVoter implements VoterInterface |
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
MyBundle\AppBundle\Entity\Profile: | |
constraints: | |
- Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: website | |
properties: | |
website: | |
- NotBlank: ~ | |
- Url: | |
message: 'This URL is already in use.' | |
username: | |
- NotBlank: ~ |
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 Acme\AppBundle\Twig; | |
use Acme\AppBundle\Service\MetadataInterface; | |
class MetadataExtension extends \Twig_Extension | |
{ | |
private $task_metadata; |
NewerOlder