Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alex Titakoff alexTitakoff

🏠
Working from home
View GitHub Profile
@alexTitakoff
alexTitakoff / node-horoscope-getting.js
Created Dec 26, 2018
простое потягивания данный из getов
View node-horoscope-getting.js
let link = 'https://horoscopes.rambler.ru/api/front/v1/horoscope/today/taurus/'
var http = require('http');
// var options = {
@alexTitakoff
alexTitakoff / waitFunction.js
Created Dec 25, 2018
не секретный гист waitFunction
View waitFunction.js
let conditionParam = 0
function conditionFunc() { // Какая то функция или действие в интерфейсе состояние которого мы ожидаем
if (conditionParam != 5) {
setTimeout(() => {
conditionParam++
console.log('conditionFunc')
return conditionFunc()
@alexTitakoff
alexTitakoff / findWithAttr.js
Last active Dec 25, 2018
== нахождение объекта в массиве по атрибуту
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*