Skip to content

Instantly share code, notes, and snippets.

View diloabininyeri's full-sized avatar

Dılo abinin yeri diloabininyeri

View GitHub Profile
@diloabininyeri
diloabininyeri / test.php
Last active September 22, 2022 13:33
A PHP Pattern To Avoid Try/Catch Blocks Repetition
<?php
interface Executable
{
public function execute(): void;
}
abstract class AbstractExecutable
@diloabininyeri
diloabininyeri / docker-compose.yml
Created August 9, 2022 09:26
apache kafka by docker
version: "3"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: 'bitnami/kafka:latest'
@diloabininyeri
diloabininyeri / service.yml
Last active August 3, 2022 10:28
example node-js deployment on kubernetes
apiVersion: v1
metadata:
name: rest-socket-service
spec:
type: NodePort
selector:
app: nodejs-deployment
ports:
- nodePort: 30165
port: 3000
@diloabininyeri
diloabininyeri / main.go
Created April 20, 2022 14:43
golang channel queue and queue example
package main
import (
"fmt"
)
func dequeue(chan1 chan int, result chan string) {
for val := range chan1 {
fmt.Println(val)
@diloabininyeri
diloabininyeri / nc.php
Created March 2, 2022 11:25
php socket send messge and receive message example
$stream = stream_socket_client("tcp://127.0.0.1:1235", $errno, $errstr);
if (!$stream) {
echo "{$errno}: {$errstr}\n";
die();
}
$payload = 'hello world';
fwrite($stream, $payload);
/*stream_socket_shutdown($stream, STREAM_SHUT_WR);
@diloabininyeri
diloabininyeri / BuilderCacheEloquent.php
Last active June 5, 2024 08:34
laravel query cacheable trait example from structure
<?php
namespace App\Concrete\Library\Cache;
use App\Traits\CacheableQuery;
use Cache;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Database\Query\Builder;
@diloabininyeri
diloabininyeri / json_encode.php
Created February 15, 2022 12:42
php jsonable object example
<?php
/**
*
*/
interface IJsonAble extends JsonSerializable
{
/**
* @return array
*/
@diloabininyeri
diloabininyeri / render.php
Created February 10, 2022 08:22
php composite design pattern example
<?php
require_once 'vendor/autoload.php';
/**
*
*/
interface Renderer
@diloabininyeri
diloabininyeri / eav.php
Created February 8, 2022 15:25
forexample, EAV design pattern in php
class Value
{
/**
* @var string
*/
private $value;
@diloabininyeri
diloabininyeri / test.php
Last active February 2, 2022 12:28
php complex step-by-step processes example command design pattern
<?php
interface Command
{
public function execute();
}