Skip to content

Instantly share code, notes, and snippets.

@AshikNesin
AshikNesin / base64-form-data.js
Last active Feb 20, 2021
Base64 image to multipart/form-data
View base64-form-data.js
const base64 = 'data:image/png;base64,....' // 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
@gokulkrishh
gokulkrishh / media-query.css
Last active Apr 11, 2021
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */