Skip to content

Instantly share code, notes, and snippets.

View WarrenBuffering's full-sized avatar

WarrenBuffering WarrenBuffering

  • South Dakota
  • 16:46 (UTC -07:00)
View GitHub Profile
@WarrenBuffering
WarrenBuffering / useFetchStatus.ts
Last active September 4, 2023 23:47
goated hooks
import { useCallback, useMemo, useState } from 'react';
import { FetchStatus } from '../enums';
export function useFetchStatus() {
const [errorCode, setErrorCode] = useState<number | null>(null);
const [errorMessage, setErrorMessage] = useState<string>('');
const [status, setStatus] = useState<FetchStatus>(FetchStatus.UNFETCHED);
const fail = useCallback((message: string, code?: number) => {
@WarrenBuffering
WarrenBuffering / gist:f4be4a282dd3922f4325098811464a78
Created April 29, 2024 04:58
Fetch Util w/ Exponential Backoff
import { StatusMessage } from '../constants';
import { isObject } from '../utils/isObject';
import type { RequestResponse } from '../types';
export type RequestParams = {
body?: BodyInit;
credentials?: RequestCredentials;
headers?: HeadersInit;
integrity?: string;
import React, { Component } from 'react'
import { Animated, Dimensions, Easing, PanResponder, SafeAreaView, StyleSheet, Text, View } from 'react-native'
import { connect } from 'react-redux'
import FastImage from 'react-native-fast-image'
// Actions & Selectors
import { setCurrComp, setNextComp, setPrevComp } from '../actions'
import { getCurrComp, getNextComp, getPrevComp } from '../selectors/comps'
import { getActiveProject } from '../selectors/projects'
@WarrenBuffering
WarrenBuffering / faster_compress_video
Last active August 22, 2024 19:38 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in