Home
Khuong Dev
Cancel

Fetch API on Javascript

POST method async function postData(url = '', data = {}) { // Default options are marked with * const response = await fetch(url, { method: 'POST', // *GET, POST, PUT, DELETE, etc. mod...

Postman on Linux

Install Postman Install by Snap sudo snap install postman Uninstall Postman If you use Snap: sudo snap remove postman References Installing and updating

UUID in NodeJS

UUID (Universally Unique IDentifier) crypto - Module was added from Node.js 14.17.0 const crypto = require("crypto"); console.log(crypto.randomUUID()); uuid module: const uuid = require(...

UUID in Javascript

UUID (Universally Unique IDentifier) function uuid() { var temp_url = URL.createObjectURL(new Blob()); var uuid = temp_url.toString(); URL.revokeObjectURL(temp_url); return uuid.substr(uui...

Converting text to speech with Javascript

API Web Speech & Demo function speak (message) { var msg = new SpeechSynthesisUtterance(message) var voices = window.speechSynthesis.getVoices() msg.voice = voices[0] window.speech...

Javascript Array tips and tricks

1. Remove duplicates value from an array const languages = ['java', 'php', 'ruby', 'python', 'php', 'python']; console.log(languages); // First method const uniqueLangs = Array.from(new Set(langu...

Useful Docker & docker-compose commands

Docker Commonly used Docker commands Command Description docker version Show the docker version docker image ls or docker images ...

Escape the underscore and the percent when searching by like, ilike expressions in PostgreSQL

To escape the underscore and the percent to be used in a pattern in like expressions use the escape character (\): SELECT * FROM users WHERE name LIKE '\_'; SELECT * FROM users WHERE name LIKE '\%...

What's the meaning of /gi in a regex?

g modifier: global. All matches (don't return on first match) i modifier: insensitive. Case insensitive match (ignores case of [a-zA-Z]) In your case though i is immaterial as you don’t capture ...

Jekyll Chirpy Text and Typography

Titles H1 - heading H2 - heading H3 - heading H4 - heading Paragraph I wandered lonely as a cloud That floats on high o’er vales and hills, When all at once I saw a crowd, A host, of ...