Skip to content

Instantly share code, notes, and snippets.

View hungify's full-sized avatar
🎯
Focusing

hungify hungify

🎯
Focusing
  • ˋ@2024ˎˊ
  • undefined, Vietnam
  • 19:39 (UTC +07:00)
View GitHub Profile
@wobsoriano
wobsoriano / proxy.ts
Last active December 22, 2023 02:25
Nuxt 3 http-proxy-middleware
// ~/server/middleware/proxy.ts
import { defineEventHandler } from 'h3'
import { createProxyMiddleware } from 'http-proxy-middleware'; // npm install http-proxy-middleware@beta
const apiProxyMiddleware = createProxyMiddleware({
target: 'https://jsonplaceholder.typicode.com',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api/todos': '/todos',
@nathanchase
nathanchase / [...].ts
Last active March 7, 2024 02:34
Nuxt 3 Server API catch-all w/ caching, retries, and request/response logging (with total elapsed time)
// Here's my current implementation of a Nuxt 3 server API catch-all with caching, retries, and request/response logging with total elapsed time:
// Place in: /server/api/[...].ts
import LRU from 'lru-cache';
import { getCookie } from 'h3';
const config = useRuntimeConfig();
const cache = new LRU({
max: 100,
@1Marc
1Marc / reactive.js
Last active November 7, 2024 21:27
Vanilla Reactive System
// Credit Ryan Carniato https://frontendmasters.com/courses/reactivity-solidjs/
let context = [];
export function untrack(fn) {
const prevContext = context;
context = [];
const res = fn();
context = prevContext;
return res;
@jahirfiquitiva
jahirfiquitiva / settings.json
Created May 11, 2024 22:32
VS Code Settings
{
"breadcrumbs.enabled": false,
"editor.fontFamily": "'MonoLisa', 'Dank Mono', 'Operator Mono Lig', 'Operator Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.fontWeight": "400",
"editor.cursorBlinking": "smooth",
"editor.cursorSmoothCaretAnimation": "explicit",
"editor.stickyScroll.enabled": true,
"explorer.sortOrder": "type",
"workbench.editor.enablePreview": false,
"workbench.editor.highlightModifiedTabs": true,
@nghiepdev
nghiepdev / Dockerfile
Created June 14, 2024 09:20
Dockerfile.next.js.example
# Stage 0
FROM node:20-slim as base
LABEL maintainer="Nghiep <[email protected]>"
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN corepack prepare pnpm@9 --activate
ENV NEXT_TELEMETRY_DISABLED 1
WORKDIR /app
COPY .npmrc package.json pnpm-lock.yaml pnpm-workspace.yaml cache-handler.mjs next.config.mjs ./