This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | //It's not the best implementation because will iterate over all props. | |
| // If one props is undefined, so it's uncessary evaluate others props | |
| function hasProps(obj, props){ | |
| return props.split(".").reduce((result, prop)=> result && result[prop], obj) | |
| } | |
| //Example | |
| /* | |
| const obj = {a:{b:{c:{d:1}}}} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function randomId() { | |
| return Math.random(23).toString(26).slice(2); | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const net = require('net'); | |
| const server = net.createServer(function (socket) { | |
| socket.on('data', function (data) { | |
| const header = data.toString(); | |
| console.log("--------start request--------"); | |
| console.log(header); | |
| console.log("--------end request--------"); | |
| let response = "HTTP/1.1 200 OK\r\n"; | |
| body = "<h1> HELLO WORLD 😉 </h1>"; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const tls = require('tls'); | |
| const fs = require('fs'); | |
| /* | |
| To generate a valid certificate in command line: | |
| openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365 | |
| openssl rsa -in keytmp.pem -out key.pem | |
| */ | |
| const options = { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function getOnlyNumbers(str){ | |
| return Array.from(str).filter(Number) | |
| } | |
| console.log(getOnlyNumber("a1b2c")); // ["1", "2"] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const arr = [...Array(5).keys()]; | |
| console.log(arr) //[0, 1, 2, 3, 4] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # You will need to install: sudo apt install xclip | |
| base64 file | tr -d '\n' | xclip -sel clip | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | nmcli device wifi hotspot con-name my-hotspot ssid my-hotspot band bg password 12345678 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Place your key bindings in this file to overwrite the defaults | |
| [ | |
| { | |
| "key": "f12", | |
| "command": "workbench.action.tasks.runTask", | |
| "args" : "task-deploy" | |
| } | |
| ] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | find -type f -name '*.jpg' | rename 's/\.jpeg$/.jpg/' | 
OlderNewer