Skip to content

Instantly share code, notes, and snippets.

View ianizaguirre's full-sized avatar
🔥
SLAYING BUGS

Ian Izaguirre ianizaguirre

🔥
SLAYING BUGS
  • Miami, Florida
  • 12:27 (UTC -04:00)
View GitHub Profile
@ramirezsandin
ramirezsandin / useRouterParams.ts
Last active October 23, 2023 07:58
React hook to be used with Next.js, it uses useRouter internally and offers some helper functions to manipulate the url query params.
import { useRouter } from "next/router";
import { ParsedUrlQuery } from "querystring";
interface UseRouterParamsOptions {
method?: "push" | "replace";
shallow?: boolean;
}
const useRouterParams = (options?: UseRouterParamsOptions) => {
const { query, pathname, push, replace } = useRouter();
@martinwoodward
martinwoodward / mermaid.md
Created February 11, 2022 20:34
GitHub HTML Rendering Pipeline
```mermaid
sequenceDiagram
    participant dotcom
    participant iframe
    participant viewscreen
    dotcom->>iframe: loads html w/ iframe url
    iframe->>viewscreen: request template
    viewscreen->>iframe: html & javascript
 iframe->>dotcom: iframe ready
await new Promise(function (resolve) {
setTimeout(function () {
resolve();
}, 1000);
});
// ... Can be shortened to:
await new Promise(function (resolve) {
setTimeout(resolve, 1000);
@getify
getify / 1.js
Created December 5, 2020 01:56
the "problem" with asynchronous closing of an async iterator
async function *getStuff(urls) {
showSpinner();
try {
for (let url of urls) {
let resp = await fetch(url);
yield await resp.json();
}
}
finally {
hideSpinner();
@vikpe
vikpe / fix_authenticity_of_github_problem.md
Last active June 12, 2024 12:44
FIX: The authenticity of host github.com can't be established.

Error

The authenticity of host 'github.com (140.82.113.4)' can't be established.

Fix

ssh-keyscan github.com >> ~/.ssh/known_hosts
@sekoyo
sekoyo / useResizeObserver.js
Last active July 28, 2022 06:55
useResizeObserver hook for React
import { useRef, useCallback, useEffect, useState } from 'react';
import { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer';
const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill;
export default function useResizeObserver() {
const [size, setSize] = useState({ width: 0, height: 0 });
const resizeObserver = useRef(null);
const onResize = useCallback(entries => {
@sibelius
sibelius / drawerStyled.tsx
Created July 16, 2019 14:54
how to use styled-components instead of clsx
const styles = theme => ({
drawer: {
position: 'absolute',
overflowX: 'hidden',
zIndex: theme.zIndex.drawer + 2,
[theme.breakpoints.up('sm')]: {
position: 'relative',
width: drawerWidth,
flexShrink: 0,
@xavierfoucrier
xavierfoucrier / gpg-signing.md
Last active June 21, 2024 13:14
GPG signing with Git and Github Desktop

GPG signing – git github-desktop

Here is a short guide that will help you setup your environment to create signed commits or signed tags with Git locally. This has been extensively tested on Windows with Git and the Github Desktop application: I use it every day for my professional development projects.

I you face any issue, feel free to leave a comment below.

Summary

  1. Sign commits or tags
  2. Key passphrase
  3. Disable signatures
  4. Renew a GPG key
@dsherret
dsherret / find-unused-exports.ts
Last active December 22, 2023 00:03
Searches files for any exported declarations that aren't used in other files.
// this could be improved... (ex. ignore interfaces/type aliases that describe a parameter type in the same file)
import { Project, TypeGuards, Node } from "ts-morph";
const project = new Project({ tsConfigFilePath: "tsconfig.json" });
for (const file of project.getSourceFiles()) {
file.forEachChild(child => {
if (TypeGuards.isVariableStatement(child)) {
if (isExported(child))
child.getDeclarations().forEach(checkNode);
@jacklorusso
jacklorusso / workbench.colorCustomizations.json
Last active December 19, 2023 07:40
A list of all Visual Studio Code customizable colors, grouped by UI region. Copy and paste into User Settings (comments are allowed) to tweak an existing theme or work on your own.
"workbench.colorCustomizations": {
// Contrast Colors - The contrast colors are typically only set for high contrast themes. If set, they add an additional border around items across the UI to increase the contrast.
"contrastActiveBorder": "",
"contrastBorder": "",
// Base Colors
"focusBorder": "",
"foreground": "",
"widget.shadow": "",
"selection.background": "",
"descriptionForeground": "",