Skip to content

Instantly share code, notes, and snippets.

View d-exclaimation's full-sized avatar

vincent d-exclaimation

View GitHub Profile
@d-exclaimation
d-exclaimation / prisma.module.ts
Created October 17, 2022 03:07
Prisma + Nest.js
import { Module } from "@nestjs/common";
import { PrismaService } from "./prisma.service";
@Module({
providers: [PrismaService],
exports: [PrismaService]
})
export class PrismaModule {}
@d-exclaimation
d-exclaimation / Dockerfile
Created October 12, 2022 21:45
Node.js Typescript (Yarn) Dockerfile
FROM node:18-alpine as builder
WORKDIR /build
COPY . .
RUN yarn install
RUN rm -rf dist/
RUN tsc
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
@d-exclaimation
d-exclaimation / Dockerfile
Created October 12, 2022 21:44
Node.js Typescript (npm) Dockerfile
FROM node:18-alpine as builder
WORKDIR /build
COPY . .
RUN npm install
RUN rm -rf dist/
RUN tsc
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
@d-exclaimation
d-exclaimation / Dockerfile
Created October 12, 2022 21:43
Swift Package Manager Dockerfile
FROM swift:latest as builder
WORKDIR /root
COPY ./Package.* ./
RUN swift package resolve
COPY . .
RUN swift build -c release
FROM swift:slim
COPY --from=builder /root/.build build
CMD ["build/release/<project-name>"]
@d-exclaimation
d-exclaimation / AuthStore.ts
Created September 23, 2022 11:25
Authentication Logic React (JWT Access and Refresh Token)
//
// AuthStore.ts
// web
//
// Created by d-exclaimation on 00:28.
//
/**
* Authentication InMemory storage.
*/
@d-exclaimation
d-exclaimation / MagicInput.tsx
Created September 23, 2022 11:24
Input form with style
//
// MagicInput.tsx
// web
//
// Created by d-exclaimation on 11:54.
//
import React, { useMemo } from "react";
type Props = {
@d-exclaimation
d-exclaimation / JsValue.swift
Created November 5, 2021 16:38
Intermediate JSON Data structure in Swift
import Foundation
/// Intermediate data structure for non-schema based JSON value, using the power Swift's enum and its pattern matching
///
/// ```swift
/// let jsVal: JsValue = .object(map: [
/// "top_one": .string("ok"),
/// "top_two": .object(map: [
/// "nested_one": .number(10),
/// "nested_two": .bool(false),
@d-exclaimation
d-exclaimation / useChannel.ts
Created June 16, 2021 08:07
My way / preferences for creating Phoenix Channel React Hook
import { Channel as PhoenixChannel, Socket } from "phoenix";
import { useCallback, useContext, useEffect, useRef, createContext } from "react";
// Initialize and connect server given the socket endpoint
const __socket__ = "fill this in"
const socket = new Socket(__socket__, {});
socket.connect();
export const SocketContext = createContext(socket);
/**