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
Change: | |
gpg --full-gen-key | |
With: | |
gpg --gen-key |
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
// Simulate sleep for 2000 ms | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
sleep(2000).then( /* do something */ ); |
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
export const delay = (timeMs: number): Promise<void> => { | |
return new Promise((resolve) => { | |
setTimeout(resolve, timeMs); | |
}); | |
}; | |
// await delay(2000); |
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, useRef } from 'react'; | |
type THook<T extends HTMLElement> = [ | |
React.RefObject<T>, | |
boolean, | |
]; | |
export const useMouseHover = <T extends HTMLElement>(): THook<T> => { | |
const [hovered, setHovered] = useState(false); |
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'; | |
type TWindowSize = [number, number]; | |
type THook = TWindowSize; | |
export const useWindowResize = (): THook => { | |
const initSize: TWindowSize = [ | |
window.innerWidth, |
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, useRef } from 'react'; | |
type THook<T extends HTMLElement> = [ | |
React.RefObject<T>, | |
number, | |
]; | |
export const useMouseScroll = <T extends HTMLElement>(): THook<T> => { | |
const [scrollY, setScrollY] = useState<number>(0); |
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'; | |
import { PermissionsAndroid } from 'react-native'; | |
type THook = [boolean, boolean]; | |
interface PermissionsAndroidResponse { | |
[key: string]: string; | |
} |
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
#!/bin/bash | |
COLOR_OK='\033[1;32m' | |
COLOR_HEADING='\033[0;36m' | |
COLOR_ERROR='\033[0;31m' | |
NC='\033[0m' | |
# Set your project directory | |
APP_REPO_DIR=~/dev/project-dir |
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
// Requires extra step: install the package apollo-server-core | |
const { ApolloServer, gql } = require('apollo-server'); | |
const { ApolloServerPluginLandingPageGraphQLPlayground } = require('apollo-server-core'); | |
const typeDefs = gql` | |
type Query { | |
totalDays: Int! | |
} | |
`; |
OlderNewer