Skip to content

Instantly share code, notes, and snippets.

View jeserodz's full-sized avatar

Jese Rodriguez jeserodz

  • X-Team
  • Santiago, Dominican Republic
  • X @jeserodz
View GitHub Profile
@jeserodz
jeserodz / .dockerignore
Last active December 28, 2020 21:40
Node.js DevOps
# Location: <project_root>/.dockerignore
#
# Description: Ignore these files when building the Docker image.
node_modules
npm-debug.log
@jeserodz
jeserodz / react-native-scaling-utils.js
Created April 24, 2020 13:12
React Native - Scaling Utils
// 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;
@jeserodz
jeserodz / useLayout.js
Created February 9, 2020 14:56
useLayout hook for React Native
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 });
@jeserodz
jeserodz / node-folder-structure-options.md
Created January 31, 2020 12:16 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@jeserodz
jeserodz / database.rules.json
Created November 22, 2019 13:20 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@jeserodz
jeserodz / resetXcode.sh
Created November 20, 2019 20:26 — forked from maciekish/resetXcode.sh
Reset Xcode. Clean, clear module cache, Derived Data and Xcode Caches. You can thank me later.
#!/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
@jeserodz
jeserodz / mobile-dev-cli-commands.md
Last active February 5, 2020 19:27
Mobile Development CLI Commands

Android

Clean Android project

gradlew clean

Print all dependencies in Android project

gradlew -q dependencies <app_module>:dependencies

gradlew -q dependencies app:dependencies

@jeserodz
jeserodz / find_and_remove_node_modules.sh
Created September 28, 2019 14:13
Find and remove node_modules
# 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
@jeserodz
jeserodz / routing.js
Last active September 19, 2019 20:45
Routing utils for React Navigation
/** 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);
}
@jeserodz
jeserodz / ffmpeg-examples.sh
Created July 31, 2019 16:37
FFmpeg Examples
# ===============
# 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