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
| ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' |
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
| type Accumulation struct { | |
| messages []interface{} | |
| t *time.Timer | |
| } | |
| // Accumulator debounces and accumulates values then sends them to function passed in the Add method | |
| // Implements a concurrency safe map that can accumulate messages based on a key | |
| type Accumulator struct { | |
| acc map[string]*Accumulation | |
| mu sync.Mutex |
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
| import { useEffect, useState } from 'react'; | |
| export default function useDocumentScrollBottom(offset: number = 0): boolean { | |
| const [atBottom, setAtBottom] = useState(false); | |
| useEffect(() => { | |
| const el = document; | |
| let timeoutId: any; |
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
| # Will print out 10 latest worked on git branches with (author, lasted worked, name) with a star on your active branch | |
| git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' |
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 type MockedInterface<T> = { | |
| [K in keyof T]: T[K] extends (...args: infer A) => infer B | |
| ? jest.Mock<B, A> | |
| : MockedInterface<T[K]>; | |
| }; | |
| export function mockInterface<T>( | |
| initialValue: { [K in keyof T]?: MockedInterface<T[K]> } = {} | |
| ): MockedInterface<T> { | |
| const source = { |
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
| import request from 'request-promise' | |
| class User{ | |
| emailUrl = "emailserver.com/api" | |
| constructor( | |
| private firstName: string, | |
| private lastName: string, | |
| private age: number, | |
| private email: string, | |
| ){} |
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 obj = { | |
| a: 1, | |
| deeper:{ | |
| val: "lol", | |
| amArr: ['uuh', 'yuh'] | |
| }, | |
| b:{ | |
| c:{ | |
| val: 2, | |
| arr: [3,4,5], |
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
| import {RootType} from "../rootreducer"; | |
| import {useSelector} from "react-redux"; | |
| export function useTypedSelector<T>( | |
| selector: (state: RootType) => T, | |
| equalityFn?: (left: T, right: T) => boolean): T { | |
| return useSelector<RootType, T>(selector, equalityFn); | |
| } |