Skip to content

Instantly share code, notes, and snippets.

View iamakaradech's full-sized avatar

Akaradech Sutheesuntornkul iamakaradech

  • Thailand
View GitHub Profile
@iamakaradech
iamakaradech / docker-compose.yml
Created October 19, 2021 05:35
Basic docker-compose.yml file for mariadb and redis
version: "3.9"
services:
db:
restart: always
image: mariadb
container_name: mariadb
ports:
- "3307:3306"
volumes:
- ./db/:/var/lib/mysql
@iamakaradech
iamakaradech / base64-form-data.js
Created January 29, 2020 08:53 — forked from AshikNesin/base64-form-data.js
Base64 image to multipart/form-data
const base64 = 'data:image/png;base65,....' // Place your base64 url here.
fetch(base64)
.then(res => res.blob())
.then(blob => {
const fd = new FormData();
const file = new File([blob], "filename.jpeg");
fd.append('image', file)
// Let's upload the file
// Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470
<html>
<head>
<title>Dart</title>
</head>
<body>
</body>
</html>