Skip to content

Instantly share code, notes, and snippets.

View knyga's full-sized avatar
🇺🇦

Oleksandr Knyga knyga

🇺🇦
View GitHub Profile
@knyga
knyga / StashDriverFactoryTest.php
Created March 17, 2017 21:57
StashDriverFactoryTest.php
<?php
namespace WebExtractor\Test;
use WebExtractor\StashDriverFactory\StashDriverFactory;
/**
* Class StashDriverFactoryTest
*
@knyga
knyga / dima.js
Created March 17, 2017 21:57
dima.js
const dima = "cool man";
function detectLocalIps() {
const networkInterfaces = require('os').networkInterfaces();
return Object.keys(networkInterfaces).reduce((acc, interfaceKey) => {
const filterIpsList = ['127.0.0.1', '::'];
const interfaceDetails = networkInterfaces[interfaceKey];
for(let i=0; i<interfaceDetails.length; i++) {
const locator = interfaceDetails[i];
if(locator && locator.hasOwnProperty('address') && locator.hasOwnProperty('family') && locator.family === 'IPv4') {
let isAllowed = true;
for(let j=0; isAllowed && j < filterIpsList.length; j++) {