Skip to content

Instantly share code, notes, and snippets.

View nyk0r's full-sized avatar

Tsalik Mozgunov nyk0r

View GitHub Profile
@nyk0r
nyk0r / Commit_Message.md
Created April 25, 2021 23:03 — forked from apurvajain/Commit_Message.md
Commit Message Template

Commit Message Convention

type(scope): subject 

<body>
<footer>

1. Type of commit

@nyk0r
nyk0r / array2table.js
Last active December 16, 2020 01:21
array to table
const arr1 = [
['name', 'id', 'age', 'weight', 'Cool'],
['Susan', '3', '20', '120', true],
['John', '1', '21', '150', true],
['Bob', '2', '23', '90', false],
['Ben', '4', '20', '100', true],
];
const arr2 = [
['name', 'id', 'height'],
<!DOCTYPE html>
<html>
<head>
<style>
.spinner {
background-color: transparent;
position: relative;
}
.spinner__square-1,
var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});
var schema = {
properties: {
country: { type: 'string', enum: ['RU', 'US', 'UZ'] },
postalCode: { type: 'string', maxLength: 10 }
},
if: {
function* range(a, b, pred) {
while (a < b) {
if (typeof pred === 'undefined' || pred(a)) {
yield a;
}
++a;
}
}
function isPalindrome(val) {
@nyk0r
nyk0r / twoWindows.js
Created February 26, 2018 17:22
two puppeteer windows side by side
const puppeteer = require('puppeteer');
const width = 1920;
const height = 1080;
(async () => {
await puppeteer.launch({
headless: false,
args: [
`--window-size=${Math.floor(width/2)},${height}`,
using System;
namespace FormatCompiler
{
using System.Text;
using System.Linq.Expressions;
using System.Reflection;
using System.Collections.Generic;
enum TokenType { Unknown, OpenBrace, CloseBrace, Identifier, Literal }
class BinaryNode<T> {
public constructor(public value: T, public left: BinaryNode<T> = null, public right: BinaryNode<T> = null) {}
}
interface INodeProcessor<T> {
(value: T): void;
}
interface IBinaryNodeTraversal<T> {
(node: BinaryNode<T>, processor: INodeProcessor<T>): void;
<!doctype html>
<html>
<head>
<style>
.step-mediator1 {
position: absolute;
z-index: 30;
}
.step-mediator2 {
position: absolute;
function flatten<T>(arr: Array<T|Array<T>>): Array<T> {
let result: Array<T> = [];
let stack: Array<{ arr: Array<T | Array<T>>, idx: number }> =
[{ arr, idx: 0 }];
main: while (stack) {
let {arr: current, idx} = stack.pop();
for (; idx < current.length; idx++) {
if (current[idx] instanceof Array) {
stack.push({arr: current, idx});
stack.push({arr: <Array<T>>current[idx], idx: 0});