Skip to content

Instantly share code, notes, and snippets.

View cmanish049's full-sized avatar
🏠
Working from home

Manish Chaudhary cmanish049

🏠
Working from home
View GitHub Profile
@cmanish049
cmanish049 / pint.yaml
Last active May 20, 2024 06:18
pint template
name: Fix Code Style
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
@cmanish049
cmanish049 / vhost-nginx.sh
Last active August 25, 2021 20:59
Create Virtual Host Shell Script
#!/usr/bin/env bash
#
# Nginx - new server block
read -p "Enter username : " username
read -p "Enter domain name : " domain
# Functions
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green
die() { echo -e '\e[1;31m'$domain'\e[m'; exit 1; }
@cmanish049
cmanish049 / Manish Aliases
Last active June 3, 2021 12:13
Alias List
alias add='git add .'
alias art='php artisan'
alias migrate='php artisan migrate'
alias serve='php artisan serve'
alias checkout='git checkout'
alias commit='git commit'
alias pull='git pull'
alias push='git push origin'
alias status='git status'
@cmanish049
cmanish049 / _ide_helper.php
Created July 31, 2020 10:44 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.5.13 on 2017-09-28.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
exit("This file should not be included, only analyzed by your IDE");
@cmanish049
cmanish049 / deployment_guide.md
Created May 29, 2020 13:05 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@cmanish049
cmanish049 / validate-domain.js
Created March 29, 2020 15:40
This simple snippet validates the email field to have email of specific domain
jQuery.validator.addMethod("domain_email", function(value, element, param) {
if (/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(value)) {
if (value.indexOf(param, value.length - param.length) !== -1) {
return true;
} else {
return false;
}
} else {
return false;
}
<?php
$numericArray = [1,2,3];
SELECT id
FROM `user`
ORDER BY id DESC
LIMIT 1
OFFSET 1 ;
@cmanish049
cmanish049 / days-in-a-month.php
Created January 22, 2019 11:32
This function returns number of days in a month
<?php
function daysInMonth($month)
{
$days = 0;
switch ($month) {
case 1:
$days = 31;
break;
@cmanish049
cmanish049 / initials.php
Created January 17, 2019 11:19
Initials
<?php
class Initials
{
/**
* Generate initials from a name
* @param string name
* @return string
*/