Skip to content

Instantly share code, notes, and snippets.

@perki
perki / Fixing HTTPS for localhost - an all-purpose solution.md
Last active February 7, 2024 13:33
Fixing HTTPS for localhost - an all-purpose solution

For a WebApp or Backend developers, mixing HTTP & HTTPS while testing a live API from their local environment or the opposite with live webapp connecting to a local backend does usually end with errors such as:

  1. Mixed Content Warning:

"Mixed Content: The page at 'https://example.com' was loaded over HTTPS, but requested an insecure image 'http://example.com/image.jpg'. This content should also be served over HTTPS."

"Loading mixed (insecure) display content 'http://example.com/image.jpg' on a secure page."

@perki
perki / realign.js
Created December 12, 2022 16:29
Realign all comments with heading /**
const fs = require('fs');
const path = require('path');
function processFile (filePath) {
const content = fs.readFileSync(filePath, 'utf-8');
const lines = content.split('\n');
let identBy = -1;
let changeCount = 0;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];