Skip to content

Instantly share code, notes, and snippets.

@KaKi87
KaKi87 / getParents.js
Last active February 20, 2020 07:43
Get all parents of HTML element
const getParents = element => {
const parents = [];
for (; element && element !== document; element = element.parentElement){
parents.push(element);
}
return parents;
};
/*
Source : https://gomakethings.com/how-to-get-all-parent-elements-with-vanilla-javascript/
@KaKi87
KaKi87 / isIpInCidr.js
Created February 20, 2020 17:36
Is IP in CIDR ?
const isIpInCidr = (ip, cidr) => {
const [range, bits = 32] = cidr.split('/');
const mask = ~(2 ** (32 - bits) - 1);
const ip4ToInt = ip => ip.split('.').reduce((int, oct) => (int << 8) + parseInt(oct, 10), 0) >>> 0;
return (ip4ToInt(ip) & mask) === (ip4ToInt(range) & mask);
};
/*
Source : https://tech.mybuilder.com/determining-if-an-ipv4-address-is-within-a-cidr-range-in-javascript/
*/

Keybase proof

I hereby claim:

  • I am kaki87 on github.
  • I am kaki87 (https://keybase.io/kaki87) on keybase.
  • I have a public key ASBVux5-VAVoreRwBZHvwvaIoWgW5paogKtj8dF8XWH94wo

To claim this, I am signing this object:

@KaKi87
KaKi87 / trying-to-use-official-vuejs-libraries-with-browser-esm-cdn-imports.md
Created May 20, 2022 12:42
Trying to use official VueJS libraries with browser ESM CDN imports

Official VueJS libraries, e.g. vue-router, are simultaneously dependencies and dependents of vue, seemingly making those impossible to use with ESM CDN import statements without using <script type="importmap">, which isn't supported everywhere.

VueJS standalone boilerplates

Basic, working

Full code snippet :

@KaKi87
KaKi87 / audacity_forks.md
Last active February 5, 2023 21:21
Audacity forks

Audacity forks

| Name | Status | Repository | Website | Last Linux build | Last Windows build | Last Mac build | | :------------------------------ | :------- | :------------------------------------------------------------------------------------------------

@KaKi87
KaKi87 / Awesome-FrOSS.md
Last active April 25, 2024 13:24
Liste inspirée par awesome de logiciels libres français. | Awesome-inspired list of French open source software.