Skip to content

Instantly share code, notes, and snippets.

View paulinep's full-sized avatar
🏠
Working from home

polina Shestakova paulinep

🏠
Working from home
  • Goryachiy Kluch
View GitHub Profile
@paulinep
paulinep / params.ts
Created February 1, 2021 17:13
функции для взаимной конвертации (туда обратно) Из JSON в строку location.search
/*превращает объект в строку вида
criteria%5Bproperties%5D%5Bx0005656%5D%5Bfrom%5D=1&criteria%5Bproperties%5D%5Bx0005656%5D%5Bto%5D=4&sorting%5Bstock%3A545%5D=asc
*/
export function serialize (obj: ICatalogParams, prefix=''): string {
var str = []
let p: keyof ICatalogParams;
for (p in obj) {
if (obj.hasOwnProperty(p)) {
var k = prefix ? prefix + "[" + p + "]" : p,
v = obj[p];
@paulinep
paulinep / RichEditor.js
Created September 5, 2019 05:24
Draft js editor with images and videos
import React, {Component} from 'react'
import ReactDOM from 'react-dom';
import { EditorState, RichUtils,Editor, ContentState, DefaultDraftBlockRenderMap, convertFromHTML, getSafeBodyFromHTML, AtomicBlockUtils, CompositeDecorator} from 'draft-js';
import createImagePlugin from "draft-js-image-plugin";
import './rich-editor.scss'
import * as Immutable from "immutable";
import {stateToHTML} from 'draft-js-export-html';
import {InlineStyleControls, BlockStyleControls} from './StyleButton'
import Svg from 'common/Svg';
import createVideoPlugin from 'draft-js-video-plugin';
@paulinep
paulinep / index.js
Created September 23, 2018 11:42
k combinations of N elements. k, n are natural numbers 0<=k<=n. The output is the nessesary number of rows.
process.stdin.on('readable', () => {
const v = process.stdin.read();
if (v !== null) {
let input = v.toString('utf8').split(" ").map(n => parseInt(n));
let k = input[0] || 0;
let n = input[1] || 0;
//Count of combinations
let c = 0;
// took here http://e-maxx.ru/algo/generating_combinations