Skip to content

Instantly share code, notes, and snippets.

@d1gitalflow
d1gitalflow / pgp-key.txt
Created March 3, 2022 10:21
Public PGP Key ID: 0x8ad4d7f45ac2fae2
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBF/qfKIBEAC+hrqpfUC8p3JJrI7iZWfjsRUm27dvKUYsXjfCb7ktPr+KY08Z
L3pfAcWxJ7xm7uiVN9JV7Smk5RojmW11VPpl+YjmufJxVNbZGGNxDoCShb2ZxgMR
J8Tba03ANQhaF9Ds4G2M1dtVelWZkjflQT2K145DEJv4S/yThL5MCm8+2rUa0Nlh
ny/vvAzfYOk/qxrE0ogt1XfVxfeEqY+2fy/4bLpHvP91AynMZYyZ2DF0JlhMsaqW
UoYfPUib+dMq+RC7O1Y4taQ6/bsfCeomO/oMQuOvggucF/4mRoATEjd96/nDpZdY
q+P0F7PSpfHTuTrsTqO/ymQ5/uiBn2ImGMxLSdoSzRAyvxU1SJBFuyOfUEdAjxgM
/5OWYi2BWQiexr0oRQp6UIDn/snt9tg9DCfHp2AobLsUVoBwZLst4EeElA4kme54
jgwP2Qs8tzzt4szeqcgfScvNzwah4X4rKUJ+OZX/1PwKDeBjBOLyXzLANT32WqP9
const childrenOf = (element) => {
if (typeof element === 'string') {
return [];
}
//element is always an object, if the value of props is 'undefined' it returns [], if string returns [children], if Array returns array, neither just returns the element inside an array
//tip: its object desconstructuring after props: (because the extracted value of props is an object with children property)
const { props: { children } } = element;
if (!children) {
return [];
}
[
{
'$$typeof': Symbol(react.element),
type: 'p',
key: null,
ref: null,
props: { children: 'A' },
_owner: null,
_store: {}
},
{
'$$typeof': Symbol(react.element),
type: 'div',
key: null,
ref: null,
props: { children: [ [Object], [Object], ' ' ] }, //the .children obj has always a array with children values + empty array in the end (' ')
_owner: null,
_store: {}
}
{
'$$typeof': Symbol(react.element),
type: 'div',
key: null,
ref: null,
props:
{
id: 'test',
children:
{
@d1gitalflow
d1gitalflow / toc.html
Created February 18, 2021 00:44
Example: Generating a Table of Contents
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h3 id="title" data-section-number="1633.1">Attriddffdbutes</h3>
<h4 id="t3itddle" data-section-number="16.331">Attrffdibutes</h4>
@d1gitalflow
d1gitalflow / google dorks
Created January 23, 2021 18:46
Google dorks / search
Explanations:
cache: If you include other words in the query, Google will highlight those words within
the cached document. For instance, [cache:www.google.com web] will show the cached
content with the word “web” highlighted. This functionality is also accessible by
clicking on the “Cached” link on Google’s main results page. The query [cache:] will
show the version of the web page that Google has in its cache. For instance,
[cache:www.google.com] will show Google’s cache of the Google homepage. Note there
can be no space between the “cache:” and the web page url.
------------------------------------------------------------------------------------------
@d1gitalflow
d1gitalflow / wtf_moment.js
Created December 14, 2020 00:22
Storing a function inside a JavaScript array element
const array = [] //empty array
function fn() {    
return 'Hello from inside the array';
}
//add function 'fn' to array position 0.
array.push(fn);
console.log(array[0]());