Skip to content

Instantly share code, notes, and snippets.

View giacomocerquone's full-sized avatar
🧠
Obsession beats talent, always.

Giacomo Cerquone giacomocerquone

🧠
Obsession beats talent, always.
View GitHub Profile
@giacomocerquone
giacomocerquone / api.js
Last active March 6, 2024 20:07
Handy thin wrapper around the fetch Api
const _toQueryString = params =>
`?${Object.entries(params)
.map(
([key, value]) =>
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`
)
.join("&")}`;
// EDIT here if you prefer a storage implementation or a store subscription etc.
// you could actually also remove the getToken function and directly call it in the header below
@giacomocerquone
giacomocerquone / appState-CORRECThooks.js
Last active October 27, 2019 19:58
Class to Hooks example
function AppStateChecker() {
const cachedAppState = useRef(AppState.currentState);
const _handleAppStateChange = useCallback(nextAppState => {
console.log(cachedAppState.current, nextAppState);
if (_backgroundState(nextAppState)) {
console.log('App is going background');
} else if (
_backgroundState(cachedAppState.current) &&
@giacomocerquone
giacomocerquone / useCodePush.js
Last active April 3, 2021 18:59
Useful hooks
import { useState, useEffect } from 'react';
import { Platform } from 'react-native';
import codePush from 'react-native-code-push';
import env from '../constants/env';
const { CODEPUSH_IOS_KEY, CODEPUSH_ANDROID_KEY } = env;
export default function useCodePush() {
const [ready, setReady] = useState(false);
@giacomocerquone
giacomocerquone / adbCommands.txt
Last active April 17, 2024 20:54
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"
@giacomocerquone
giacomocerquone / storeScreens.txt
Last active April 27, 2021 19:39
List of AppStore and PlayStore screenshots for publication.
AppStore
6.5 - iPhone 11 Pro Max (iPhone Xs Max)
5.5 - iPhone 8 Plus (iPhone 7 Plus, iPhone 6s Plus)
iPad Pro (12.9-inch)
@giacomocerquone
giacomocerquone / dns-check.js
Last active December 18, 2023 14:57
Print all non-active dns from pwds stored in bitwarden through bw cli
const axios = require("axios");
const bitwardenApiUrl = "http://localhost:8087";
const MASTER_PWD = "xxx";
// Function to unlock the vault
async function unlock() {
try {
const { data: unlockRes } = await axios.post(`${bitwardenApiUrl}/unlock`, {
password: MASTER_PWD,