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 App\Tests; | |
| use App\Calculator; | |
| class CalculatorTest extends \PHPUnit_Framework_TestCase | |
| { | |
| /** | |
| * @dataProvider addProvider |
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
| var conn = new Mongo(); | |
| db = conn.getDB('dbname'); | |
| db.image_fallback.update( | |
| {class: 'Exercise\\BlogBundle\\Document\\Blog'}, | |
| { | |
| $set: { | |
| 'image.extension': '.png', | |
| 'image.thumbnails': [] |
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
| Array.prototype.cut = function(f) { | |
| var res = [], | |
| i = 0; | |
| while (i < this.length) { | |
| if (f(this[i])) { | |
| res.push(this[i]); | |
| this.splice(i,1); | |
| } else { | |
| i++; | |
| } |
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
| take' :: Int -> [Int] -> [Int] | |
| take' x [] = [] | |
| take' 0 xs = [] | |
| take' x (xx:xxs) | |
| | x <= 0 = [] | |
| | otherwise = xx : take' (x-1) xxs |
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
| take' :: Int -> [Int] -> [Int] | |
| take' x [] = [] | |
| take' 0 xs = [] | |
| take' x (xx:xxs) = xx : take' (x-1) xxs |
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 | |
| class UserAdmin extends BaseUserAdmin | |
| { | |
| public function configureFormFields(FormMapper $formMapper) | |
| { | |
| $formMapper->add('dailyActivityLevel', 'choice', [ | |
| 'choices' => array_map( | |
| function ($string) { return strip_tags($string); }, | |
| array_map(function ($string) {return $this->translator->trans($string);}, DailyActivityLevelEnum::getReadables()) |
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
| // sprintf('You have %count% new emails from %name%!', [ | |
| // ['%count%', user.email.count], | |
| // ['%name%', user.firstName] | |
| // ]); | |
| var sprintf = function(str, replacementList) { | |
| if (typeof(replacementList)==='undefined') replacementList = []; | |
| var replacementTuple = replacementList.shift(); | |
| if (replacementTuple) |
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 Application\Migrations; | |
| use Doctrine\DBAL\Migrations\AbstractMigration; | |
| use Doctrine\DBAL\Schema\Schema; | |
| /** | |
| * Auto-generated Migration: Please modify to your needs! | |
| */ |
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
| "gallery": { | |
| "title": "Some title of gallery", | |
| "description": "Some description", | |
| "images": | |
| [[ | |
| { | |
| "reference": { | |
| "url": "http://api.theatre.pp.ua/uploads/employee/0001/01/04ca0b3159ff7dbf025d27a40e3fb15095c3b5ab.jpeg", | |
| "properties": { | |
| "alt": "a599975966f35acdd9010da76bcbb2b9a7854c82.jpeg", |
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
| public function findByDateRangeAndSlug(\DateTime $fromDate, \DateTime $toDate, $performanceSlug = null) | |
| { | |
| $qb = $this->createQueryBuilder('u') | |
| ->WHERE('u.dateTime BETWEEN :from AND :to') | |
| ->setParameter('from', $fromDate->format('Y-m-d H:i')) | |
| ->setParameter('to', $toDate->format('Y-m-d H:i')) | |
| ->orderBy('u.dateTime', 'ASC') | |
| ; | |
| if ($performanceSlug) { |