const pets = ['Cat', 'Dog', 'Bird', 'Fish', 'Frog', 'Hamster', 'Pig', 'Horse' 'Lion', 'Dragon'];
// Print all pets
console.log(pets[0]);
console.log(pets[1]);
console.log(pets[2]);
console.log(pets[3]);
...
View catAndMouse.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function catAndMouse(x, y, z) { | |
const diffA = Math.abs(z-x); | |
const diffB = Math.abs(z-y); | |
if(diffA === diffB) return "Mouse C"; | |
return diffA < diffB ? "Cat A" : "Cat B"; | |
} |
View saveThePrisoner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function saveThePrisoner(n, m, s) { | |
return (m%n+s-1)%n ? (m%n+s-1)%n : n | |
} |
View angryTeacher.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function angryProfessor(k, a) { | |
const onTimeStudents = a.filter(s => s <= 0).length | |
return onTimeStudents >= k ? "NO" : "YES" | |
} |
View hike.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
this is an algo peoblem from hacker rank https://www.hackerrank.com/challenges/counting-valleys/problem?isFullScreen=true | |
*/ | |
function countingValleys(steps, path) { | |
let count = 0; | |
let level = 0; | |
path.split("").forEach(unit => { | |
if(unit === "D") { |
View drawing_book.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://www.hackerrank.com/challenges/drawing-book/problem?isFullScreen=true | |
Given and , find and print the minimum number of pages that must be turned in order to arrive at page . | |
*/ | |
function pageCount(n, p) { | |
let index = 0; | |
const chunks = []; | |
const arr = [...Array(n + 1).keys()]; | |
for (let i = 0; i < arr.length; i += 2) { |
View jumping-on-the-clouds.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jumpingOnClouds(c, k) { | |
let index = 0; | |
let energy = 100; | |
let stop = false; | |
while (!stop) { | |
if (c[index] === 1) { | |
energy -= 2; | |
} |
View jest.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
testPathIgnorePatterns: ['<rootDir>/.next/', '<rootDir>/node_modules/'], | |
setupFiles: ['./test-setup.js'] | |
} |
View exemple-1.md
View gist:17b4f8da5bf366edbd6debdd383c0481
Inkscape extensions
Effect
- metalrobot Металлический конструктор
- inkdatatable An Inkscape extension for creating tables with text fields
- textext Inkscape LaTeX plugin originally from http://pav.iki.fi/software/textext/
- inkscape-gs An inkscape's extension to create guides with offset, useful to create a grid system.
- NiceCharts An Inkscape-extension to draw charts
- gdadin GUI to Draw Algorithms Designed with Inkscape
View node_nginx_ssl.md
Node.js Deployment
Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
1. Sign up for Digital Ocean
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
2. Create a droplet and log in via ssh
I will be using the root user, but would suggest creating a new user