Skip to content

Instantly share code, notes, and snippets.

View louicoder's full-sized avatar
🏠
Working remotely

Musanje Louis Michael louicoder

🏠
Working remotely
View GitHub Profile
@louicoder
louicoder / App.tsx
Created April 12, 2025 11:24 — forked from Glazzes/App.tsx
React Native pinch to zoom advanced
/**
* After some thoughts on this topic, I've decided to turn this gist along with other features into a library so you can zoom
* whatever you want, library you can find here https://github.com/Glazzes/react-native-zoom-toolkit.
*
* @author Santiago Zapata, Glazzes at Github <3
* @description This gist makes part of an article I'm writing about this topic (in spanish). This solution takes into account
* the linear algebra concepts and geometrical interpretation of the transform-origin property specification, this solution
* takes heavy inspiration from William's Candillon +3 year old video in this topic, however this solution brings it to the
* modern day along with a huge fix that prevents the origin from being displaced by an incorrect offset calculation after
* the first zoom interaction.
@louicoder
louicoder / Fixes.txt
Last active October 2, 2024 14:11
Pod instllation Errors [FIXES]
If BORINGSSL IS NOT INSTALLING OR TAKING FOREVER TRY
::::::::::: ERROR :::::::::::
[!] Error installing BoringSSL-GRPC
[!] /usr/bin/git clone https://github.com/google/boringssl.git /var/folders/27/913q89096q9dbzypqxdw7jsh0000gp/T/d20241002-39067-6cns7m --template=
Cloning into '/var/folders/27/913q89096q9dbzypqxdw7jsh0000gp/T/d20241002-39067-6cns7m'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
error: 730 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
@louicoder
louicoder / useKeyboardHeight.js
Last active July 31, 2024 12:11
React NAtive Hook for getting keyboard height
import { useEffect, useState } from "react";
import { Keyboard, KeyboardEvent } from "react-native";
export const useKeyboard = () => {
// TODO: uncomment to return the height
// const [ keyboardHeight, setKeyboardHeight ] = useState(0);
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
// const onKeyboardDidShow = (e) => setKeyboardHeight(e.endCoordinates.height);
@louicoder
louicoder / nvmCommands.js
Created December 6, 2023 12:29 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@louicoder
louicoder / getDifferenceBetweenDays.js
Created October 17, 2023 15:22
Get difference between two dates
function formatDateDifference(isoDateString) {
const inputDate = new Date(isoDateString);
const currentDate = new Date();
const timeDifference = currentDate - inputDate;
// Calculate the number of years
const years = Math.floor(timeDifference / (365.25 * 24 * 60 * 60 * 1000));
// Calculate the number of months
@louicoder
louicoder / working-with-iso-dates.js
Created April 17, 2023 11:13
Validate and also work with iso dates
// ==============================================
// Function validates whether passed string is valid iso format
function isIsoDate(str) {
if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) return false;
const d = new Date(str);
return d instanceof Date && !isNaN(d) && d.toISOString()===str; // valid date
}
console.log(isIsoDate('2011-10-05T14:48:00.000Z'))
@louicoder
louicoder / ReactNativeFirebaseErrors.js
Created February 23, 2023 16:09
React native Firebase Error for push notifications ios
// ================================================
<< Error >>
APNS device token not set before retrieving FCM Token for Sender ID
<< Fix >>
Add a firebase.json file at the root and add the following
{
"react-native": {
"analytics_auto_collection_enabled": false,
"messaging_ios_auto_register_for_remote_messages": false
@louicoder
louicoder / jsconfig.js
Created February 14, 2023 12:32
This is a file that helps you with shortening file imports in Javascript projects
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"src/*": [
"./src/*"
]
}
},
"include": [
@louicoder
louicoder / adbCommands.txt
Created January 18, 2023 12:20 — forked from giacomocerquone/adbCommands.txt
Useful adb logcat commands when working with react native
// useful to debug js code errors
adb logcat "*:S" ReactNative:V ReactNativeJS:V
// useful to debug native errors (when the app won't even start)
adb logcat "*:E"
@louicoder
louicoder / randomString.js
Created December 15, 2022 13:10
generate random with of specified length
export const generateString = (length = 10) => {
const characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
// const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;