Skip to content

Instantly share code, notes, and snippets.

View silvesterwali's full-sized avatar
:octocat:
Coding lover

silvesterwali silvesterwali

:octocat:
Coding lover
View GitHub Profile
@silvesterwali
silvesterwali / README.md
Last active April 15, 2024 14:14
Nuxt3 Composable for handle simple auth

create file composable useRequestOptions.ts

useRequestOptions.ts

import type { AuthCredential } from "@/types";
export default function () {
  const config = useRuntimeConfig();

  const defaultRedirect = "/sign-in";
@silvesterwali
silvesterwali / gist:e219b586eda337dd09b938bc4dc563fa
Created April 15, 2024 08:02
Where Directory to put uploads files in nuxt3 server
Need help !
what directory should i put my file for example image while upload file to server.
in my case i put them under public/uploads and working just fine for dev mode.
but when i run command npm run build those files from public is copy to .output/public/uploads folder.
i wonder in production where i should put my upload file put them directly to .output/public/uploads or public/uploads.
here is my code that handle the file upload on `server/api/imageUpload.post.ts`
```ts
import { z } from 'h3-zod'
@silvesterwali
silvesterwali / token-generator.js
Created September 13, 2021 13:27 — forked from ziluvatar/token-generator.js
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@silvesterwali
silvesterwali / index.md
Last active March 10, 2021 16:37
Penggunaan Printjs untuk print html

Cara Penggunaan PrintJS

Berikut merupakan contoh aplikasi printJS pada html

source PrintJs .

    <!DOCTYPE html>
    <html lang="en">