This file contains hidden or 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
// Simplistic (probably most common) approach. | |
// This approach assumes either that: | |
// 1) passive effects are always run synchronously, after paint, or | |
// 2) passive effects never attach handlers for bubbling events | |
// If both of the above are wrong (as can be the case) then problems might occur! | |
useEffect(() => { | |
const handleDocumentClick = (event: MouseEvent) => { | |
// It's possible that a "click" event rendered the component with this effect, | |
// in which case this event handler might be called for the same event (as it bubbles). | |
// In most scenarios, this is not desirable. |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Highlighting elements example</title> | |
</head> | |
<body> |
This file contains hidden or 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
function toJSON(node) { | |
let propFix = { for: 'htmlFor', class: 'className' }; | |
let specialGetters = { | |
style: (node) => node.style.cssText, | |
}; | |
let attrDefaultValues = { style: '' }; | |
let obj = { | |
nodeType: node.nodeType, | |
}; | |
if (node.tagName) { |
This file contains hidden or 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
declare module 'react-table' { | |
// TypeScript Version: 3.5 | |
import { ReactNode, ComponentType, MouseEvent } from 'react'; | |
/** | |
* The empty definitions of below provides a base definition for the parts used by useTable, that can then be extended in the users code. | |
* | |
* @example | |
* export interface TableOptions<D extends object = {}}> |
This file contains hidden or 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 İnstagram ext | |
// @namespace Violentmonkey Scripts | |
// @match https://www.instagram.com/* | |
// @grant none | |
// @version 1.2 | |
// @grant GM_addStyle | |
// @author @mmnyldrm | |
// @description İnstagram yardımcı eklenti | |
// ==/UserScript== |
This file contains hidden or 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 IG denoiser | |
// @namespace https://noromanba.github.com | |
// @description hidden user comments on instagram.com for UserScript | |
// @include https://www.instagram.com/* | |
// @grant none | |
// @noframes | |
// @run-at document-start | |
// @version 2019.5.28.1 | |
// @homepage https://gist.github.com/noromanba/1f369b316c1b43bdf0e337c6c5af1c80 |
This file contains hidden or 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
#!/bin/bash | |
S3_BUCKET_NAME=$1 | |
CF_ID=$2 | |
# Sync all files except for service-worker and index | |
echo "Uploading files to $S3_BUCKET_NAME..." | |
aws s3 sync build s3://$S3_BUCKET_NAME/ \ | |
--acl public-read \ | |
--exclude service-worker.js \ |
This file contains hidden or 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
const cache = {} | |
export default function useGlobalMemo (key, fn, deps) { | |
if (!cache[key]) { | |
cache[key] = { | |
subs: 0, | |
deps, | |
value: fn(), | |
} |
This file contains hidden or 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
export default function createCrudHooks({ | |
baseKey, | |
indexFn, | |
singleFn, | |
createFn, | |
updateFn, | |
deleteFn, | |
}) { | |
const useIndex = (config) => useQuery([baseKey], indexFn, config) | |
const useSingle = (id, config) => |