Skip to content

Instantly share code, notes, and snippets.

View meSingh's full-sized avatar
Making products..

Mandeep Singh meSingh

Making products..
View GitHub Profile
meSingh /
Created June 17, 2018 17:50 — forked from BenSampo/
Laravel deploy script
# Change to the project directory
cd /home/forge/
# Turn on maintenance mode
php artisan down
# Pull the latest changes from the git repository
git pull origin master
# Install/update composer dependecies
meSingh / JsonMiddleware.php
Last active July 11, 2022 09:19
If you are using laravel as api only, you might want to return JSON on every request, even on errors/exceptions. The easiest way to do so is using this middleware globally.
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class JsonMiddleware
public function handle(Request $request, Closure $next)
meSingh /
Last active September 29, 2016 23:23
How To Install Elasticsearch on an Ubuntu VPS

Install Java 8

Elasticsearch require Java, so we will install that now. We will install a recent version of Oracle Java 8 because that is what Elasticsearch recommends. It should, however, work fine with OpenJDK, if you decide to go that route.

Add the Oracle Java PPA to apt:

    * sudo add-apt-repository -y ppa:webupd8team/java

Update your apt package database:

meSingh /
Last active March 16, 2018 21:57 — forked from insane-dev/
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MongoDB, Git, Composer(with asset plugin))
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process."
if [ -z "$USERNAME" ] ; then
echo "Exiting... Done."
echo "Adding user to 'sudo' group..."
meSingh /
Created June 13, 2016 20:35
MongoDB Setup on Ubuntu 14.04 with PHP7
# MongoDB Setup on Ubuntu 14.04 with PHP7
# Source:
#1. Import the public key used by the package management system:
sudo apt-key adv --keyserver hkp:// --recv EA312927
#2. Create a list file for MongoDB.
echo "deb trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
meSingh / 01_Laravel 5 Simple ACL
Created June 10, 2016 07:38 — forked from amochohan/01_Laravel 5 Simple ACL
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.


Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

meSingh /
Created March 15, 2016 14:22 — forked from iros/
Documenting your REST API


<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

server {
listen 80;
listen [::]:80;
root /home/forge/;
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
meSingh / gist:817f4d85f2094bd7d89b
Last active August 29, 2015 14:25 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
meSingh / routes.php
Created May 26, 2015 13:43
Lumen Resource Routes
| Application Routes
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.