Skip to content

Instantly share code, notes, and snippets.

@dominikzogg
dominikzogg / server.ts
Created August 31, 2021 19:40
server.ts
import ServerRequestFactory from '@chubbyjs/chubbyjs-http-message/dist/Factory/ServerRequestFactory';
import ResponseFactory from '@chubbyjs/chubbyjs-http-message/dist/Factory/ResponseFactory';
import UriFactory from '@chubbyjs/chubbyjs-http-message/dist/Factory/UriFactory';
import { createServer } from 'http';
import PsrRequestFactory from './PsrRequestFactory';
import PsrResponseEmitter from './PsrResponseEmitter';
import ServerRequestInterface from '@chubbyjs/psr-http-message/dist/ServerRequestInterface';
import ResponseInterface from '@chubbyjs/psr-http-message/dist/ResponseInterface';
const responseFactory = new ResponseFactory();
@dominikzogg
dominikzogg / workerman.php
Last active August 7, 2020 09:30
workerman
<?php
declare(strict_types=1);
use Chubbyphp\Framework\Application;
use Chubbyphp\Framework\Middleware\ExceptionMiddleware;
use Chubbyphp\Framework\Middleware\RouterMiddleware;
use Chubbyphp\Framework\RequestHandler\CallbackRequestHandler;
use Chubbyphp\Framework\Router\FastRoute\Router;
use Chubbyphp\Framework\Router\Route;
@dominikzogg
dominikzogg / classmap.php
Last active December 12, 2019 20:31
classmap (composer)
<?php
use Composer\Autoload\ClassMapGenerator;
use Composer\Autoload\ClassLoader;
/** @var ClassLoader $loader */
$loader = require __DIR__ . '/vendor/autoload.php';
$classes = [];
@dominikzogg
dominikzogg / EntityManagerDecorator.php
Created October 29, 2019 18:58
EntityManager within Swoole
<?php
declare(strict_types=1);
namespace App\Orm;
use Doctrine\DBAL\Connection;
use Doctrine\ORM\Decorator\EntityManagerDecorator as DoctrineEntityManagerDecorator;
use Doctrine\ORM\EntityManager;
@dominikzogg
dominikzogg / generate-swagger-based-php-api-client.sh
Created October 9, 2019 07:43
generate-swagger-based-php-api-client.sh
docker run --rm -v ${PWD}:/local swaggerapi/swagger-codegen-cli-v3:3.0.11 generate -l php -i /local/swagger.yaml -o /local/php
@dominikzogg
dominikzogg / .hyper.js
Last active March 20, 2020 14:24
hyper.is for elementary os
"use strict";
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
// default font size in pixels for all tabs
<?php
$old = [
'name' => 'Old name',
'active' => true,
'description' => 'This is a description',
'items' => [
[
'name' => 'Old item name',
'active' => true,
@dominikzogg
dominikzogg / config
Last active January 7, 2017 12:14
terminator-config-elementary-style (.config/terminator/config)
[global_config]
enabled_plugins = LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
suppress_multiple_term_dialog = True
title_inactive_bg_color = "#22272a"
title_inactive_fg_color = "#a8b7b9"
title_receive_bg_color = "#22272a"
title_receive_fg_color = "#a8b7b9"
title_transmit_bg_color = "#363b3e"
title_transmit_fg_color = "#94a3a5"
[keybindings]
@dominikzogg
dominikzogg / create-symfony-project.sh
Last active October 1, 2015 16:35
create-symfony-project.sh
#!/bin/bash
if [ -z "$1" ]; then
echo "please enter a projectname: myproject"
exit 1
fi
if [ -z "$2" ]; then
echo "please enter a symfony version: 2.7.5"
exit 1
@dominikzogg
dominikzogg / CRUDTrait.php
Created January 22, 2015 06:53
CRUDTrait.php Skeleton
<?php
trait BaseTrait
{
abstract public function getDoctine();
}
abstract class BaseClass
{
use BaseTrait;