This is the reference point. All the other options are based off this.
|-- app
| |-- controllers
| | |-- admin
# Location: <project_root>/.dockerignore | |
# | |
# Description: Ignore these files when building the Docker image. | |
node_modules | |
npm-debug.log |
// Reference: https://github.com/nirsky/react-native-size-matters | |
import { Dimensions } from 'react-native'; | |
const { width, height } = Dimensions.get('window'); | |
const [shortDimension, longDimension] = width < height ? [width, height] : [height, width]; | |
//Default guideline sizes are based on standard ~5" screen mobile device | |
const guidelineBaseWidth = 350; | |
const guidelineBaseHeight = 680; |
import { useState, useCallback } from 'react'; | |
export function useLayout() { | |
const [size, setSize] = useState(null); | |
const [position, setPosition] = useState(null); | |
const onLayout = useCallback((event) => { | |
const { width, height, x, y } = event.nativeEvent.layout; | |
setSize({ width, height }); | |
setPosition({ x, y }); |
// No Security | |
{ | |
"rules": { | |
".read": true, | |
".write": true | |
} | |
} |
#!/bin/bash | |
killall Xcode | |
xcrun -k | |
xcodebuild -alltargets clean | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache" | |
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache" | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
rm -rf ~/Library/Caches/com.apple.dt.Xcode/* | |
open /Applications/Xcode.app |
# Find and list all node_modules under a given directory | |
find ~/Playground -type d -name 'node_modules' -prune | xargs du -sh | gsort -rh | |
# Find and delete all node_modules under a given directory | |
find ~/Playground -type d -name 'node_modules' -prune | xargs rm -r |
/** Gets the current screen from navigation state */ | |
function getActiveRouteName(navigationState) { | |
if (!navigationState) { | |
return null; | |
} | |
const route = navigationState.routes[navigationState.index]; | |
// dive into nested navigators | |
if (route.routes) { | |
return getActiveRouteName(route); | |
} |
# =============== | |
# Image Scaling # | |
# =============== | |
# Reducing or increasing size of an image | |
ffmpeg -i input.png -vf scale=310:240 output.png | |
# Maintain the aspect ratio of original image | |
ffmpeg -i input.png -vf scale=310:ih*240/iw output.png |