Skip to content

Instantly share code, notes, and snippets.

View JavierCane's full-sized avatar
🤟
Working on @CodelyTV

Javier Ferrer González JavierCane

🤟
Working on @CodelyTV
View GitHub Profile
<?php
namespace CodelyTv\Api\Controller;
use CodelyTv\Context\Meetup\Module\Video\Domain\Create\CreateVideoCommand;
use CodelyTv\Infrastructure\Bus\Command\CommandBus;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
<?php
namespace CodelyTv\Context\Meetup\Module\Video\Domain\Create;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoId;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoTitle;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoUrl;
use CodelyTv\Shared\Domain\CourseId;
final class CreateVideoCommandHandler
<?php
namespace CodelyTv\Context\Meetup\Module\Video\Domain\Create;
use CodelyTv\Context\Meetup\Module\Video\Domain\Video;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoId;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoRepository;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoTitle;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoUrl;
use CodelyTv\Infrastructure\Bus\Event\DomainEventPublisher;
<?php
namespace CodelyTv\Context\Meetup\Module\Video\Tests\Behaviour;
use CodelyTv\Context\Meetup\Module\Video\Domain\Create\CreateVideoCommandHandler;
use CodelyTv\Context\Meetup\Module\Video\Domain\Create\VideoCreator;
use CodelyTv\Context\Meetup\Module\Video\Test\PhpUnit\VideoModuleUnitTestCase;
use CodelyTv\Context\Meetup\Module\Video\Test\Stub\CreateVideoCommandStub;
use CodelyTv\Context\Meetup\Module\Video\Test\Stub\VideoCreatedDomainEventStub;
use CodelyTv\Context\Meetup\Module\Video\Test\Stub\VideoIdStub;
<?php
namespace CodelyTv\Context\Meetup\Module\Video\Test\PhpUnit;
use CodelyTv\Context\Meetup\Module\Video\Domain\Video;
use CodelyTv\Context\Meetup\Module\Video\Domain\VideoRepository;
use CodelyTv\Context\Meetup\Test\PhpUnit\MeetupContextUnitTestCase;
use Mockery\MockInterface;
use function CodelyTv\Test\similarTo;
@JavierCane
JavierCane / FinderKataJavaStyle.scala
Created April 18, 2017 20:42
Initial code for the Finder Refactoring Kata. More info: http://codely.tv/screencasts/finder-kata-scala/
// Post: http://codely.tv/screencasts/finder-kata-scala/
// Repo: https://github.com/CodelyTV/incomprehensible-finder-refactoring-kata-scala
package tv.codely.finderKata.algorithm
import java.util
import java.util.ArrayList
import scala.collection.JavaConverters._
@JavierCane
JavierCane / SemanticFinderKataJavaStyle.scala
Created April 18, 2017 20:42
First step for the Finder Refactoring Kata. More info: http://codely.tv/screencasts/finder-kata-scala/
// Post: http://codely.tv/screencasts/finder-kata-scala/
// Repo: https://github.com/CodelyTV/incomprehensible-finder-refactoring-kata-scala
package tv.codely.finderKata.algorithm
import java.util
import java.util.ArrayList
import scala.collection.JavaConverters._
@JavierCane
JavierCane / FunctinoalFinderKata.scala
Created April 18, 2017 20:42
Functional approach for the Finder Refactoring Kata. More info: http://codely.tv/screencasts/finder-kata-scala/
// Post: http://codely.tv/screencasts/finder-kata-scala/
// Repo: https://github.com/CodelyTV/incomprehensible-finder-refactoring-kata-scala
package tv.codely.finderKata.algorithm
final class BestPeoplePairFinder() {
def find(people: Seq[Person], peoplePairCriterion: Ordering[PeoplePair]): Option[PeoplePair] = {
val canFindPeoplePairs = people.size >= 2
if (!canFindPeoplePairs) {
@JavierCane
JavierCane / Introducción a Scala - 4. Val var y def.scala
Created September 28, 2017 05:53
Introducción a Scala - 4. Val var y def
import scala.util.Random
var javi = "Javi" * 10 // Inferencia de tipos
javi = "Rafa" // podemos reasignar el contenido de una variable (var)
val rafa = "Rafa" // ";" al final de línea no necesario
// rafa = "Javi" // Petaría en tiempo de compilación. No podemos reasignar el contenido de un valor (val)
def codely(name: String): String = { // función pública con tipo de retorno explícito. Se declaran con = ya que asignamos una expresión.
println("Este mensaje se imprimirá por pantalla al invocar a la función codely")
@JavierCane
JavierCane / scala_if_example.scala
Created October 16, 2017 06:16
Scala if example
val lele = if ("Codely mola".isInstanceOf[String]) 3 else 7