Skip to content

Instantly share code, notes, and snippets.

View MAgungHKM's full-sized avatar
🤓
Developing

Muhammad Agung Hikmatullah MAgungHKM

🤓
Developing
  • Indonesia
View GitHub Profile
@MAgungHKM
MAgungHKM / useOrientation.js
Created September 20, 2021 02:45
React Native Device Orientation hook. (example: const deviceOrientation = useOrientation(); if (deviceOrientation === 'PORTRAIT') {...} else {/* LANDSCAPE */ ... }
import {isUndefined} from 'lodash';
import {useEffect, useState, useCallback} from 'react';
import {Dimensions, ScaledSize} from 'react-native';
const dimensions = Dimensions.get('window');
export type Orientation = 'LANDSCAPE' | 'PORTRAIT';
const getOrientation = ({
width,
@MAgungHKM
MAgungHKM / git-grab.sh
Last active January 16, 2021 15:27
This is a simple Bash function for downloading a specific folder from a GitHub Repository which I created from this [link](https://stackoverflow.com/a/44109535). You can place this inside your bashrc or any other file. As far as testing goes, everything seems to be working fine.
# custom download git folder function/command
git-grab() {
if [ $# -lt 3 ]; then
# Display Help
echo "This function will download specific folder/directory of a github repo"
echo
echo "Syntax: git-grab <user-name> <repo-name> <directory> # download from master branch"
echo "Syntax: git-grab <user-name> <repo-name> <branch> <directory> # download from a specific branch"
echo
elif [ $# -eq 3 ]; then