Skip to content

Instantly share code, notes, and snippets.

View vitaliiznak's full-sized avatar
🎯
Focusing

Vitalii Znak vitaliiznak

🎯
Focusing
View GitHub Profile
@vitaliiznak
vitaliiznak / nginxproxy.md
Created May 3, 2019 10:21 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@vitaliiznak
vitaliiznak / sampleREADME.md
Created January 14, 2019 11:54 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

/**
* TASK DESCRIPTION
*
* Consider 2 dimensional space, with discreate coordinates
* - a given starting point ex. (0, 0)
* - you allow to move as (x+1, y), (x-1,y), (x, y+1) , (x,y-1)
* - RESTRICTION: you can not step into the point if the absolute number of a coordinates digits are grater than some N
* f.e if N=21 and a point is (59, -79), sum of digits in coordinates os (5 + 9 + 7 + 9) = 30 > 27 (N)
* the point is prohibited
* - you can not step over the points
const coordsDigitsCalcSum = coords =>
coords
.reduce(
(acc, el) =>
Math.abs(el)
.toString(10)
.split("")
.map(num => Number(num))
.concat(acc),
[]
@vitaliiznak
vitaliiznak / bfs_search_excersice.js
Created March 22, 2018 12:03
Consider 2 dimensional space
const coordsDigitsCalcSum = coords =>
coords
.reduce(
(acc, el) =>
Math.abs(el)
.toString(10)
.split("")
.map(num => Number(num))
.concat(acc),
[]
@vitaliiznak
vitaliiznak / bfs_search_excersice.js
Created March 22, 2018 12:03
Consider 2 dimensional space
const coordsDigitsCalcSum = coords =>
coords
.reduce(
(acc, el) =>
Math.abs(el)
.toString(10)
.split("")
.map(num => Number(num))
.concat(acc),
[]
@vitaliiznak
vitaliiznak / gist:188a70d0a8be1cf1bd65d6ee215754f8
Created December 19, 2017 16:08 — forked from weblancaster/gist:6e7f43fc02725ce747e224b0c4290906
Kill all container, remove all images and stop all containers
#stop all containers:
docker kill $(docker ps -q)
#remove all containers
docker rm $(docker ps -a -q)
#remove all docker images
docker rmi $(docker images -q)
@vitaliiznak
vitaliiznak / python_pagination_generator.py
Last active July 3, 2017 13:27
Pagination generator implemented in python
import unittest
#try it here https://repl.it/JLH2/2
"""
>>> make_paginator(4,5,1,0)
"1 ... 4 5"
>>> make_paginator(4,10,2,2)
"1 2 3 4 5 6 ... 9 10"
>>> make_paginator(4,10,2,2)
"1 2 3 4 5 6 ... 9 10"
"""
@vitaliiznak
vitaliiznak / count_total_project_code_lines_in_sublime
Created June 25, 2017 12:51 — forked from Hexodus/count_total_project_code_lines_in_sublime
Count total code lines in project using Sublime texteditor
// Go to menue:
// find->find in files
// Switch on reg_ex button
// Find:
^(.*)$
// Where:
c:\your_folder\,*.php,*.phtml,*.js,*.inc,*.html, -*/folder_to_exclude/*
// Then click on the find button
// Be careful to not click on Replace!!!
"use strict"
function createEvaluator() {
let evaluator;
return {
add: ( function(fn, ...rest) {
const lastFn = fn.bind(null, ...rest), currenntFn = evaluator;
evaluator = evaluator ? (...finalArrgs) => lastFn(currenntFn(...finalArrgs)) : lastFn
return this;