Skip to content

Instantly share code, notes, and snippets.

View ramzes13's full-sized avatar

petru ramzes13

  • chisinau
View GitHub Profile
@ramzes13
ramzes13 / index.js
Created April 6, 2020 08:32
check for non used files in nodejs project
const { resolve } = require('path');
const { readdirSync, lstatSync } = require('fs');
async function getFiles(dir) {
const dirents = readdirSync(dir, { withFileTypes: true });
const files = await Promise.all(dirents.map(dirent => {
const res = resolve(dir, dirent);
return lstatSync(res).isDirectory() ? getFiles(res) : res;
}));
@ramzes13
ramzes13 / ts
Created March 14, 2019 12:33
reducer
const configs = (state: BookListsInterface = defaultState, action: any): BookListsInterface => {
switch (action.type) {
case bookListActions.BOOK_LIST_BEGIN_LOADING: {
const { loadingMeta } = state;
loadingMeta.isLoading += 1;
return { ...state, loadingMeta: Object.assign({}, loadingMeta) };
}
case bookListActions.BOOK_LIST_END_LOADING: {
const { loadingMeta } = state;
#!/bin/bash
TMP_FILE='/tmp/media_hosts'
HOSTS_FILE='/etc/hosts'
DIVERTISMENT_START="=========================DIVERTISMENT_START====================="
DIVERTISMENT_END="=========================DIVERTISMENT_END======================="
D_START_FOUND=false;
D_END_FOUND=false;
> $TMP_FILE
geoInfoMd = {
"type": "FeatureCollection", "features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [[[29.476585388183707, 46.917640686035156], [29.470264434814453, 46.920406341552734], [29.455076217651367, 46.920406341552734], [29.44456100463873, 46.916900634765625], [29.43638229370123, 46.914566040039006], [29.423530578613338, 46.912227630615234], [29.423530578613338, 46.90346527099621], [29.42761993408203, 46.897624969482536], [29.436965942382812, 46.89353561401367], [29.44456100463873, 46.88652420043951], [29.445144653320426, 46.878929138183594], [29.44631385803234, 46.87133407592785], [29.44685173034668, 46.86846160888672], [29.44631385803234, 46.867984771728516], [29.43930625915533, 46.86175537109375], [29.438364028930664, 46.85846328735357], [29.43813514709484, 46.85848236083979], [29.43287658691412, 46.85906600952154], [29.425867080688533, 46.85906600952154], [29.420024871826286, 46.85906600952154], [29.41301