Skip to content

Instantly share code, notes, and snippets.

View radum's full-sized avatar
🚀
I can see what you see not

Radu Micu radum

🚀
I can see what you see not
View GitHub Profile
@radum
radum / dom3d.js
Created April 6, 2024 14:35 — 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; // ¯\\_(ツ)_/¯
@radum
radum / charles-map-remote.md
Last active March 21, 2024 08:02
Charles proxy Map Remote over HTTP or HTTPS

Charles Proxy Map Remote over HTTP or HTTPS

The Map Remote tool changes the request location, per the configured mappings, so that the response is transparently served from the new location as if that was the original request.

HTTP

Using this feature for http resources does't require anything else apart from just configuring your Map Remote entry.

Always make sure you are clearing your cache before you test. Even if Charles is configured properly you might not see the changes unless the browser gets the resource again from the server and not for its local cache.
@radum
radum / git_examples.sh
Last active December 23, 2023 13:58
this script creates repos in a sandbox directory and uses them for demos -
#!/usr/bin/bash
##########
# contents
# https://bitbucket.org/BitPusher16/dotfiles/src/1777024d574c2245193687bd632d056ded41287e/refs/git/git_examples.sh?at=master
##########
# contents
# notes
# script setup
@radum
radum / A Web performance resources.md
Last active August 30, 2023 08:11
Web performance resources

Articles

Performance API

// https://github.com/WICG/paint-timing
performance.getEntries();
performance.getEntriesByType('paint');

// Calculate the time it spends to run something
@radum
radum / VB SQL
Last active August 3, 2023 00:48
Query MS SQL Server With Excel VBA
' Before we can start you’ll need to add a reference to your VBA project:
' Microsoft ActiveX Data Objects x.x Library
Option Explicit
Private Conn As ADODB.Connection
Function ConnectToDB(Server As String, Database As String) As Boolean
Set Conn = New ADODB.Connection
On Error Resume Next
@radum
radum / esm-package.md
Created June 18, 2023 20:07 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@radum
radum / shell-best-practices.md
Created November 2, 2022 11:51
Shell Script Best Practices

Use bash. Using zsh or fish or any other, will make it hard for others to understand / collaborate. Among all shells, bash strikes a good balance between portability and DX.

Just make the first line be #!/usr/bin/env bash, even if you don’t give executable permission to the script file.

Use the .sh (or .bash) extension for your file. It may be fancy to not have an extension for your script, but unless your case explicitly depends on it, you’re probably just trying to do clever stuff. Clever stuff are hard to understand.

Use set -o errexit at the start of your script.

So that when a command fails, bash exits instead of continuing with the rest of the script. Prefer to use set -o nounset. You may have a good excuse to not do this, but, my opinion, it’s best to always set it.

@radum
radum / google_maps.xml
Created October 25, 2014 15:09 — forked from romuloceccon/google_maps.xml
Custom "Google Maps" source (en-EN) for Mobile Atlas Creator 1.9.16. Save as *.xml in /mapsources.
<customMapSource>
<name>Google Maps</name>
<minZoom>0</minZoom>
<maxZoom>20</maxZoom>
<tileType>PNG</tileType>
<tileUpdate>IfNoneMatch</tileUpdate>
<url>http://mt{$serverpart}.google.com/vt/lyrs=m@176103410&amp;hl=en-EN&amp;x={$x}&amp;y={$y}&amp;z={$z}&amp;s=Galileo&amp;scale=1</url>
<serverParts>0 1 2 3</serverParts>
</customMapSource>
@radum
radum / Default (OSX).sublime-keymap
Last active March 21, 2022 09:51
Sublime Text 3 Configuration Files
[
{ "keys": ["ctrl+pagedown"], "command": "next_view" },
{ "keys": ["ctrl+pageup"], "command": "prev_view" }
]
@radum
radum / polyfill.document.createTreeWalker.js
Created May 16, 2017 10:30
polyfill.document.createTreeWalker.js
/* eslint no-param-reassign: 0 */
/**
* JavaScript implementation of W3 DOM4 TreeWalker interface.
*
* See also:
* - https://dom.spec.whatwg.org/#interface-treewalker
*
* Attributes like "read-only" and "private" are ignored in this implementation
* due to ECMAScript 3 (as opposed to ES5) not supporting creation of such properties.