Skip to content

Instantly share code, notes, and snippets.

View pzinwai's full-sized avatar
👨‍💻
Node.js / PHP / .NET / Python

Daniel Phyo pzinwai

👨‍💻
Node.js / PHP / .NET / Python
View GitHub Profile
@pzinwai
pzinwai / Handling multiple GitHub accounts on a MacBook.md
Last active August 4, 2024 23:15
Handling multiple GitHub accounts on a MacBook

Handling multiple GitHub accounts on a MacBook

If you have two GitHub accounts — one for work and one for personal use — you'll want to set them both up on your Mac.

To do this, you'll need to create separate SSH key pairs for each account.

1. Create SSH keys for all accounts

First make sure your current directory is your .ssh folder.

@pzinwai
pzinwai / compareSemanticVersions.js
Last active December 5, 2022 05:04
compareSemanticVersions.js
const compareSemanticVersions = (a: string, b: string) => {
// 1. Split the strings into their parts
const a1 = a.split('.');
const b1 = b.split('.');
// 2. Contingency in case there's a 4th or 5th version
const len = Math.min(a1.length, b1.length);
// 3. Look through each version number and compare.
for (let i = 0; i < len; i++) {
const a2 = +a1[ i ] || 0;
const b2 = +b1[ i ] || 0;
@pzinwai
pzinwai / .htaccess
Last active August 4, 2024 23:17
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@pzinwai
pzinwai / upload_to_s3.js
Last active October 16, 2020 09:19
Uploading files to S3 with Node.js
const fs = require('fs');
const AWS = require('aws-sdk');
// Enter copied or downloaded access id and secret here
const ID = '';
const SECRET = '';
// Enter the name of the bucket that you have created here
const BUCKET_NAME = 'test-bucket-1248847363334';