Skip to content

Instantly share code, notes, and snippets.

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

Sergey Belozyorcev belozer

🏠
Working from home
View GitHub Profile
@belozer
belozer / index.html
Last active August 15, 2019 23:43 — forked from samosad/index.html
#slice #rest #2for (http://jsbench.github.io/#0eac5d083e6b6e05a1614f26feefd1df) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>#slice #rest #2for</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@belozer
belozer / useCarousel.ts
Created November 22, 2019 12:34 — forked from jaxxreal/useCarousel.ts
Carousel hook with gestures support
import * as React from 'react';
const { default: TinyGesture } = require('tinygesture');
export function useCarousel(itemsLength: number) {
const [state, setState] = React.useState({ currentIndex: 0, translateValue: 0 });
const carouselRef = React.useRef<HTMLDivElement>(null);
React.useEffect(() => {
const gesture = new TinyGesture(carouselRef.current);