Skip to content

Instantly share code, notes, and snippets.

@joaopfsilva
joaopfsilva / iban.js
Created September 27, 2019 07:40
IBAN validator
// https://github.com/arhs/iban.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['exports'], factory);
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
// CommonJS
factory(exports);
} else {
// Browser globals
@Vertecedoc4545
Vertecedoc4545 / Hyprland-Ubuntu.md
Last active May 1, 2024 17:12
Ubuntu 23.04 Build and Install instructions for Hyprland

Building on Ubuntu 23.04

You have 2 options, use the script descrived bellow or follow the instrutions

script in this gist if you want the source code

wget https://gist.githubusercontent.com/Vertecedoc4545/6e54487f07a1888b656b656c0cdd9764/raw/2c5e8ccb428fc331307e2f653cab88174c051310/build-ubuntu-23.sh
chmod +x build-ubuntu-23.sh
./build-ubuntu-23.sh

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist

@portiss
portiss / reverseString.js
Created February 5, 2024 09:14
Reverse a string
function reverseString(str) {
return str.split('').reverse().join('');
}
@portiss
portiss / isBalancedTree.js
Created February 5, 2024 09:12
isBalancedTree
function isBalancedTree(node) {
if (node) {
const keepSearch = h(node.right) - h(node.left) <= 1
if (keepSearch) {
return balancedTree(node.right) && balancedTree(node.left)
}
else return false
}
}
@portiss
portiss / flattenArrays.js
Created February 5, 2024 09:11
Implement JS flatMap
function flatten(ary, ret = []) {
return ary.reduce((ret, entry) => {
(Array.isArray(entry))? flatten(entry, ret) : ret.push(entry)
return ret
}, ret)
}
console.log(flatten([[[0], [1]], [[2], [3]], [[4], [5]]]))
@portiss
portiss / currying.js
Created February 5, 2024 09:09
Write the sum(3)(2)
function add(x) {
return (y) => x + y;
}
@portiss
portiss / fibonacci.js
Last active May 1, 2024 17:10
fibonacci (memoized)
const memo = {}
function fibonacci(n, memo){
if(n<2)
return n
if(!memo[n-1])
memo[n-1] = fibonacci(n-1, memo)
if(!memo[n-2])
memo[n-2] = fibonacci(n-2, memo)
return memo[n-1] + memo[n-2]
}
@portiss
portiss / isParenthesisMatching.js
Created February 6, 2024 09:42
Parenthesis Matching (Using stack)
const isParenthesisMatching = (str) => {
const stack = []
const open = {
'{': '}',
'[': ']',
'(': ')'
}
const closed = {

An guide how to activate Windows 11 Pro for free

Why?

Because you will get some more features like an Bitlocker and host your device as an External Desktop which can be accessed through the internet

Am i also able to switch from any other edition to Pro?

The answer is yes! You can switch from almost any edition to Pro completely for free!

Note for users with unactivated Pro edition

People which already have Pro, but not activated, can skip to this step.

Getting started

What you first need to do is open CMD (Command Prompt) as Administrator using this keyboard key: