Skip to content

Instantly share code, notes, and snippets.

@mfrancois3k
mfrancois3k / AnimatedRoutes
Last active May 28, 2022 10:01
Framer motion AnimatedRoutes
Reference
https://github.com/oyedeletemitope/page-transition-in-react-using-framer-motion/blob/master/src/App.js#L5
import React from "react";
import { Routes, Route, useLocation } from "react-router-dom";
import Home from "./Home";
import Contact from "./Contact";
import About from "./About";
import { AnimatePresence } from "framer-motion";
function AnimatedRoutes() {
@kamrankamrani
kamrankamrani / serviceWorkerRegistration.js
Created May 26, 2022 12:40
service worker update pwa application
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.0/8 are considered localhost for IPv4.
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
);
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
async function saveToFile(html) {
await fs.writeFile("./content.html", html, "utf-8");
console.log("file saved to " + process.cwd() + "/content.html");
}
@Vectorized
Vectorized / YulSnippets.sol
Last active April 29, 2023 21:55
Solidity Yul Assembly Snippets
// SPDX-License-Identifier: MIT
// Author: vectorized.eth
pragma solidity ^0.8.0;
pragma abicoder v2;
// DISCLAIMER:
// This is experimental software and is provided on an "as is" and "as available" basis.
// We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
library Base64 {
@mfrancois3k
mfrancois3k / animationSequence-example.ts
Created May 13, 2022 06:24 — forked from steveruizok/animationSequence-example.ts
Framer Motion Animation Sequences
import * as React from "react"
import { Override, Data, AnimationControls, useAnimation } from "framer"
import { useAnimationSequence } from "./useAnimationSequence"
import { animationSequence } from "./animationSequence"
// Learn more: https://framer.com/docs/overrides/
let heart1: AnimationControls
let heart2: AnimationControls
let heart3: AnimationControls
@rluvaton
rluvaton / regex-snippets.md
Created May 11, 2022 07:24
Regex Snippets

Regex Snippets

Files

Match only one lines that have 1 node_modules folder in their string

^(?:(?!node_modules).)*(?:node_modules)(\/|$)(?!.*(?:node_modules))
@mfrancois3k
mfrancois3k / PrivateRoute.js
Last active June 8, 2022 21:40
Protected-private-routes-react-router-dom-v6
import { Navigate, Outlet } from "react-router-dom";
function PrivateRoute({ isLogged }) {
return isLogged ? <Outlet /> : <Navigate to="/" />;
}
export default PrivateRoute;
@mfrancois3k
mfrancois3k / CombinedContextProviders.js
Last active May 28, 2022 09:39
useReducer and Context Together
store > global > CombinedContextProviders.js
//https://codesandbox.io/s/how-to-use-contex-use-reducer-use-memo-forked-zf1k65?file=/src/components/DisplayAuth.js:0-472
import ContextProviderComposer from "./ContextProviderComposer";
import { GlobalStateProvider } from "./global/global.provider";
const CombinedContextProviders = ({ children }) => {
return (
<ContextProviderComposer
contextProviders={[<GlobalStateProvider key={"global_state_provider"} />]}
@mfrancois3k
mfrancois3k / animatetext.tsx
Created May 10, 2022 04:01 — forked from netgfx/animatetext.tsx
Framer animate text
import * as React from "react"
import {
Frame,
addPropertyControls,
ControlType,
useMotionValue,
Color,
useAnimation,
animate,
} from "framer"
@mfrancois3k
mfrancois3k / Chart.tsx
Created May 10, 2022 03:57 — forked from netgfx/Chart.tsx
Framer chartjs
import { useState } from "react"
import { motion } from "framer-motion"
import { addPropertyControls, ControlType } from "framer"
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from "chart.js"
import { Doughnut } from "react-chartjs-2"
ChartJS.register(ArcElement, Tooltip, Legend)
export default function Chart(props) {
const { tint, style, data1, data2, data3, data4, data5, data6 } = props