Skip to content

Instantly share code, notes, and snippets.

View PantheraRed's full-sized avatar
💻
Busy as you can tell

Red Panther PantheraRed

💻
Busy as you can tell
View GitHub Profile
@PantheraRed
PantheraRed / index.js
Last active December 10, 2022 16:13
HTTP or HTTPS request in Node.js using built-in HTTPS Module.
const https = require('https');
const options = {
host: 'jsonplaceholder.typicode.com',
// port: <custom port>
path: '/users',
method: 'GET'
};
const req = https.request(options, (res) => {
@PantheraRed
PantheraRed / combinations.js
Last active April 26, 2022 19:55
Find all the possible combinations of a string.
'use strict' // Optional
export default function combinations(combos) {
if (!Array.isArray(combos)) {
combos = [combos];
}
const a = combos[combos.length - 1].split('');
let b = a.shift();
a.push(b);
@PantheraRed
PantheraRed / ms.js
Last active July 21, 2023 11:13
Convert milliseconds to years, months, days, hours, minutes & seconds in JavaScript.
'use strict'; // Remove this if you don't wish to use strict mode
function ms(t) {
let year,
month,
day,
hour,
minute,
second;