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 { useCallback, useState, useRef, useEffect } from 'react'; | |
const usePromise = <T, U extends any[]>(operation: (...args: U) => Promise<T>) => { | |
const [data, setData] = useState<T>(); | |
const [error, setError] = useState<Error>(); | |
const [loading, setLoading] = useState(false); | |
const mounted = useRef<boolean>(true); | |
useEffect( | |
() => () => { |
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 React, { useCallback, useMemo, useRef, useState } from 'react'; | |
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; | |
import LinearGradient from 'react-native-linear-gradient'; | |
import Animated, { | |
block, | |
Clock, | |
cond, | |
Easing, | |
eq, | |
set, |
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
/** | |
1. Install and configure `react-native-orientation-locker`. | |
2. In both the iOS and Android projects, set the allowed platform orientations to everything except upside down. | |
*/ | |
import { useEffect } from 'react'; | |
import Orientation, { OrientationType } from 'react-native-orientation-locker'; | |
export function useLockOrientationPortrait() { | |
Orientation.lockToPortrait(); |
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
// | |
// jailbreak_protect.c | |
// | |
// Created by Jonathan Cardasis (C) on 10/11/19. | |
// Copyright © 2019 Jonathan Cardasis (C). All rights reserved. | |
// | |
// Source: https://medium.com/@joncardasis/mobile-security-jailbreak-protection-84aa0fbc7b23 | |
// Simply include this file in your project and ensure the file's Target Membership | |
// is set to your app. |
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
// | |
// jailbreak.h | |
// jailbreak-protect | |
// | |
// Created by Jonathan Cardasis (C) on 10/11/19. | |
// Copyright © 2019 Jonathan Cardasis (C). All rights reserved. | |
// | |
#ifndef jailbreak_h | |
#define jailbreak_h |
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 -e | |
# Check if JS code in a provided root folder has been changed. | |
# **SHOULD BE RUN WITH XCODE ENV VARIABLES** | |
# | |
# Creates a 'jsbundle-hashtable' in xcode product build directory to determine if | |
# the jsBundle needs to be rebuilt based on src directory hash value. | |
print_usage() { | |
printf "Usage: " | |
printf " %-20s %s\n" "--lookup-hash <target_name>" "Return hash value for <target_name> in table. Otherwise nothing is returned." |
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 | |
# Compresses and optimizes png image sizes for a given file or directory. | |
# @author: Jonathan Cardasis | |
CHECK_MARK="\033[0;32m\xE2\x9C\x94\033[0m" | |
PNGQUANT_BINARY_URL="https://pngquant.org/pngquant.tar.bz2" | |
optimize() { | |
ORIGINAL_PATH="$1" | |
NEW_PATH="$ORIGINAL_PATH.new" |
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 | |
# | |
# Builds the a framework for both the 64bit iOS architecture and | |
# a 64bit simulator architecture, combining the two into a single FAT framework. | |
# | |
set -e -o pipefail | |
print_available_options() { | |
printf "Usage: ./build_universal_ios_framework.sh -workspace <workspacepath> -target <targetname> -configuration <configurationname> -destination <destinationpath>\n\n" | |
printf "Options:\n" |
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 | |
IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\ -f2 | awk 'NR==1{print $1}') |
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
# Install ffmpeg | |
brew install ffmpeg | |
# Install gource | |
brew install gource | |
# Generate video | |
gource \ | |
--hide filenames \ | |
--seconds-per-day 0.1 \ |
NewerOlder