Skip to content

Instantly share code, notes, and snippets.

View zainzafar90's full-sized avatar
:octocat:

Zain Zafar zainzafar90

:octocat:
View GitHub Profile

📝 Summary

This pull request introduces a new shared UI library designed to consolidate UI components and styles for increased reusability across our Dashboard and Interview applications. The focus is on improving maintainability and ensuring consistent design standards throughout our projects.

✨ Added

- Integrated `UnifiedUI` library for managing common UI components such as buttons, cards, and modals.
- Added `GestureControl` module to handle touch and swipe interactions globally.

🌀 Changed

@zainzafar90
zainzafar90 / store.ts
Created September 6, 2023 09:25
Store to manage Meelio state
import { create } from "zustand";
import { soundCategories } from "@/config/category-data";
import { allSounds } from "@/config/sounds-data";
import { Category } from "@/types/category";
import { Combo } from "@/types/combo";
import { PomodoroStage, PomodoroTimer } from "@/types/pomodoro";
import { Sound, SoundState } from "@/types/sound";
import { MINUTE_IN_SECONDS } from "@/utils/common.utils";
import { getNextStage, getSessionCount } from "@/utils/timer.utils";
@zainzafar90
zainzafar90 / package.json
Created October 6, 2022 21:29
A package.json file for turborepo like gradient
{
"name": "cli-gradient",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"type": "module",
"scripts": {
"start": "node index.js"
},
"dependencies": {
@zainzafar90
zainzafar90 / index.js
Created October 6, 2022 21:27
Generating a gradient text like turborepo using node-cli
import chalk from "chalk";
import gradient from "gradient-string";
const startColor = "#0099F7";
const endColor = "#F11712";
const turborepoGradient = gradient(startColor, endColor);
console.log(chalk.bold(turborepoGradient(`\n>>> TURBOREPO\n`)));
@zainzafar90
zainzafar90 / json-stringify-equality.js
Created October 13, 2019 14:14
Why you shouldn't be using JSON.Stringify for comparing objects?
// Same order
JSON.stringify({ deg: 'MS', a: 10 }) === JSON.stringify({ deg: 'MS', a: 10 }) // true
// Different order
JSON.stringify({ a: 10, deg: 'MS' }) === JSON.stringify({ deb: 'MS', a: 10 }) // false
@zainzafar90
zainzafar90 / git_create_orphan.sh
Created March 10, 2019 17:16 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@zainzafar90
zainzafar90 / tsconfig.json
Last active February 10, 2019 06:53
Simplyfying Typescript imports with tsconfig.json
{
"compilerOptions": {
...
// Configuration removed for brevity
...
"paths": {
"@controls/radio": [ "src/app/shared/components/forms/radio-control/radio-control.component" ],
"@environment/*": [ "src/environments/*" ],
}
}
ngOnInit() {
this.myForm = this.formBuilder.group({
email: ['', [Validators.required, Validators.email]],
password: [
'',
[Validators.required, Validators.minLength(6), Validators.maxlength(20)]
],
phoneNumber: ['', [Validators.required, validatePhoneNumber]]
});
}
import { AbstractControl } from '@angular/forms';
// setup simple regex to check for phone number format.
const phoneNumRegex = /[^-?(\d{3})(\-\d{3})(\-\d{4})]/;
export function validatePhoneNumber(control: AbstractControl) {
if (control.value.match(phoneNumRegex)) {
return { validNum: true };
}
return null;
}
export class AppComponent implements OnInit {
myForm: FormGroup;
submitted = false;
constructor(private formBuilder: FormBuilder) {}
ngOnInit() {
this.myForm = this.formBuilder.group({
email: ['', [Validators.required, Validators.email]],
password: [
'',
[Validators.required, Validators.minLength(6), Validators.maxlength(20)]