View database.sql
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
-- Display All Database Sizes in MB | |
SELECT table_schema AS "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; | |
-- Display All Database Sizes in GB | |
SELECT table_schema AS "Database", ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 2) AS "Size (GB)" FROM information_schema.TABLES GROUP BY table_schema; | |
-- Display All Table Sizes for a Database in MB | |
SELECT table_name AS "Table", ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)" FROM information_schema.TABLES WHERE table_schema = "INSERT DATABASE NAME HERE" ORDER BY (data_length + index_length) DESC; |
View display-current-port-forwarding.sh
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
sudo pfctl -s nat |
View UserSettingDataMapper.php
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\DataMapper; | |
use Symfony\Component\Form\DataMapperInterface; | |
use Symfony\Component\Form\Exception\UnexpectedTypeException; | |
use Symfony\Component\Security\Core\User\UserInterface; | |
class UserSettingDataMapper implements DataMapperInterface | |
{ | |
public function mapDataToForms($data, $forms) |
View UserProfileSettingsType.php
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 AppBundle\Form\DataMapper\UserSettingDataMapper; | |
class UserProfileSettingsType extends AbstractType | |
{ | |
public function buildForm(FormBuilderInterface $build, array $options) |
View UserSetting.php
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; | |
use Symfony\Component\Security\Core\User\UserInterface; | |
class UserSetting | |
{ | |
/** | |
* @var UserInterface |
View User.php
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; | |
use Doctrine\Common\Collections\ArrayCollection; | |
use Doctrine\Common\Collections\Criteria; | |
/** | |
* This assumes you already have a User entity, this just shows the parts | |
* required |
View gist.php
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 | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
use Symfony\Component\HttpFoundation\File\File; | |
public function streamAction() | |
{ | |
$file = new File('/path/to/largefile.ext'); | |
// in case you need the container | |
$container = $this->container; | |
$response = new StreamedResponse(function() use($container, $file) { |
View gist.php
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 | |
protected function interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$validator = Validation::createValidator(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value) use($validator){ | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); |
View gist.php
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 | |
protected function interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', function($value){ | |
$validator = Validation::createValidator(); | |
$errors = $validator->validateValue($value, new Assert\NotBlank()); | |
if (count($errors)) { | |
throw new \InvalidArgumentException((string) $errors); |
View gist.php
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 | |
protected function interact(InputInterface $input, OutputInterface $output) | |
{ | |
$dialog = $this->getDialogHelper(); | |
$inputValue = $dialog->askAndValidate($output, 'Enter some input: ', array($this, 'validateInput')); | |
} | |
public function validateInput($value) | |
{ |
NewerOlder