Skip to content

Instantly share code, notes, and snippets.


appkr appkr

View GitHub Profile
appkr /
Created Feb 16, 2021 — forked from gimbimloki/
JWT Example (Sign, Verify and etc)
package com.nhn.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.ECDSAKeyProvider;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.nimbusds.jose.*;
import com.nimbusds.jose.crypto.ECDSASigner;
import com.nimbusds.jose.jwk.Curve;
package homo.efficio.json.jackson.custom.serialization;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import homo.efficio.json.jackson.custom.serialization.domain.CellPhone;
import homo.efficio.json.jackson.custom.serialization.domain.FamilyMember;
import homo.efficio.json.jackson.custom.serialization.domain.MobileVendor;
import homo.efficio.json.jackson.custom.serialization.serializer.CellPhoneSerializer;
import homo.efficio.json.jackson.custom.serialization.serializer.FamilyMemberSerializer;
appkr / .php_cs
Last active Feb 11, 2018 — forked from jwage/.php_cs
php-cs-fixer git pre commit hook
View .php_cs
return PhpCsFixer\Config::create()
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'protected_to_private' => false,
'mb_str_functions' =>true,
appkr /
Created Jan 23, 2018 — forked from davejamesmiller/
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container

View gist:f4d990299f76303c2ad99934840abb5f
use Swagger\Annotations as SWG;
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
appkr / ProcessExecutor.php
Created Aug 1, 2017 — forked from SuoXC/ProcessExecutor.php
use anonymous function and an array of args to create a series of sub process to do the job,no need to care about process management api.
View ProcessExecutor.php
* @example
* $a = new ProcessExecutor();
* $b = function ($arg){ sleep(1);echo "hello $arg\n"; };
* $a->setRunnables($b,['aaa','bbb']);
* $a->setCheckStatus(function($arg){return $arg === 'aaa';});
* $a->execute();
* var_dump($a->getRunStatusArr());
appkr / request_parallely.php
Created Aug 1, 2017 — forked from SuoXC/request_parallely.php
use php curl_multi_* to perform http requests
View request_parallely.php
interface HandleIterator {
public function getNextHandle();
public function dataCallback($data);
class IndexHandleIterator implements HandleIterator{
private $curl;
private $count;
public function __construct(){
$this->curl = curl_init("http://localhost/index.php");
appkr / Facade.php
Created Aug 1, 2017 — forked from SuoXC/Facade.php
simple service locator + Facade(like in Laravel) implementation
View Facade.php
class Facade{
private static $service = null;
public static function getKey(){
return 'world';
public static function __callstatic($method,$args){
self::$service = ServiceLocator::getInstance()->getService(self::getKey());
appkr /
Created Jul 9, 2017 — forked from alexellis/
install docker engine for swarm3k on Ubuntu 16.04. 2 options for installing
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
# renames the host to have a suffix of alexellisio
export original=$(cat /etc/hostname)
sudo hostname $original-master-alexellisio
echo $original-master-alexellisio | sudo tee /etc/hostname
apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
View gist:4156bc20a921e4a3f7181042b3f1a83b

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{}
  5. Greg Young's [Unshackle Your Domain]{}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht