This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from 'react'; | |
export const createImperativeState = <State>( | |
initialState: State | (() => State) | |
) => { | |
let listeners: Array<(state: State) => void> = []; | |
let memoryState: State = | |
initialState instanceof Function ? initialState() : initialState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useReducer } from 'react'; | |
import { todoReducer, TodoActionType } from './todos'; | |
function App() { | |
const [state, dispatch] = useReducer(todoReducer, []); | |
function handleCreateNewTodo(ev: React.FormEvent<HTMLFormElement>) { | |
ev.preventDefault(); | |
const content = String(new FormData(ev.currentTarget).get('content')); | |
dispatch({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useStore, updateState } from './store'; | |
function App() { | |
const store = useStore(); | |
return ( | |
<div> | |
<button | |
onClick={() => { | |
updateState({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useRef } from "react"; | |
const ALL_MEDIA_RECORDER_EVENTS = [ | |
"dataavailable", | |
"error", | |
"pause", | |
"resume", | |
"start", | |
"stop", | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify | |
from flask_limiter import Limiter | |
from flask_limiter.util import get_remote_address | |
app = Flask(__name__) | |
# Configure rate limiting with in-memory storage | |
limiter = Limiter( | |
get_remote_address, | |
app=app, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Periodic Table Search Function | |
// @version 1.0.0 | |
// @description Adds a search function to Google's periodic table | |
// @author Armster15 | |
// @match https://www.google.com/search?* | |
// @match https://www.google.com/search/?* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=google.com | |
// @grant none | |
// @namespace https://gist.github.com/Armster15/365487549125f1825c5d5219d8486ace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Apex Learning Show/Hide Assessment Grades | |
// @version 1.0.0 | |
// @description On a completed assessment, show and hide the answers so you can test your knowledge with completed quizzes. Great for preparing for bigger tests. | |
// @author Armster15 | |
// @license The Unlicense | |
// @match https://course.apexlearning.com/* | |
// @grant none | |
// @namespace https://gist.github.com/Armster15/d2e059575947558532983e9c6459581c | |
// @supportURL https://gist.github.com/Armster15/d2e059575947558532983e9c6459581c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove OneNote Annotations | |
// @version 1.0.0 | |
// @description Need to hide drawing annotations in OneNote? This userscript is for you! It adds toggle buttons where you can hide/show the drawing annotations. | |
// @author Armster15 | |
// @license The Unlicense | |
// @match https://usc-onenote.officeapps.live.com/* | |
// @icon https://i.imgur.com/84FaPib.png | |
// @grant none | |
// @namespace https://gist.github.com/Armster15/0c8941b3b9af6e55874f4e082c5dc714 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name AniList Stars to Smileys | |
// @version 1.0.0 | |
// @description Converts the 5 star system to fire, smiley, meh, and frown icons | |
// @author Armster15 | |
// @license The Unlicense | |
// @match https://anilist.co/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=anilist.co | |
// @grant none | |
// @namespace https://gist.github.com/Armster15/b82176835de0965485a72d64c0c09bac |
NewerOlder