Skip to content

Instantly share code, notes, and snippets.

Avatar
🔬
📱 Probing iOS internals...

Jonathan Cardasis joncardasis

🔬
📱 Probing iOS internals...
View GitHub Profile
@joncardasis
joncardasis / SkeletonView.tsx
Created Feb 23, 2021
Simple SkeletonView react-native component
View SkeletonView.tsx
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,
@joncardasis
joncardasis / useOrientation.ts
Last active Dec 4, 2019
Simple React Native rotation lock with React Hooks
View useOrientation.ts
/**
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();
@joncardasis
joncardasis / jailbreak_protect.c
Last active Apr 13, 2021
iOS - Prevent debugger attachment in a jailbroken environment. Obfuscated by assembly and symbol mangling.
View jailbreak_protect.c
//
// 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.
@joncardasis
joncardasis / jb_protect_all_archs.h
Last active Oct 18, 2019
jb_protect for all device architectures
View jb_protect_all_archs.h
//
// 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
@joncardasis
joncardasis / jsBundleCache.sh
Created Jul 23, 2019
Detect if a jsbundle is dirty and needs to be rebuilt or if just the source code needs to be rebuilt
View jsBundleCache.sh
#!/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."
@joncardasis
joncardasis / optimizeImage.sh
Created Apr 5, 2019
Compresses and optimizes png image sizes for a given file or directory via pngquant.
View optimizeImage.sh
#!/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"
@joncardasis
joncardasis / build_universal_fat_framework.sh
Last active Mar 2, 2020
Build universal ios fat framework
View build_universal_fat_framework.sh
#!/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"
@joncardasis
joncardasis / get-ip.sh
Created Feb 4, 2019
Gets the machine's IP address
View get-ip.sh
#!/bin/bash
IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\ -f2 | awk 'NR==1{print $1}')
@joncardasis
joncardasis / gource.sh
Created Jan 29, 2019
gource - generate gource video for git repo
View gource.sh
# Install ffmpeg
brew install ffmpeg
# Install gource
brew install gource
# Generate video
gource \
--hide filenames \
--seconds-per-day 0.1 \
@joncardasis
joncardasis / UIViewController+StatusBar.swift
Created Jul 10, 2018
A swizzling method which introduces a `statusBarStyle` to control the display of the status bar on a view controller.
View UIViewController+StatusBar.swift
//
// UIViewController+StatusBar.swift
// StatusBarTesApp
//
// Created by Jonathan Cardasis (C) on 7/10/18.
// Copyright © 2018 Jonathan Cardasis. All rights reserved.
//
import UIKit