Skip to content

Instantly share code, notes, and snippets.

View pH-7's full-sized avatar
:octocat:
πŸ’‘Creative Engineer πŸš€ Enjoying Learning New Exciting Things! πŸ˜‹ =>My Way of Life 🏝

β™š PH⑦ β€” Pierre-Henryβ„’β™› pH-7

:octocat:
πŸ’‘Creative Engineer πŸš€ Enjoying Learning New Exciting Things! πŸ˜‹ =>My Way of Life 🏝
View GitHub Profile
@pH-7
pH-7 / show-last-tags.sh
Last active May 1, 2024 00:37
Show the last three git tags (very handy) - https://github.com/pH-7
git tag --sort=-creatordate | head -n3
@pH-7
pH-7 / install-and-set-default-python-27-mac.md
Last active December 18, 2023 02:18
Install Python v2.7 and set it as default one on Mac OS

Install Python 2.7 on Mac OS

You will need to have Python 2.7 (and not v3 to avoid incompatibilities with some libraries). To check what’s your default Python version, type python -V in your terminal.

brew install pyenv
pyenv install 2.7.18
pyenv global 2.7.18 # set Python 2.7 as the global default one
@pH-7
pH-7 / install-postgres14-mac-os.md
Last active December 18, 2023 02:44
Install Postgres 14 on Mac OS

Install Postgres 14

First, make sure you have homebrew installed.

Then, in your terminal, run brew install [email protected]

Login into psql postgres

start/stop postgres

@pH-7
pH-7 / .vimrc
Last active January 25, 2025 06:16
My ~/.vimrc configuration file - (not maintained anymore) New updates are now happening in https://github.com/pH-7/dotfiles/
syntax on
@pH-7
pH-7 / get-mac-finder-preferences.md
Last active April 25, 2024 17:23
Copy Mac Finder preferences to another Mac

Apple's iCloud isn't able to sync the Finder preferences. However, you can copy/paste the following two plist files to your new Mac.

Copy the following two files to your other Mac computer

~/Library/Preferences/com.apple.dock.plist
~/Library/Preferences/com.apple.finder.plist
@pH-7
pH-7 / fonts-coding-vs-code.md
Last active September 20, 2025 04:49
My favorite fonts for convenient coding on VS Code

Best fonts for your IDE

  1. Space Mono (my favorite one!)
  2. Fira Code (my second favorite one πŸ˜„)
  3. MonoLisa (paid, balanced design).
  4. Inconsolata (classic, free).
  5. Apercu Mono (quirky, modern).
  6. Input Mono (customisable, developer-friendly).
  7. Gintronic (distinctive, playful).
  8. Operator Mono (paid, elegant italics).
@pH-7
pH-7 / retry.ts
Last active May 15, 2024 14:54
Retry - A generic retry function (handy for various use cases)
/**
* A generic retry function (handy for various use cases).
*/
const retry = async <T>(fn: () => Promise<T>, maxRetries = 3, delay = 1000): Promise<T> => {
let retries = 0;
while (retries < maxRetries) {
try {
return await fn();
} catch (error) {
@pH-7
pH-7 / WarningLeaveTab.tsx
Last active September 28, 2024 15:18
Show warning message when a user attempts to leave the tab (the webpage)
import { useEffect, useCallback } from 'react';
interface LeaveBrowserWarningProps {
shouldWarn: boolean;
}
/**
* Component that displays a warning message when the user attempts to leave the page.
* @param {LeaveBrowserWarningProps} props - The component props
* @returns {null}
@pH-7
pH-7 / .tmux.conf
Last active January 25, 2025 06:15
My tmux conf file ~/.config/tmux/tmux.conf - (not maintained anymore) New updates are now happening in https://github.com/pH-7/dotfiles/
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
run '~/.tmux/plugins/tpm/tpm'
@pH-7
pH-7 / PhoneLinkComponent.tsx
Created June 9, 2024 01:58
React Native PhoneLink component. e.g. <PhoneLink phoneNumber="+442011145678" />
import React from 'react';
import { StyleSheet, Text, TouchableOpacity, Linking } from 'react-native';
interface PhoneLinkProps {
phoneNumber: string;
}
export const PhoneLink: React.FC<PhoneLinkProps> = ({ phoneNumber }) => {
const handlePress = () => {
Linking.openURL(`tel:${phoneNumber}`);