Skip to content

Instantly share code, notes, and snippets.

View greatsage-raphael's full-sized avatar
🎯
Learning Python 🐍

Lubwama Collins greatsage-raphael

🎯
Learning Python 🐍
View GitHub Profile
@greatsage-raphael
greatsage-raphael / DOM3D.js
Created March 27, 2024 20:28 — forked from OrionReed/dom3d.js
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
{
"id": "1597139",
"title": {
"nameShortened": "dota"
},
"format": "best-of-3",
"started": true,
"finished": false,
"valid": true,
"teams": [
@greatsage-raphael
greatsage-raphael / databaseServer.js
Last active January 25, 2023 16:51
A program that runs a server that is accessible on http://localhost:4000/. When your server receives a request on http://localhost:4000/set?somekey=somevalue it should store the passed key and value in memory. When it receives a request on http://localhost:4000/get?key=somekey it should return the value stored at somekey.
const http = require('http');
const port = 4000
// Create an object to store the key-value pairs in memory
let storage = {};
const server = http.createServer((request, response) => {
// Get the URL and query string from the request
const url = request.url;
console.log(url)