Skip to content

Instantly share code, notes, and snippets.

View adi-works's full-sized avatar
🐦

Adi Sahar adi-works

🐦
View GitHub Profile
@adi-works
adi-works / MEMOIZE.md
Created June 28, 2024 16:02 — forked from mrousavy/MEMOIZE.md
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
@adi-works
adi-works / react-select-data-attributes.jsx
Created August 30, 2021 14:58 — forked from MikaelCarpenter/react-select-data-attributes.jsx
Solution for adding data attributes to a react-select component by passing in "custom components" where you've manipulated the innerProps prop
import React, { Component } from 'react';
import ReactSelect, { components } from 'react-select';
const TextOption = props => (
components.Option && (
<components.Option { ...props }>
...
</components.Option>
)
);
@adi-works
adi-works / hotkeys.js
Created August 25, 2021 22:00 — forked from abuduba/hotkeys.js
Hotkey library
const isEqual = (a, b) => {
const aKeys = Object.keys(a);
if (aKeys.length !== Object.keys(b).length) {
return false;
}
return aKeys.every(
(k) => Object.prototype.hasOwnProperty.call(b, k)
&& a[k] === b[k],
@adi-works
adi-works / index.html
Created November 3, 2020 18:24
`value => value` vs Boolean #jsbench #jsperf (https://jsbench.github.io/#04b0ae9d1a00327b88ff8c9a4c98abdb) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>`value => value` vs Boolean #jsbench #jsperf</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>

Battery Light Indicator

  • Green: 50-100%
  • Orange: 20-50%
  • Red: < 20%
@adi-works
adi-works / matrixDigitalRain.js
Created March 31, 2020 14:25 — forked from danielt69/matrixDigitalRain.js
Matrix rain animation using HTML5 canvas and javascript
// https://codepen.io/P3R0/pen/MwgoKv
var matrix = (function(){
var init = function() {
document.body.style.background = 'black';
var mdr = document.createElement('canvas');
mdr.id = "mdr";
mdr.style.display = 'block';
mdr.style.position = 'fixed';
mdr.style.top = '0';
mdr.style.left = '0';
--scrollbar-thumb-width: 9px; // bigger = smaller width
--scrollbar-thumb-margin: 3px;
--scrollbar-thumb-color: rgba(255, 255, 255, 0.25);
/* Chrome-like (mobile) scrollbar */
&::-webkit-scrollbar {
width: var(--scrollbar-thumb-width);
}
&::-webkit-scrollbar-thumb {
@adi-works
adi-works / git-tag-delete-local-and-remote.sh
Last active September 14, 2021 13:11 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@adi-works
adi-works / README-Template.md
Created February 17, 2020 21:13 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

function* fibonacci(limit = Infinity) {
let [prev, current] = [0, 1]
while (current < limit) {
;[prev, current] = [current, prev + current]
yield current
}
}
for (let i of fibonacci(30)) console.log(i)