Skip to content

Instantly share code, notes, and snippets.

View EQuimper's full-sized avatar
🏠
Working from home

Emanuel Quimper EQuimper

🏠
Working from home
View GitHub Profile
@EQuimper
EQuimper / App.tsx
Created January 24, 2023 19:47 — forked from thedewpoint/App.tsx
Auth0 with refresh tokens and expo-auth-session
import { SafeAreaProvider } from 'react-native-safe-area-context';
import * as AuthSession from 'expo-auth-session';
import { RefreshTokenRequestConfig, TokenResponse, TokenResponseConfig } from 'expo-auth-session';
import jwtDecode from 'jwt-decode';
import { useEffect, useState } from 'react';
import { Alert, Platform, Text, TouchableOpacity } from 'react-native';
import { useAsyncStorage } from '@react-native-async-storage/async-storage';
import * as React from 'react'
import * as WebBrowser from 'expo-web-browser';
@EQuimper
EQuimper / nerd_fonts.sh
Created December 27, 2022 22:27 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
# Nerd Fonts for your IDE
# https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts && brew install --cask font-3270-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-fira-mono-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-go-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-lgc-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-monofur-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-overpass-nerd-font
@EQuimper
EQuimper / tmux-cheatsheet.markdown
Created December 26, 2022 15:27 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@EQuimper
EQuimper / machine.js
Last active May 28, 2021 14:24
Generated by XState Viz: https://xstate.js.org/viz
const paymentService = (context, event) =>
new Promise((resolve, reject) => {
// TODO: change this, it's MOCK
setTimeout(() => {
if (context.plan === 'annual') {
return reject('something went wrong');
}
return resolve();
@EQuimper
EQuimper / useScrollRestoration.ts
Created September 20, 2020 01:31
NextJS save scroll position between page for back handler
import React from 'react';
import Router, { NextRouter } from 'next/router';
// Save the scroll position for the given url
function saveScrollPosition(
url: string,
element: HTMLElement,
savePosition: (url: string, pos: number) => void
) {
@EQuimper
EQuimper / linking.js
Last active February 26, 2024 10:02
export const APP_LIST = {
"whatsapp": {pkgName: "com.whatsapp", urlScheme: "whatsapp", urlParams: "app"}, // fa
"facebook": {pkgName: "com.facebook.katana", urlScheme: "fb", urlParams: "requests"}, // fa: facebook-official
"facebook messenger": {pkgName: "com.facebook.orca", urlScheme: "fb-messenger", urlParams: "user-thread/{user-id}"}, // fa: facebook
"skype": {pkgName: "com.skype.raider", urlScheme: "skype", urlParams: "echo123?call"}, // fa
"wechat": {pkgName: "com.tencent.mm", urlScheme: "weixin", urlParams: "dl/chat"}, // fa
"snapchat": {pkgName: "com.snapchat.android", urlScheme: "snapchat", urlParams: "?u=foo"}, // fa
"twitter": {pkgName: "com.twitter.android", urlScheme: "twitter", urlParams: "messages"}, // fa
"youtube": {pkgName: "com.google.android.youtube", urlScheme: "youtube", urlParams: "watch?v=dQw4w9WgXcQ"}, // fa
"netflix": {pkgName: "com.netflix.mediaclient", urlScheme: "nflx", urlParams: ""},
export const toCamel = (value: string): string => (
value.replace(/([-_][a-z])/ig, ($1) => $1.toUpperCase()
.replace("-", "")
.replace("_", ""))
);
import React, { useState, useRef, useContext, useCallback } from 'react';
import { Dimensions, View, Animated } from 'react-native';
import { TabView } from 'react-native-tab-view';
import { TabScreen } from './Tab';
import { CustomTabBar } from './TabBar';
import { ThemeContext } from 'react-native-elements';
import { useHeaderHeight } from '@react-navigation/stack';
const AnimatedHeader = ({ style, content }) => {
return <Animated.View style={style}>{content}</Animated.View>;
};
@EQuimper
EQuimper / months.ts
Created January 27, 2020 19:52
Months with short + long in js/ts
const months = [
{
long: 'January',
short: 'Jan',
},
{
long: 'February',
short: 'Feb',
},
@EQuimper
EQuimper / main.go
Created January 5, 2020 00:12 — forked from dopey/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
// Adapted from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/