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 | |
/** | |
* I'd like to use IPC sockets (ipc://foo.ipc) but my virtual machine won't let me ... :) | |
* IPC sockets will be faster than TCP, so this script could run even faster than it does! | |
*/ | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputOption; |
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\Translation\TranslatorInterface; | |
function format(\DateTime $date, TranslatorInterface $translator) | |
{ | |
$diff = date_create()->diff($date); | |
$seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s; | |
$format = $translator->transChoice('reldate', $seconds); |
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\Translation\TranslatorInterface; | |
function format(\DateTime $date, TranslatorInterface $translator) | |
{ | |
$diff = date_create()->diff($date); | |
$seconds = $diff->days * 86400 + $diff->h * 3600 + $diff->i * 60 + $diff->s; | |
$format = $translator->transChoice('reldate', $seconds); |
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
= Ubuntu Natty 64 Server Vagrant Base Box | |
== Description | |
This is a Vagrant Base Box based upon the Ubuntu Natty 64 Server. It was built | |
according to the Vagrant Base Box building guide: | |
http://vagrantup.com/docs/base_boxes.html | |
This box's main characteristic is the use of Ruby 1.9.2 built from source. |
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
set :shared_files, [app_path + "/config/parameters.yml"] | |
namespace :symfony do | |
namespace :configure do | |
def shared_parameters_path | |
"#{shared_path}/#{app_path}/config/parameters.yml" | |
end | |
def app_parameters_path | |
"#{latest_release}/#{app_path}/config/parameters.yml" |
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 | |
$faker = \Faker\Factory::create(); | |
$populator = new \Faker\ORM\Propel\Populator($faker); | |
$populator->addEntity('Author', 10000); | |
$populator->addEntity('Book', 100000, $customColumnFormatters = array( | |
'ISBN' => function () use ($generator) { return $generator->randomNumber(13); }, | |
)); | |
$populator->addEntity('Review', 1000000); | |
$insertedPKs = $populator->execute(); |
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 | |
$faker = \Faker\Factory::create(); | |
$populator = new \Faker\ORM\Propel\Populator($faker); | |
$populator->addEntity('Author', 10000); | |
$populator->addEntity('Book', 100000); | |
$populator->addEntity('Review', 1000000); | |
$insertedPKs = $populator->execute(); |
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 | |
$faker = \Faker\Factory::create(); | |
$populator = new \Faker\ORM\Propel\Populator($faker); | |
$populator->addEntity('Author', 100); | |
$insertedPKs = $populator->execute(); |
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 | |
$faker = \Faker\Factory::create(); | |
$insertedPKs = array(); | |
for ($i=0; $i < 100; $i++) { | |
$author = new Author(); | |
$author->setFirstName($faker->firstName); | |
$author->setLastName($faker->lastName); | |
$author->setDateOfBirth($faker->date); | |
$author->setEmail($faker->email); | |
$author->save(); |
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 | |
$pdo = new PDO('mysql:host=hostname;dbname=defaultDbName', 'username', 'p@55w0rd'); | |
$sql = 'INSERT INTO author (first_name, last_name, date_of_birth, email) VALUES (?, ?, ?, ?)'; | |
$stmt = $pdo->prepare($sql); | |
$faker = \Faker\Factory::create(); | |
$insertedPKs = array(); | |
for ($i=0; $i < 100; $i++) { | |
$stmt->bindValue(1, $faker->firstName, PDO::PARAM_STR); | |
$stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR); | |
$stmt->bindValue(1, $faker->date, PDO::PARAM_STR); |