Skip to content

Instantly share code, notes, and snippets.

@romul3003
romul3003 / mock-useQuery.ts
Last active December 13, 2023 09:58
Mock templae for tanstak useQuery
import { UseQueryOptions, useQuery } from '@tanstack/react-query';
import { offersData } from '~/views/Dashboard/Offers/Offers.config';
import { offersKeys } from './offers.key';
// TODO: replace after connecting to BE
type OffersType = typeof offersData;
interface UseGetOffers {
const pause = () =>
new Promise((resolve) => {
setTimeout(resolve, 100);
});
@romul3003
romul3003 / create-link-path.js
Created July 14, 2022 19:22
create link path
@romul3003
romul3003 / react-modal.scss
Created July 14, 2022 18:52
react-modal jsx
@import 'weplay-core/styles/_initialization.scss';
@import 'weplay-core/styles/v-2-0/_init.scss';
.overlay {
@include size(100%);
@include transition(opacity);
position: fixed;
top: 0;
left: 0;
@romul3003
romul3003 / slick-random.js
Created June 9, 2020 12:31 — forked from zexeder/slick-random.js
Slick Random Slides
$.fn.randomize = function (selector) {
var $elems = selector ? $(this).find(selector) : $(this).children(),
$parents = $elems.parent();
$parents.each(function () {
$(this).children(selector).sort(function (childA, childB) {
// * Prevent last slide from being reordered
if($(childB).index() !== $(this).children(selector).length - 1) {
return Math.round(Math.random()) - 0.5;
}
mv .idea ../.idea_backup
rm .idea # in case you forgot to close your IDE
git rm -r .idea
git commit -m "Remove .idea from repo"
mv ../.idea_backup .idea
@romul3003
romul3003 / full-size-image.html
Created March 25, 2020 19:39
full size image - also works in IE-11
<style>
.ibg{
background-position: center;
background-size: cover;
background-repeat: no-repeat;
position: relative;
}
.ibg img{

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@romul3003
romul3003 / rand.js
Created October 24, 2018 13:39
generation of a random integer from min to max inclusively
let rand = min + Math.floor(Math.random() * (max + 1 - min));
// for array
let arr = ["Apple", "Orange", "Pear", "Lemon"];
let randFromArr = Math.floor(Math.random() * arr.length);
console.log(arr[randFromArr]);
@romul3003
romul3003 / get-coords-rel-to-document.js
Created August 22, 2018 08:49
Get coords, relative to document
function getCoords(elem) { // кроме IE8-
var box = elem.getBoundingClientRect();
return {
top: box.top + pageYOffset,
left: box.left + pageXOffset
};
}