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 / 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';
@pzinwai
pzinwai / gist:3364b744128779208b3457dfba05a877
Created November 16, 2020 02:09
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 / 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;