Skip to content

Instantly share code, notes, and snippets.

View lukebrandonfarrell's full-sized avatar
✌️
fixing bugs since 1996

Luke Brandon Farrell lukebrandonfarrell

✌️
fixing bugs since 1996
View GitHub Profile
import React, { ReactElement } from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { Subtitle } from '../subtitle/subtitle';
import { defaultStyle } from '../../styles/theme.style';
interface DateSelectProps {
label: string | undefined;
handlePickerOpen: () => void;
testID?: string;
@lukebrandonfarrell
lukebrandonfarrell / ExifData.swift
Created June 8, 2022 16:10
A Swift class for extracting exif data from URL, UIImage or Data types 🔭
//
// ExifData.swift
// Qeepsake
//
// Created by Luke Farrell on 26/05/2022.
//
import Foundation
import ImageIO
@lukebrandonfarrell
lukebrandonfarrell / Sourcemaps.ruby
Created May 16, 2022 12:09
Fastlane / Sentry Sourcemaps
lane :upload_sourcemaps do |options|
platform = options[:platform] || "ios"
version = options[:version] || get_version_number(xcodeproj: './ios/qeepsake.xcodeproj')
build_number = options[:build_number] || (platform == "ios" ? get_build_number(xcodeproj: "./ios/qeepsake.xcodeproj") : get_version_code())
bundle_name = platform == "ios" ? "main.jsbundle" : "index.android.bundle"
app_id = platform == "ios" ? "co.qeepsake.qeepsake" : "co.qeepsake.qeepsakeApp"
os_bin = platform == "ios" ? "osx-bin" : "linux64-bin"
puts "uploading sourcemaps for platform #{platform}, version #{version}, and build #{build_number}..."
sh("cd .. &&
@lukebrandonfarrell
lukebrandonfarrell / workspace-screen.js
Created May 25, 2021 10:37
Example of Animated re-ordering of a list in React Native using React Spring
/* NPM - Node Package Manage */
import React from 'react';
import { View, ScrollView } from 'react-native';
import { useTransition, animated } from "@react-spring/native";
/** Constants */
const AnimatedView = animated(View);
const ListItemHeight = 190;
export function WorkspaceScreen() {
const edges = [...];
@lukebrandonfarrell
lukebrandonfarrell / AppDelegate.m
Last active April 13, 2021 17:30
Perfect splash screen for iOS in React Native with fade animation (no dependancies!)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"MyApp" initialProperties:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
@lukebrandonfarrell
lukebrandonfarrell / latest_googleplay_version_code.rb
Created February 22, 2021 10:50
Gets the latest Google Play version code using Fastlane google_play_track_version_codes
def latest_googleplay_version_code
productionVersionCodes = google_play_track_version_codes(track: 'production')
betaVersionCodes = google_play_track_version_codes(track: 'beta')
alphaVersionCodes = google_play_track_version_codes(track: 'alpha')
internalVersionCodes = google_play_track_version_codes(track: 'internal')
# puts version codes from all tracks into the same array
versionCodes = [
productionVersionCodes,
betaVersionCodes,
useEffect(() => {
if((isReferralsError && !isReferralsEmpty) || (isUserError && !isUserEmpty)){
actionTipRef.current.show("Unable to load latest results")
}
}, [isReferralsError, isUserError, isReferralsEmpty, isUserEmpty])
/**
* @author Luke Brandon Farrell
* @description
*/
/* NPM - Node Package Manage */
import React, { useState } from "react";
import PropTypes from "prop-types";
const AsyncBoundary = ({
const { data: userData, isLoading: isUserLoading, error: isUserError } = ...;
const { data: referralData, isLoading: isReferralsLoading, error: isReferralsError } = ...;
const isUserReferralEmpty = _isNil(referralUrl);
const isReferralsEmpty = _isEmpty(referrals);
const isReferralsAvailable = !_isEmpty(referrals) && !isReferralsError;
@lukebrandonfarrell
lukebrandonfarrell / handleBackPress.js
Last active August 20, 2020 14:10
Hook to handle back press on Android in React Native with an exit alert.
import { Alert, BackHandler } from "react-native";
/*
* If we are using React Native Navigation
* the BackHandler.exitApp() will in some
* cases invoke a pop instead of exiting
* the application. Using the following
* library solves this issue:
*
* import RNExitApp from "react-native-exit-app";