Skip to content

Instantly share code, notes, and snippets.

View abdessamadely's full-sized avatar

Abdessamad Ely abdessamadely

View GitHub Profile
{
"workbench.startupEditor": "none",
"php.suggest.basic": false,
"editor.fontSize": 15,
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.lineHeight": 2.25,
"terminal.integrated.fontSize": 14,
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
const getCookieValue = (name) => (
pm.response.headers.get('Set-Cookie').match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''
)
const jwtToken = getCookieValue('jwt-token')
pm.environment.set("jwtToken", jwtToken)
@abdessamadely
abdessamadely / eventer.ts
Created October 9, 2024 19:55
A simple TypeScript idea for an event dispatcher
type Function = (data?: any) => void
const eventMap: Map<string, Function[]> = new Map()
function on(name: string, handler: Function) {
const handlers = eventMap.get(name) || []
handlers.push(handler)
eventMap.set(name, handlers)
}
@abdessamadely
abdessamadely / NextJsBackendValetDriver.php
Created August 10, 2025 11:59
A way to serve two applications — a Next.js app and a custom PHP static site builder — under the same domain name without using subdomains, while keeping both projects within a single repository
<?php
namespace Valet\Drivers\Custom;
use Valet\Drivers\ValetDriver;
/**
* A Valet driver to proxy a sub uri to a Next.js application
* ~/.config/valet/Drivers/NextJsBackendValetDriver.php
*/