Skip to content

Instantly share code, notes, and snippets.

View uwemneku's full-sized avatar

Uwem Israel uwemneku

  • Nigeria
View GitHub Profile
@uwemneku
uwemneku / NestedScrollView.tsx
Last active December 15, 2022 19:12
Nesting a scrollView in a pangesture handler such that the pangesture is only active at the beginning and end of the scrollview
import React, { useRef, useState } from "react";
import {
ScrollView,
PanGestureHandler,
PanGestureHandlerGestureEvent,
} from "react-native-gesture-handler";
import Animated, {
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,
@uwemneku
uwemneku / isVariableNotEmpty.md
Last active February 13, 2022 20:26
Checking is a variable is empty

This funtion is able to check if a variable is empty. For objects, it uses recurssion to check if the proprties are empty.

const isVariableNotEmpty = (v: string |number | Array<any> | object): boolean => {
    if (typeof v === "string" || Array.isArray(v)) {
      return v.length > 0;
    } else if (typeof v === "number") {
      return v > 0;
    } else if (typeof v === "object") {
 const allValues = Object.values(v);
@uwemneku
uwemneku / ReactNativeLoadingComponent.md
Last active December 29, 2021 08:57
How to add loading animation to an Image component in react native using reanimated2

How to add loading animation to a react native component using reanimated2

We'll wrap the the Image component in an animated view having the same dimension as the image. The image opacity will be set to 0 on mounting while we animated the background of the animated view with a loop animation When the image is loaded, we'll stop the loop animation and set the image opacity to 1

import React, { useEffect, useState } from "react";
import Animated, {
  interpolateColor,
@uwemneku
uwemneku / GmailFilter.gs
Created October 30, 2021 14:30
How to show
const months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
const days = ["Sunday", "Saturday", "Monday", "Tuesday", "Wenesday", "Thursday", "Friday"];
function myFunction() {
let name
let email
const threads = GmailApp.search("category:primary").forEach((item, i, u) => {
item.getMessages().forEach(item => {
@uwemneku
uwemneku / emailAutomation.js
Last active April 25, 2021 08:48
How to send custom emails from a spreadsheet using google apps script.
function createDocument(name, email, position, status){
//get the email template from google doc using the url of the file
const templateUrl = 'https://docs.google.com/document/d/1sRHXLlb3nsaiGVodhPNdt0SeYE1Gy-UnB4HQ1r2Wn-8/edit'
//Get that template
const template = DocumentApp.openByUrl(templateUrl)
// Extract the text in the body of the documemt
const text = template.getBody().getText()