Skip to content

Instantly share code, notes, and snippets.

View irfanbaigse's full-sized avatar
:bowtie:
PHP - Node.js - JAVA - AWS - Flutter - MT5/MT4

Irfan Baig irfanbaigse

:bowtie:
PHP - Node.js - JAVA - AWS - Flutter - MT5/MT4
View GitHub Profile
@irfanbaigse
irfanbaigse / HealthCheckController.java
Created January 23, 2024 11:28
Spring Boot Health Check Api Controller
package com.example.irfan.rest;
import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@irfanbaigse
irfanbaigse / mvnw-fix.sh
Created January 2, 2024 11:04 — forked from kbastani/mvnw-fix.sh
Adds a settings.xml file to your Spring Boot maven wrapper
#!/usr/bin/env bash
# Secure workaround for https://issues.sonatype.org/browse/MVNCENTRAL-1369
# Navigate to the root of your Spring Boot project where a Maven wrapper is present and run this script
cd .mvn/wrapper
wget https://gist.githubusercontent.com/kbastani/d4b4c92969ec5a22681bb3daa4a80343/raw/f166086ef051369383b02dfb74317cd07b6f2c6e/settings.xml
cd ../../
./mvnw clean install -s .mvn/wrapper/settings.xml
@irfanbaigse
irfanbaigse / udemy.js
Created December 13, 2023 12:47
Udemy exapnd all and mark as complete
## Expand
const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (!checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });
## Mark as Complete
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(!checkbox.checked) {
checkbox.click();}})
# Find add 'node_modules'
find . -name "node_modules" -type d -prune -print | xargs du -chs
# Delete all
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
@irfanbaigse
irfanbaigse / prepare-commit-msg
Created November 28, 2022 12:59
add branch name to the commit message -- go to .git/hooks/prepare-commit-msg and replace the file
#!/bin/bash
#
# Automatically adds branch name and branch description to every commit message.
# Modified from the gist here https://gist.github.com/bartoszmajsak/1396344
#
# This way you can customize which branches should be skipped when
# prepending commit message.
RED="\033[1;31m"
GREEN="\033[1;32m"
@irfanbaigse
irfanbaigse / mongo-local-apple-silicon.sh
Last active August 10, 2023 22:01
Small mongodb image for local use
#https://github.com/Ortanon/mongo
docker pull karimtemple/mongo
mkdir db && sudo chmod 777 db
docker run --platform linux/amd64 --name mongodb --rm -d -p 27017:27017 --user 202:202 -v $(pwd)/db:/data/db karimtemple/mongo
@irfanbaigse
irfanbaigse / time-overlap-mongodb-query.js
Created July 7, 2021 08:24
Mongodb query to find records overlapping between time
db.getCollection("your_collection").find(
{
"start_time": { "$lte": 900 }, // time stored as int
"end_time": { "$gte": 479 }
},
{
"start_time": 1, "end_time": 1 // projection
}
)
// credits https://stackoverflow.com/questions/26876803/mongodb-find-date-range-if-overlap-with-other-dates/26877645
@irfanbaigse
irfanbaigse / hijri-date-sample.js
Created October 24, 2019 12:40
convert Gregorian to Hijri date in javascript
import { gregorianToJulian, julianToHijri } from './hijri-util-date.js';
/**
* Gregorian to Hijri
* * First convert to Julian
* * then convert to hijri
*/
const futureDate = dayjs('2019-10-24').add(1, 'year');
// .format('YYYY-MM-DD');
const y = futureDate.year();
const d = futureDate.day();
@irfanbaigse
irfanbaigse / size-config-flutter.dart
Created January 22, 2020 13:43
flutter Effectively scale UI according to different screen sizes
import 'package:flutter/widgets.dart';
// from below link
// https://github.com/dancamdev/effectively_scale_UI_according_to_different_screen_sizes/blob/master/lib/SizeConfig.dart
class SizeConfig {
static MediaQueryData _mediaQueryData;
static double screenWidth;
static double screenHeight;
static double blockSizeHorizontal;
static double blockSizeVertical;
@irfanbaigse
irfanbaigse / ext-xdebug.ini
Created January 13, 2022 06:35
php xdebug config for phpstorm mac
# subl /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini
[xdebug]
xdebug.mode = debug
xdebug.max_nesting_level = 1000
xdebug.start_with_request=yes
xdebug.client_port=9090
xdebug.client_host=127.0.0.1
xdebug.discover_client_host=1
xdebug.idekey=PHPSTORM