Skip to content

Instantly share code, notes, and snippets.

View hamzaerbay's full-sized avatar
🦁
Hakuna Matata!

Hamza Erbay hamzaerbay

🦁
Hakuna Matata!
View GitHub Profile
@hamzaerbay
hamzaerbay / debounce.js
Last active August 27, 2023 22:48
Debounce
/**
* Creates and returns a debounced version of the provided function.
* The debounced version of the function will delay the invoking of the
* original function until after a specified number of milliseconds have
* passed since the last time the debounced function was invoked.
*
* @param {Function} callback - The function to debounce.
* @param {number} delay - The number of milliseconds to delay invocation.
* @returns {Function} - The debounced version of the provided function.
*/
@hamzaerbay
hamzaerbay / VideoPlayer.jsx
Created April 27, 2020 06:15 — forked from andrewserong/VideoPlayer.jsx
An example Video JS component in React, based on the Video JS docs
import React from 'react';
import videojs from 'video.js';
import 'video.js/dist/video-js.css';
// video.js player from the docs: https://github.com/videojs/video.js/blob/master/docs/guides/react.md
class VideoPlayer extends React.Component {
componentDidMount() {
// instantiate Video.js
this.player = videojs(this.videoNode, this.props, function onPlayerReady() {
@hamzaerbay
hamzaerbay / HOF.js
Last active October 21, 2023 00:23
Reusable Functions
// Higher order Functions
// 1. Accept a function as an argument
// 2. Returns a new function
const withCount = fn => {
let count = 0;
return (...args) => {
console.log(`calls count ${++count}`);
return fn(...args);
@hamzaerbay
hamzaerbay / pronounce.txt
Created May 1, 2019 05:35 — forked from v0lkan/pronounce.txt
pronounciation notes
English Study:
th sound:
think about this thing that thing and those things
@hamzaerbay
hamzaerbay / what-forces-layout.md
Created February 21, 2019 22:05 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()