Skip to content

Instantly share code, notes, and snippets.

View sudomaxime's full-sized avatar

Maxime Nadeau sudomaxime

View GitHub Profile
// Great to express "something" in your app.
type Point = {
x: number
y: number
}
// Great to make your function params easy to understand
function drawPoint (point: Point) {
// do stuff
}
interface Point { x: number; }
interface Point { y: number; }
const point: Point = { x: 1, y: 2 };
import express, { Request, Response } from "express";
const app = express();
interface Request {
isDogRequest: boolean
}
app.use("/dogs", (req: Request, res: Response, next) => {
req.isDogRequest = true; // <-- does not cause an error
next();
interface AnimalCompare {
isDog (): boolean
}
class Cat implements AnimalCompare {...};
class Dog implements AnimalCompare {...};
const animals = [
new Cat,
new Dog,
import GoodBoyEvaluator from "./GoodBoyEvaluator";
class Dog {
private gotCookie: boolean;
public name: string;
constructor (name) {
this.name = name;
}
@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
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
#!/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 () {
;; 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
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")) {