View node-horoscope-getting.js
let link = 'https://horoscopes.rambler.ru/api/front/v1/horoscope/today/taurus/' | |
var http = require('http'); | |
// var options = { |
View waitFunction.js
let conditionParam = 0 | |
function conditionFunc() { // Какая то функция или действие в интерфейсе состояние которого мы ожидаем | |
if (conditionParam != 5) { | |
setTimeout(() => { | |
conditionParam++ | |
console.log('conditionFunc') | |
return conditionFunc() |
View findWithAttr.js
function findWithAttr(array, attr, value) { | |
for(var i = 0; i < array.length; i += 1) { | |
if(array[i][attr] === value) { | |
return i; | |
} | |
} | |
return -1; | |
} |
View some gist
for(let i; i < arr.length; i++){ | |
if (arr[i].p_id != null) { | |
new_arr.push(arr[i]) | |
}else { | |
} | |
} | |
View gist:2c86e07010ce8a7e62ab557a66e3c1e7
# first: | |
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
# go to /usr/local/lib and delete any node and node_modules | |
cd /usr/local/lib | |
sudo rm -rf node* |