Skip to content

Instantly share code, notes, and snippets.

View kamerk22's full-sized avatar
🔄
Lazy Loading

Kashyap Merai kamerk22

🔄
Lazy Loading
View GitHub Profile
@kamerk22
kamerk22 / pm2_deploy.sh
Last active July 4, 2017 05:56
Automatic pm2 deploy bash script run on production server as well as development server.
#!/bin/bash
#Author: Kashyap Merai | kashyapk62@gmail.com
# Variables
ch_1="pm2 Production Setup."
ch_2="pm2 Production Update."
ch_3="pm2 Production."
ch_4="pm2 Development Setup."
ch_5="pm2 Development."
@kamerk22
kamerk22 / default.conf
Created June 25, 2017 06:15
Nginx Configuration running PHP7.0-FPM Fast CGI with phpmyadmin and MySQL, Reverse proxy with NodeJS application
server {
listen 80 default_server;
server_name dev ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location ~ \.php$ {
@kamerk22
kamerk22 / lumen.conf
Last active August 21, 2018 17:49
Laravel or Lumen application inside sub directory nginx configuration with routing.
server {
listen 80;
server_name dev ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location ~ \.php$ {
@kamerk22
kamerk22 / ecosystem.json
Last active July 26, 2017 18:55
Process FIle pm2
{
"apps" : {
"name" : "vuejs",
"script" : "./server.js",
"watch" : true,
"instances" : 4,
"exec_mode" : "cluster",
"env": {
"COMMON_VARIABLE": "true"
},
@kamerk22
kamerk22 / deployment.json
Created July 26, 2017 18:55
pm2 deployment
"deploy": {
"production": {
"user": "server-user",
"host": "server-ip",
"repo": "git@github.com/vuejspm2.git",
"ref": "origin/master",
"path": "/var/www/production",
"post-deploy": "npm install && npm run build && pm2 startOrRestart ecosystem.json --env production"
},
"development": {
@kamerk22
kamerk22 / default.conf
Created July 26, 2017 20:21
Nginx Reverse Proxy
server {
listen 80 default_server;
server_name dev ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
location /mynodeapp {
@kamerk22
kamerk22 / validate.php
Last active August 25, 2017 11:17
Validation for Singapore NRIC and FIN number in PHP
public static function validIdentification($number)
{
if (strlen($number) !== 9) {
return false;
}
$newNumber = strtoupper($number);
$icArray = [];
for ($i = 0; $i < 9; $i++) {
$icArray[$i] = $newNumber{$i};
<?php
namespace App\Http\Controllers\API\v1\Users;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Entities\Models\User;
class UserController extends Controller
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UserStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
<?php
namespace App\Http\Controllers\API\v1\Users;
use App\Http\Controllers\Controller;
use App\Http\Requests\UserStoreRequest;
class UserController extends Controller
{
public function store(UserStoreRequest $request)