- Red
- Green
- Refactor (but stay green!)
Each function should test just one use case
<?php | |
namespace HunterBundle\Command; | |
use Symfony\Component\Console\Command\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Formatter\OutputFormatterStyle; |
<?php | |
//... some code | |
public function findByFieldIntoInterval(\DateTime $earlyDate, \DateTime $lateDate) | |
{ | |
$qb = $this->createQueryBuilder('e'); | |
$qb->where($qb->expr()->between('e.field', ':earlyDate', ':lateDate')); | |
01 - Always use Composer to install Symfony | |
test: $ composer --version | |
install: $ curl -sS https:://getcomposer.org/installer | php | |
$ sudo mv composer.phar /usr/local/bin/composer | |
02 - Creating a application | |
$ cd projects/ | |
$ composer create-project symfony/framework-standard-edition blog/ | |
$ cd blog/ |
<?php | |
// some code... | |
/** | |
* Query Builder to get all users with age > $age | |
* | |
* @param int $age | |
* | |
* @return Doctrine\ORM\QueryBuilder $qb |
PS1='\[\033[0;37m\][\t]\[\033[0;32m\][\u]\[\033[31m\][\h]`git branch 2>/dev/null | grep \* | head -1 | sed "s/\* //g" | awk "{ print \"[ \"\\\$1 \" ]\" }"` \[\033[1;33m\]\w\a\[\033[0m\]\n\$ ' |
var $phone = $("#fos_user_registration_form_phone"); | |
var maskOptions = {onKeyPress: function(phone) { | |
var masks = ['(00) 0000-0000', '(00) 00000-0000']; | |
mask = phone.match(/^\([0-9]{2}\) 9/g) | |
? masks[1] | |
: masks[0]; | |
$phone.mask(mask, this); | |
}}; | |
$phone.mask('(00) 0000-0000', maskOptions); |
<?php | |
$url = "http://localhost/labs/0100/02.php?url=http://ip.jsontest.com/"; | |
$jsonContent = file_get_contents($url); | |
$jsonObject = json_decode($jsonContent); | |
var_dump($jsonObject); | |
echo($jsonObject->ip); |
#!/bin/bash | |
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync | |
xrandr --addmode VGA1 "1920x1080_60.00" | |
xrandr --output VGA1 --mode "1920x1080_60.00" |