Skip to content

Instantly share code, notes, and snippets.

View ilearnbydoing's full-sized avatar

Durgesh Gupta ilearnbydoing

View GitHub Profile
{{root}}
{{nginx_access_log}}
{{nginx_error_log}}
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
location ~ /.well-known {
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
@ilearnbydoing
ilearnbydoing / Laravel on VestaCP.md
Created November 30, 2021 14:13 — forked from peterbrinck/Laravel on VestaCP.md
Laravel web templates for VestaCP

I'm not using this or VestaCP anymore, so I can't confirm if still working or not.

I've made a new web template to make Laravel work easily on VestaCP, and so I wouldn't have to change my Laravel installation, if I ever wanted to deploy it elsewhere.

Each file should be put in /usr/local/vesta/data/templates/web/apache2

Then, when you edit your domain/site, you can change the web template to Laravel and just upload your whole project into public_html

@ilearnbydoing
ilearnbydoing / AppServiceProvider.php
Created September 16, 2021 10:21 — forked from wmandai/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
});
@ilearnbydoing
ilearnbydoing / Coffee.js
Created April 27, 2021 01:17 — forked from agneym/Coffee.js
Buy me a Coffee with React and Styled Components
import React from 'react';
import styled from 'styled-components';
const Button = styled.a`
line-height: 2;
height: 5rem;
text-decoration: none;
display:inline-flex;
color: #FFFFFF;
background-color: #FF813F;
@ilearnbydoing
ilearnbydoing / gist:e7329828de0bae92314173377402161e
Created December 5, 2020 09:25 — forked from lineharo/gist:be84e6a9309c035ec79c4219adc36966
Install VestaCP(nginx+apache, vsftpd, exim+devocot, DNS named, MySQL) + PHP-7.4 on Ubuntu 18.04 LTS
sudo apt-get update
sudo apt-get install -y vim git curl wget unzip zip gcc build-essential make
sudo apt-get install software-properties-common
curl -O http://vestacp.com/pub/vst-install.sh
bash vst-install.sh --nginx yes --apache yes --phpfpm no --named yes --remi yes --vsftpd yes --proftpd no --iptables yes --fail2ban yes --quota no --exim yes --dovecot yes --spamassassin no --clamav no --softaculous no --mysql yes --postgresql no
@ilearnbydoing
ilearnbydoing / Taxonomy.php
Created July 27, 2020 17:50 — forked from fourstacks/ Taxonomy.php
Pulling in Yoast SEO meta for terms using Corcel
<?php
// This model simply inherits from the base Corcel Taxonomy model.
// It allows us to set our DB connection and also implement the
// ImportsTermSeo trait (see next file)
namespace App\Models\Corcel;
use App\Wordpress\ImportsTermSeo;
@ilearnbydoing
ilearnbydoing / send_json_post_auth_with_guzzle.php
Created May 26, 2020 10:48 — forked from roberto-butti/send_json_post_auth_with_guzzle.php
Send a JSON in a POST, with HTTP Basic Auth (Guzzle Version)
<?php
$endpoint_url="your_url_here";
$string_json = "your_json_string";
$username="username";
$password ="password";
$client = new Client();
$options= array(
'auth' => [
$username,
@ilearnbydoing
ilearnbydoing / index.js
Created May 17, 2020 10:20 — forked from MustansirZia/index.js
Reverse Geocode JS [ES7] Gist - Latitude/Longitude to local address.
/**
* Created by M on 15/04/17. With ❤
*/
/*
* Reverse Geocode JS [ES7] Gist. Converts latitude/longitude to a human readable address.
* Firstly, tries to judge whether the lat/long is over a road. If so, returns the local street address
* with state and country stripped out.
* If not, returns the local address for the nearest point of interest. (or place). The second condition works even if
* the lat/long belongs to a disputed territory such as Kashmir, India.
@ilearnbydoing
ilearnbydoing / Install-Mcrypt.md
Created November 18, 2019 11:51 — forked from idleberg/Install-Mcrypt.md
Install Mcrypt on macOS

Setup php-mcrypt on macOS (and versions of Mac OS X)

These steps should have been mentioned in the prerequisites of the Laravel Installation Guide, since I'm surely not the only person trying to get Laravel running on macOS.

Install

Install Mcrypt using Homebrew and PECL (comes with PHP)

# PHP 7.3