Skip to content

Instantly share code, notes, and snippets.

View Aleksandar-Mitic's full-sized avatar
🏠
Working from home

Aleksandar Mitic Aleksandar-Mitic

🏠
Working from home
View GitHub Profile
@Aleksandar-Mitic
Aleksandar-Mitic / wp-custom-api-logout-user-endpoint.txt
Last active June 11, 2024 11:43 — forked from justingreerbbi/gist:768f1effcca69b4098c9d0f7731deba0
Logout user using WP REST API WordPress Custom Endpoint
add_action( 'rest_api_init', function () {
register_rest_route( 'customauthmethods/v1', '/logout/', array(
'methods' => 'GET',
'callback' => 'custom_logout_user_via_api'
) );
} );
function custom_logout_user_via_api() {
wp_logout();
@Aleksandar-Mitic
Aleksandar-Mitic / expose.php
Created September 17, 2022 09:07 — forked from slaFFik/expose.php
Fix Expose by BeyondCode issues when working with the local WordPress site
<?php
// phpcs:ignoreFile
define( 'EXPOSED_DOMAIN', 'example.sharedwithexpose.com' );
// Load only if we are running under Expose.
if ( empty( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) || $_SERVER['HTTP_X_ORIGINAL_HOST'] !== EXPOSED_DOMAIN ) {
return;
}
@Aleksandar-Mitic
Aleksandar-Mitic / my.cnf
Created February 10, 2021 12:35 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated January 2020 ~
#
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@Aleksandar-Mitic
Aleksandar-Mitic / laravel-permission.sh
Created November 5, 2020 08:14 — forked from aindong/laravel-permission.sh
normalize laravel permission for security and fixing logging issues of permission denied
#!/bin/bash
## create user group
sudo groupadd laravel
## add current user to group
sudo usermod -a -G www-data $USER
## add web server to group
sudo usermod -a -G www-data laravel
@Aleksandar-Mitic
Aleksandar-Mitic / laravel_horizon.md
Created October 19, 2020 06:23 — forked from ankurk91/laravel_horizon.md
Laravel Horizon, redis-server, supervisord on Ubuntu server

Laravel Horizon, redis-server, supervisord on Ubuntu 18/20 server

Laravel 7.x, Horizon 4.x, Redis 6.x

Parepare application

  • Install and configure Laravel Horizon as instructed in docs
  • Make sure you can access the Horizon dashboard like - http://yourapp.com/horizon
  • For now it should show status as inactive on dashbaord

Install redis-server

@Aleksandar-Mitic
Aleksandar-Mitic / deploy.sh
Created June 19, 2020 07:57 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd /home/forge/domain.com
# Turn on maintenance mode
php artisan down
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin master
@Aleksandar-Mitic
Aleksandar-Mitic / bashinit.bash
Created May 13, 2020 10:27
POPos Install Script
## This Script is My Personal Quick Install for Ubuntu/Mint based systems for Dev Purposes
##
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install *snapd*
sudo apt-get install *flatpak*
sudo apt-get update
sudo apt-get upgrade
@Aleksandar-Mitic
Aleksandar-Mitic / RegistrationController.php
Created February 25, 2020 09:40 — forked from oranges13/RegistrationController.php
Populate external drop downs for datatable filtering
/**
* Process datatables ajax request.
*
* @return \Illuminate\Http\JsonResponse
*/
public function allData(Request $request)
{
$registrations = Registration::with('product')->with('reg_type')->select('registrations.*');
$datatable = Datatables::of($registrations);
@Aleksandar-Mitic
Aleksandar-Mitic / deployment_guide.md
Created November 20, 2019 13:19 — forked from vicgonvt/deployment_guide.md
Deployment Guide for Ubuntu Server from Scratch with Laravel
@Aleksandar-Mitic
Aleksandar-Mitic / ubuntu-lamp.md
Created March 12, 2019 20:45 — forked from kbond/post.md
Ubuntu LAMP Development Environment Setup

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Your Name"

git config --global user.email "Your Email"