Skip to content

Instantly share code, notes, and snippets.

@sergigp
sergigp / job-description.md
Last active November 30, 2018 09:32
Letgo Chat Team Job Description

We are a small team looking for a new workmate. We have been using Scala, Akka and WebSockets with an Actor Model approach in order to build Letgo’s new chat during the last year. We have done some talks about what we have been doing in case you want to give them a look (From polling to real time & Broke up with the monolith, and started dating Event Sourcing). We are really concerned with best practices (SOLID, testing, DDD, CQRS...) and we already have experience in these areas. We are looking for colleague who can complement us.

How we work

  • Discuss design with the team
  • Testing
  • CI
  • Pull Requests, Code reviews and team approvement
  • Merge and deploy

Responsibilities

implicit class JsObjectPimp(msg: JsObject) {
private def fieldOf[T: Reads](f: JsObject => JsLookupResult): T = f(msg).asOpt[T].value
// @TODO: Return a RequestId instead of a plain String
def requestId: String = fieldOf[String](_ \ "id")
def conversationId: String = fieldOf[String](_ \ "data" \ "conversation_id")
def messageType: String = fieldOf[String](_ \ "type")
@sergigp
sergigp / my.cnf
Last active February 4, 2016 11:20
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
@sergigp
sergigp / pre-commit.sh
Created January 17, 2016 22:56
Pre commit for scala projects
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
echo -e "\n\033[1mDoing some Checks...\n\033[0m"
if sbt compile > /dev/null
then
echo -e "${GREEN}- Compiles${NC}"
@sergigp
sergigp / lol.php
Last active August 29, 2015 14:28
GiftPostController
final class GiftPostController
{
private $exceptions = [];
public function __invoke(Request $request)
{
$senderUserId = $request->attributes->get('authenticated_id');
apply($this->sendCommand($senderUserId), $request->request->get('friends_ids'));
@sergigp
sergigp / lol.php
Last active August 29, 2015 14:27
<?php
use ....;
final class GiftPostController
{
private $exceptions = [];
public function __invoke(Request $request)
{
final class User extends AggregateRoot
{
private $id;
protected function getRules()
{
return [
'id' => [UserId::class],
];
}

#Codemotion

##viernes:

Web components, Polymer and the future of web development

Web components & Polymer are quickly becoming the hottest thing on the web. Everyone wants to create a web component, but not many know how or what they even are!

Big Data de andar por casa by Jorge Lería, William Viana

@sergigp
sergigp / composer_benchmark
Last active January 2, 2016 16:39
Benchmark composer PHP 5.5.7 vs HHVM 2.3.2 on Ubuntu 12.04 64bits on Vagrant VM. Default settings.
# clear composer cache
rm ~/.composer/cache/*
rm vendor/*
rm composer.lock
php composer.phar install # 4 minutes 36 seconds
# clear composer cache
@sergigp
sergigp / gist:5504930
Last active January 25, 2021 10:12
small benchmark between curl, multicurl and file_get_contents. Results: CURL: 7.37 s // MULTI CURL: 1.93 s // FILE GET CONTENTS: 25.94 s
<?php
$data = array(
'http://www.marca.com',
'http://www.wowebook.be',
'http://www.meneame.net',
'http://www.google.com',
'http://www.elpais.es',
'http://www.reddit.com',
'http://www.digg.com',