Skip to content

Instantly share code, notes, and snippets.

View harithzainudin's full-sized avatar
🎯
Focusing

Muhammad Harith Bin Zainudin harithzainudin

🎯
Focusing
View GitHub Profile
@harithzainudin
harithzainudin / generate-random-chars.js
Created October 27, 2023 03:15
Function to generate random characters according to the length provided
function generateUniqueID(length) {
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let uniqueID = '';
while (uniqueID.length < length) {
const randomIndex = Math.floor(Math.random() * characters.length);
const randomChar = characters.charAt(randomIndex);
// Make sure the generated character is not already in the uniqueID
if (!uniqueID.includes(randomChar)) {
@harithzainudin
harithzainudin / commit-msg-linter.js
Created August 5, 2023 12:15
Scripts for checking commit message that use with Husky. Read more here to implement this -->
/**
* This JavaScript function checks if a Git commit message follows a specific format and provides
* success or failure messages accordingly.
* @param buffer - The `buffer` parameter is a buffer object that contains the content of a file. In
* this code, it is used to read the content of the `.git/COMMIT_EDITMSG` file.
* @returns The code is returning the first line of the commit message from the `.git/COMMIT_EDITMSG`
* file.
*/
let supportsColor = { stdout: true };
const fs = require("fs");
@harithzainudin
harithzainudin / concat.js
Created July 31, 2022 16:11
Difference between Lodash concat & Javascript native concat
const _ = require("lodash");
const myClassmates = ["John", "Jane"];
const mySenior = ["Alice", "Bob"];
console.time("Native concat");
const students2 = myClassmates.concat(mySenior);
console.timeEnd("Native concat");
console.time("Lodash concat");
@harithzainudin
harithzainudin / gdsc-sharing.txt
Last active June 19, 2022 10:55
Link for getting start into cloud
<<< ATTENTION >>>
THIS GIST WILL BE MIGRATED TO THE REPOSITOY LINK PROVIDED BELOW TO MAKE IT MORE MEANINGFUL
AND EASY TO NAVIGATE THROUGH THE RESOURCES AND THIS GIST WILL BE NO LONGER MAINTAINED STARTING FROM 19TH JUNE 2022
https://github.com/harithzainudin/absolutely-developer
------------------------
Awesome roadmaps of everything
https://github.com/liuchong/awesome-roadmaps#programming-language
@harithzainudin
harithzainudin / service-a-serverless.yml
Last active June 6, 2022 14:50
Define Amazon Cognito as authoriser for lambda function in serverless using shared API Gateway
service: service-a
frameworkVersion: "3"
provider:
name: aws
runtime: nodejs14.x
region: ap-southeast-1
stage: dev
environment:
API_GATEWAY_NAME: ${self:service}-${sls:stage}-apigw
API_GATEWAY_ROOT_RESOURCE_ID: ${self:service}-${sls:stage}-apigw-root-resource-id