Skip to content

Instantly share code, notes, and snippets.

View puuble's full-sized avatar

marian ivanov puuble

  • full stack backend
  • Bulgaria
View GitHub Profile
@puuble
puuble / f1_event-bus.js
Last active January 17, 2023 13:30
event handler and chunk file for send with event.emit
const EventEmitter = require('events');
const eventBus = new EventEmitter();
module.exports = eventBus;
@puuble
puuble / f1_event_bus.py
Last active January 17, 2023 13:58
python event bus
from collections import defaultdict
from threading import Lock
class EventBus:
def __init__(self):
self.events = defaultdict(list)
self.lock = Lock()
def subscribe(self, event, callback):
with self.lock:
@puuble
puuble / table.php
Created January 12, 2023 12:41
php table stdClass
<?php
// Lemmod - Couldn't be bothered to make my own class as this works as well
/**
* STable - Generate HTML Tables
*
* @package STable
* @category STable
* @name STable
* @version 1.0
@puuble
puuble / package.json
Created December 25, 2022 22:11
(Uncaught Options object must provide a cluster)
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/typography": "^0.5.0",
"alpinejs": "^3.0.6",
@puuble
puuble / .env
Created October 16, 2022 09:53
nodejs mongodb queue. Create your job on mongodb for send and receive.
QUEUE_DB_HOST=
QUEUE_DB_PORT=27017
QUEUE_DB_USER=root
QUEUE_DB_PASS=12345678
QUEUE_DB_NAME=test
QUEUE_DB_COLL=queue
@puuble
puuble / MongoSessionHandler.php
Last active December 23, 2020 15:36
E11000 duplicate key error collection Laravel mongoDB sessions
<?php
namespace App\Session;
use Illuminate\Session\DatabaseSessionHandler;
class MongoSessionHandler extends DatabaseSessionHandler
{
/**