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⑦ de Soriaβ„’β™› pH-7

:octocat:
πŸ’‘Creative Engineer πŸš€ Enjoying Learning New Exciting Things! πŸ˜‹ =>My Way of Life 🏝
View GitHub Profile
@pH-7
pH-7 / setup-ssh-key.md
Last active May 26, 2023 06:17
How to setup SSH key for the first time on your Mac OS

Setup your SSH key

How to setup SSH key for the first time on your Mac OS

To setup your SSH key on your computer

  1. Type ssh-keygen -t ed25519 -C "<YOUR_NAME>@zambrero.com"
  2. Create a SSH config file to automatically load keys into the ssh-agent and store passphrases in your keychain
    touch ~/.ssh/config
  3. Open the config file with your default text editor
@pH-7
pH-7 / 6-digit-code.js
Last active June 9, 2024 02:06
Generate a One-Tine Password / One-Time Code unique 6-digit code
// generate a unique 6-digit OTP code
const generateOntTimeCode = () => Math.floor(Math.random() * 900000) + 100000;
@pH-7
pH-7 / CounterApp.jsx
Last active January 26, 2023 02:09
Example of a React Counter with localStorage - https://www.youtube.com/@pH7Programming
import {useEffect, useState} from 'react'
import './App.css'
export const CounterApp = () => {
const storageKeyName = "count";
const retrieveCountValue = () => Number(localStorage.getItem(storageKeyName) || 0);
const [count, setCount] = useState(retrieveCountValue());
@pH-7
pH-7 / match.php
Last active January 17, 2023 19:50
PHP 8, `switch` VS `match`
<?php
$sDayPrefix = date('D');
$sMessage = match ($sDayPrefix) {
'Mon' => 'Hello Monday! Have a great week!',
'Tue' => 'Hello Tuesday! Have a great day!',
'Wed' => 'Happy hump day all!',
'Thu' => 'Almost the end of the working week!',
'Fri' => 'Yaay! Happy Friday!',
'Sat' => 'Enjoy your weekend! Have a great Saturday :)',
@pH-7
pH-7 / preserve-caps-column-names-postgresql.md
Created December 19, 2022 07:14
Preserve cases of column/table names with PostgreSQL

If you name your PostgreSQL table names or column names with caps like lowerCamel / UpperCamel cases, you will need to surround the column names/table name with double quotes to preserve the case of their names since our the columns in our database are lowerCamel case. Otherwise, Postgres wouldn’t find them as it would look for lowercase-only names.

@pH-7
pH-7 / caps-naming-convention-programming.md
Last active May 23, 2023 11:24
Naming Convention - Programming

Caps, programming

  • UpperCamel case for classes. e.g., MyClass {}
  • lowerCamel case for variable names. e.g., myVar = "";
  • snake_case for Python functions and other functions delimited with underscores _ e.g., my_function();
@pH-7
pH-7 / alfred-workflows.md
Last active March 1, 2025 06:45
My Alfred workflows

My Alfred productivity workflows

@pH-7
pH-7 / usa-states.ts
Created May 4, 2022 11:16
List of the US state names and their abbreviations, handy stored in an array containing an object for each state details. Enjoy πŸ₯³
export default [
{
name: 'Alabama',
abbreviation: 'AL',
},
{
name: 'Alaska',
abbreviation: 'AK',
},
{
@pH-7
pH-7 / InvalidDayMomentException.php
Last active March 28, 2022 19:56
Source code of my YouTube tutorial about handling multiple exceptions with PHP 7.1 - https://www.youtube.com/channel/UCGqLuT0upPiocwYSnnmqt2g
<?php
class InvalidDayMomentException extends InvalidArgumentException
{
}
@pH-7
pH-7 / animal-counter.js
Last active December 12, 2021 06:18
πŸ¦’ The simplest animal counter, using JS ES6's reduce() 🐘
const animals = [
'Crocodile',
'giraffe',
'elephant',
'snake',
'elephant',
'giraffe',
'giraffe',
'chicken',
'crocodile'