Skip to content

Instantly share code, notes, and snippets.

View adi518's full-sized avatar
🌴
On vacation

Adi adi518

🌴
On vacation
View GitHub Profile
@adi518
adi518 / 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
@adi518
adi518 / 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>
)
);
@adi518
adi518 / 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],
--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 {
@adi518
adi518 / 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%
@adi518
adi518 / 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';
@adi518
adi518 / 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)
@adi518
adi518 / consumer.js
Last active October 31, 2019 19:05
Higher-order React component for providing fallback content while server-dependent props are absent.
// `MyComponent` depends on server-data, so it will render nothing
// or a fallback component until fetching is completed.
const withFallback = composeFallback(({ serverData }) => [serverData]);
export default withFallback(MyComponent);