Skip to content

Instantly share code, notes, and snippets.

View ImtiazEpu's full-sized avatar
🔐
I'm sudo root

Imtiaz Ahmed ImtiazEpu

🔐
I'm sudo root
View GitHub Profile
@ImtiazEpu
ImtiazEpu / deployment_guide.md
Created April 24, 2019 18:41 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel

Setting Up Laravel in Ubuntu / DigitalOcean

Getting Started

  • Create droplet with Ubuntu 18.10
  • ssh root@[DROPLET IP ADDRESS]
  • Get password from your email
  • Change password on first login
  • adduser laravel
  • Enter password and other information
//login method
public function processLogin()
{
$validator = Validator::make(request()->all(), [
'email' => 'required|email',
'password' => 'required',
]);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput();
}
@ImtiazEpu
ImtiazEpu / test.php
Created July 15, 2019 19:22
Problem solving
<?php
//Basis Knowledge Test:
//==========================
//1. Write a PHP function that to remove all zeroes from a string and return 3 different output.
//Input String : '000892021.2408000'
//Expected below outputs
//Output 1: '892021.2408' (all zeros remove from start and end)
//Output 2: '892021.2408000' (remove only start zero)
//Output 3: '000892021.2408' (remove only end zero)
@ImtiazEpu
ImtiazEpu / Old Codestar framework documentation.md
Last active August 18, 2022 09:41
Old Codestar framework documentation

Codestar Framework

A Lightweight and easy-to-use WordPress Options Framework. It is a free framework for building theme options. Save your time!

Screenshot

Codestar Framework Screenshot

Read the documentation for details documentation

Installation

public function processOrder()
{
$validator = Validator::make(request()->all(),[
'customer_name' => 'required',
'customer_phone_number' => 'required',
'address' => 'required',
'city' => 'required',
'postal_code' => 'required',
]);
if ($validator->fails()){
@ImtiazEpu
ImtiazEpu / add-wordpress-settings-page.php
Created September 24, 2019 06:47 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@ImtiazEpu
ImtiazEpu / repeatable-fields-metabox.php
Created October 14, 2019 11:29 — forked from helen/repeatable-fields-metabox.php
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {
@ImtiazEpu
ImtiazEpu / .gitignore
Created November 6, 2019 07:37
gitignore file for laravel, vue, phpstorm & vs code
# Created by https://www.gitignore.io/api/vue,laravel,phpstorm,visualstudiocode
# Edit at https://www.gitignore.io/?templates=vue,laravel,phpstorm,visualstudiocode
### Laravel ###
/vendor/
node_modules/
npm-debug.log
yarn-error.log
@ImtiazEpu
ImtiazEpu / .gitignore
Created November 6, 2019 07:41
.gitignore file for WordPress & PhpStorm
# Created by https://www.gitignore.io/api/phpstorm,wordpress
# Edit at https://www.gitignore.io/?templates=phpstorm,wordpress
### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
@ImtiazEpu
ImtiazEpu / human_readable_time.php
Last active June 7, 2020 15:38
human readable time fuction
/**
* Time to human readable time
*
* @param $ts
* @param string $fallback_format
*
* @return false|string
*/
public function time2str( $ts, $fallback_format = 'M j, Y H:i' ) {
if ( ! ctype_digit( $ts ) ) {