Skip to content

Instantly share code, notes, and snippets.

View rake7h's full-sized avatar
πŸ˜€

Rakesh rake7h

πŸ˜€
View GitHub Profile
@rake7h
rake7h / Native.js
Created October 21, 2021 12:17 — forked from alexreardon/Native.js
Some vanilla JS methods and patterns
// Native selectors.
(function(window, document) {
'use strict';
var noop = function() {
};
// DOCUMENT LOAD EVENTS
// not needed at the bottom of the page
document.addEventListener('DOMContentLoaded', noop);
@rake7h
rake7h / vanilla-js-cheatsheet.md
Created October 21, 2021 12:14 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@rake7h
rake7h / safari-nomodule.js
Created September 17, 2021 16:50 — forked from samthor/safari-nomodule.js
Safari 10.1 `nomodule` support
/*
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@rake7h
rake7h / ServingES6.md
Created May 23, 2021 14:51 — forked from newyankeecodeshop/ServingES6.md
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@rake7h
rake7h / clear-cache.js
Created April 8, 2021 18:42 — forked from deanhume/clear-cache.js
Clear Service Worker Cache
if ('serviceWorker' in navigator) {
caches.keys().then(function(cacheNames) {
cacheNames.forEach(function(cacheName) {
caches.delete(cacheName);
});
});
}
cacheGroups: {
reactVendor: {
test: /[\\/]node_modules[\\/](react|react-dom|react-router|react-loadable)[\\/]/,
name: 'reactvendor',
},
reactRedux: {
test: /[\\/]node_modules[\\/](redux|react-redux|axios)[\\/]/,
name: 'reactRedux',
},
utilityVendor: {

Setup MinIO on Ubuntu 20.04 LTS with Let's Encrypt SSL

✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨
SUPPORT MY WORK - Everything Helps Thanks
YouTube πŸ”— https://YouTube.GetMeTheGeek.com
Buy Me a Coffee β˜• https://www.buymeacoffee.com/getmethegeek
Hire US πŸ”— https://getmethegeek.com
Digital Ocean referral πŸ”— https://tiny.cc/plxdigitalocean
✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨✨

@rake7h
rake7h / gist:55f17c4b0f3681301bf9d183253cc049
Created January 12, 2021 09:25 — forked from paulirish/gist:5558557
a brief history of detecting local storage

A timeline of the last four years of detecting good old window.localStorage.


Jan Lenhart, bless his heart contributed the first patch for support:

October 2009: 5059daa

setTimer(time) {
if (this.timerHandle) {
// Exception?
return;
}
// Remember the timer handle
this.timerHandle = setTimeout(() => {
this.closePopover();
this.timerHandle = 0;
}, time);
@rake7h
rake7h / isFirstRender
Created December 8, 2020 16:51
set is first render react function component
function MyComponent() {
const isFirstRef = useRef(true);
const [count, setCounter] = useState(0);
useEffect(() => {
if (isFirstRef.current) {
isFirstRef.current = false;
return;
}
console.log('The counter increased!');