Skip to content

Instantly share code, notes, and snippets.

View klikkn's full-sized avatar
:electron:

Sergey P. klikkn

:electron:
View GitHub Profile
import create from 'zustand';
const useStore = create((set) => ({
prop1: 1,
prop2: 2,
setProp1: (value) => {
set({ prop1: value });
saveToLocalStorage({ prop1: value });
},
setProp2: (value) => {
:host {
.search-btn {
background: theme('colors.white-1');
::ng-deep tui-wrapper[data-appearance='outline']:after {
@apply border-none;
}
}
}
import {
AfterViewInit,
ChangeDetectionStrategy,
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
} from '@angular/core';
@klikkn
klikkn / template.html
Created July 27, 2023 09:41
Cappybara html template
<!DOCTYPE html><html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"u=
rn:schemas-microsoft-com:office:office" lang=3D"en"><head><title></title><m=
eta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8"><met=
a name=3D"viewport" content=3D"width=3Ddevice-width,initial-scale=3D1"><!--=
[if mso]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInc=
h><o:AllowPNG/></o:OfficeDocumentSettings></xml><![endif]--><!--[if !mso]><=
!--><link href=3D"https://fonts.googleapis.com/css?family=3DMontserrat"=20
rel=3D"stylesheet" type=3D"text/css"><!--<![endif]--><style>
*{box-sizing:border-box}body{margin:0;padding:0}a[x-apple-data-detectors]{c=
olor:inherit!important;text-decoration:inherit!important}#MessageViewBody a=
@klikkn
klikkn / paging-test.js
Created September 20, 2020 06:44
Paging tests
test("3, 2", () => {
expect(getPaging(3, 2)).toEqual(["1", "2", "3"]);
});
test("4, 2", () => {
expect(getPaging(4, 2)).toEqual(["1", "2", "3", "4"]);
});
test("7, 2", () => {
expect(getPaging(7, 2)).toEqual(["1", "2", "3", "...", "5", "6", "7"]);
@klikkn
klikkn / cke5.tsx
Created March 28, 2020 19:32
cke5 mention
import React from "react";
import { Field, FieldProps } from "formik";
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
type CustomTextFieldProps = {
options: any[];
name: string;
label: string;
editable: boolean;
@klikkn
klikkn / paging.js
Created March 1, 2019 13:36
Paging generator
const getPagesSet = num => [num - 1, num, num + 1];
const calculatePagesPairs = (firstPart, lastPart) => {
const intersectionIndex = firstPart.indexOf(lastPart[0]);
if (intersectionIndex > -1)
return [...firstPart.slice(0, intersectionIndex), ...lastPart];
const isNeighbors = lastPart[0] - firstPart[firstPart.length - 1] === 1;
if (isNeighbors) return [...firstPart, ...lastPart];
@klikkn
klikkn / timeout.js
Last active September 9, 2017 18:12
for (let i = 0; i < 10; i++) {
setTimeout(function() {console.log(i)}, 1000);
}
for (var i = 0; i < 10; i++) {
(function (i) {setTimeout(function() { console.log(i) }, 1000)})(i)
}
for (var i = 0; i < 10; i++) {
setTimeout('console.log('+ i +')', 1000);