Skip to content

Instantly share code, notes, and snippets.

View stephenjude's full-sized avatar
😎
Software Developer

Stephen Jude stephenjude

😎
Software Developer
View GitHub Profile
#redirect setup for laravel project on primary domain on a shared server
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?prep50mobileapp.com.ng$
RewriteCond %{REQUEST_URI} !^/blog/public/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/public/$1
RewriteCond %{HTTP_HOST} ^(www.)?prep50mobileapp.com.ng$
RewriteRule ^(/)?$ blog/public/index.php [L]
@stephenjude
stephenjude / .htaccess
Last active September 4, 2020 05:47
htaccess configuration for shared hosted laravel application
RewriteEngine On
RewriteCond %{HTTP_HOST} YOURDOMAINNAME\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://YOURDOMAINNAME.com/$1 [R,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.YOURDOMAINNAME\.com$
RewriteRule ^/?$ "http\:\/\/ww\.YOURDOMAINNAME\.com\/" [R=302,L]
@stephenjude
stephenjude / laravel-phpstorm.md
Created August 18, 2020 09:29 — forked from kiklop74/laravel-phpstorm.md
Setup laravel and PHPstorm
@stephenjude
stephenjude / vs-code-snippets.json
Created August 17, 2020 07:48 — forked from weppami/vs-code-snippets.json
vsCode snippets for PHP & Laravel
// user/snippets/php.json
"fil": {
"prefix": "fil",
"body": "\r\n/**\r\n * @var array\r\n */\r\nprotected $fillable = ['${1:FIELD}'];\r\n\r\n",
"description": "Fillable",
"scope": ""
},
"gua": {
"prefix": "gua",
@stephenjude
stephenjude / RolesAndPermission.php
Last active February 24, 2020 20:07
Simple implementation of Spatie Permission Role package
<?php
namespace App\Traits;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
trait TenantRolesAndPermissions
{
protected $see_email_students = 'see email students';
@stephenjude
stephenjude / cloudSettings
Last active December 15, 2021 10:08
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-12-15T10:08:42.029Z","extensionVersion":"v3.4.3"}
@stephenjude
stephenjude / namecheap SSL.md
Created October 7, 2018 20:56 — forked from Shourai/namecheap SSL.md
Letsencrypt SSL certificate with namecheap hosting

source: https://savedlog.com/uncategorized/letsencrypt-ssl-certificate-namecheap-hosting/

The “Positive SSL” certificate I bought along with my domain is invalid with any of my subdomains and cannot be used with wildcards. One annoying thing is that namecheap doesn’t offer auto installation of free let’s encrypt certificates, even though, they are saying “Namecheap is dedicated to data security and privacy for all internet users. We believe the movement to encrypt nearly all web traffic is a positive direction. As more sites embrace HTTPS and use of security products, providers of free SSL are beginning to come online.”

Let me show you what it needs to be done in order to “encrypt nearly all web traffic”.

First, not required but it’s helpful to enable ssh access, it is not enabled by default on the base hosting plans, just go an start a live chat and request ssh access.

<?php
namespace App\Transformers;
use App\Product;
use League\Fractal;
class ProductTransformer extends Fractal\TransformerAbstract
{
public function transform(Product $product)
{
<?php
namespace App\Http\Controllers;
use App\Product;
use Illuminate\Http\Request;
use League\Fractal;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use League\Fractal\Resource\Collection;
<?php
$app->get('/', function () use ($app) {
return $app->version();
});
//product routes
$app->get('products', 'ProductsController@index');
$app->get('products/{id}', 'ProductsController@show');
$app->put('products/{id}', 'ProductsController@update');