Skip to content

Instantly share code, notes, and snippets.

View oirodolfo's full-sized avatar
🏳️‍🌈
working from home

Rod Kisten (Costa) oirodolfo

🏳️‍🌈
working from home
View GitHub Profile
@oirodolfo
oirodolfo / github-metrics.svg
Created November 16, 2021 21:01 — forked from bokub/github-metrics.svg
Github Metrics
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@oirodolfo
oirodolfo / types.ts
Created November 11, 2021 19:14 — forked from ClickerMonkey/types.ts
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
// 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.
@oirodolfo
oirodolfo / index.html
Created August 20, 2021 19:44 — forked from awestbro/index.html
Highlighting margin, border, and padding with Javascript
<!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>
@oirodolfo
oirodolfo / dom-to-json.js
Created August 5, 2021 17:51 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
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) {
@oirodolfo
oirodolfo / ultimate-ut-cheat-sheet.md
Created July 1, 2021 18:00 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
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 = {}}>
@oirodolfo
oirodolfo / instagram.js
Created June 18, 2021 20:26 — forked from muminy/instagram.js
Violentmonkey instagram addition
// ==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==
@oirodolfo
oirodolfo / ig-denoiser.user.js
Created June 18, 2021 20:25 — forked from noromanba/ig-denoiser.user.js
hidden user comments on instagram.com for UserScript
// ==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
@oirodolfo
oirodolfo / react-app-s3-sync.sh
Created June 15, 2021 18:06 — forked from kevindice/react-app-s3-sync.sh
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/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 \