Skip to content

Instantly share code, notes, and snippets.

View sudomaxime's full-sized avatar

Maxime Nadeau sudomaxime

View GitHub Profile
@sudomaxime
sudomaxime / procedural.ts
Created March 29, 2024 18:35
Simple example of procedural approach to clean architecture without interfaces
import * as z from 'zod';
// ENTITY ========================================================
const userEntityPresenter = z.object({
id: z.number(),
name: z.string(),
email: z.string()
});
@sudomaxime
sudomaxime / doc-example.json
Created December 9, 2023 17:47
doc-example.json
{
"endpoint": "/user",
"handler": "UserCreateHandler",
"inputs": {
"body": {
"email": {
"type": "string",
"pipeline": [
{
"type": "check",
@sudomaxime
sudomaxime / switcheroo.sql
Created August 31, 2022 14:33
Exemple de switch d'URL, base de données MYSQL avec architecture Wordpress >= 8
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost/wp', 'VOTRE_URL_DE_PRODUCTION_ICI') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://localhost/wp','VOTRE_URL_DE_PRODUCTION_ICI');
UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost/wp', 'VOTRE_URL_DE_PRODUCTION_ICI');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://localhost/wp','VOTRE_URL_DE_PRODUCTION_ICI');
@sudomaxime
sudomaxime / container.lua
Last active May 3, 2022 18:25
get a table struct with informations about a bunch of containers
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function makeInventoriesHash (containers)
inputHash = {
-- Inventory by inputs
inputs = {},
INCLUDE QUESTION
BOOL should_admit
PROGRAM email
! Simple program to deal with email question management
IF QUESTION.ABOUT_EMAIL
GOTO USE_PERSONAL_EMAIL
USE_PERSONAL_EMAIL
include std::speech
include tone::serious
include promise::{Help, Work}
#[serious()]
safe canDoIt (&mut issue: character) -> &'now Help|Work {
first {
let mut support = issue.map(|family| familiy.need("dream") && "dream");
await std::speech // wait for dramatic speech pause
if (support.iter().includes("dream")) {
;; Author note: I have no idea what I am doing with this function
;; I copied stuff into this file
;; for some reason adding a bunch of "()" fix issues in the most case
;; I think this programming language is too old to fix our issues
;; we should rewrite the codebase
(defn crime [type](
(type
->> (#"drugs" (
map/state/until/nevada || map/state/until/new_hampshire
#!/bin/moistly
source inclusive_team
source perfect_hair
source actually_awnser_question_lib # deprecated since mandate.2.0
SORRY=1
THANKYOU=0
keep_working_on_speech () {
use speech from "nothing"
use grab from "lib.little.hands"
~ No comments here ~
trump make_murica_great_again:
trump:
stuff = grab.by.the.file "unbelivable.trump"
trump stuff.status:
is tremendous -> trump.great_speech
is prettygood -> trump.point_at_crowd
@sudomaxime
sudomaxime / uploader-example.ts
Last active August 1, 2020 18:37
Example uploader middleware for adminbro
import express from "express";
import path from "path";
import fs from "fs";
import fileType from "file-type";
import { isArray, promisify } from "util";
interface FileSaveOptions {
directory: string
buffer: Buffer
filename: string