Skip to content

Instantly share code, notes, and snippets.

View KushnerMikalai's full-sized avatar
🦥

Nikolai Kushner KushnerMikalai

🦥
  • Poland, Wroclaw
View GitHub Profile
@KushnerMikalai
KushnerMikalai / curl.md
Created July 14, 2021 18:14 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

#!/usr/bin/env sh
set -e
yarn build
cd ./dist
git init
git add .
git commit -m 'deploy'
@KushnerMikalai
KushnerMikalai / quickSort.js
Last active March 18, 2019 09:15
Quick sorting algorithm in JavaScript
let x = [123, 66, 3243, 100, 2, 23, 1];
const quickSort = arr => {
if (!arr.length) return [];
let a = [],
b = [],
p = arr[0],
len = arr.length;
@KushnerMikalai
KushnerMikalai / bubbleSort.js
Last active March 18, 2019 09:15
Bubble sorting in JavaScript
let x = [123, 66, 3243, 100, 2, 23, 1];
const bubbleSort = arr => {
let len = arr.length;
for (let i = 0; i < len-1; i++) {
for (let j = 0; j < len-1-i; j++) {
if (arr[j+1] < arr[j]) {
let t = arr[j+1];
arr[j+1] = arr[j];
arr[j] = t;
@KushnerMikalai
KushnerMikalai / multiple_ssh_setting.md
Created February 13, 2019 19:26 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@KushnerMikalai
KushnerMikalai / clock.js
Created January 21, 2019 20:13
functional approach
const compose = (...fns) =>
(arg) =>
fns.reduce(
(composed, f) => f(composed),
arg );
const oneSecond = () => 1000;
const getCurrentTime = () => new Date();
@KushnerMikalai
KushnerMikalai / deepEqual.js
Created October 30, 2018 09:06
Deep comparison
function deepEqual(a, b) {
if (a === b) return true;
if (a === null || typeof a != 'object' || b === null || typeof b != 'object') return false;
let keysA = Object.keys(a), keysB = Object.keys(b);
if (keysA.length !== keysB.length) return false;
for (let key in keysA) {
if (!keysB.includes(key) || !deepEqual(a[key], b[key])) return false;
@KushnerMikalai
KushnerMikalai / timetrac.js
Created October 29, 2018 10:57
time speed js
var iterations = 1000000;
console.time('Function #1');
for(var i = 0; i < iterations; i++ ){
// YOUR FUNCTION 1
};
console.timeEnd('Function #1');
console.time('Function #2');
for(var i = 0; i < iterations; i++ ){
// YOUR FUNCTION 2
@KushnerMikalai
KushnerMikalai / cloneDeep.js
Created October 29, 2018 10:56
Clone deep
function clone(obj) {
if (obj === null || typeof (obj) !== 'object' || 'isActiveClone' in obj)
return obj;
if (obj instanceof Date)
let temp = new obj.constructor(); //or new Date(obj);
else
let temp = obj.constructor();
for (var key in obj) {
@KushnerMikalai
KushnerMikalai / isNumeric.js
Created July 17, 2018 13:18
Проверка на чисто. В результате отсеивается всё, кроме строк-чисел и обычных чисел.
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}