Skip to content

Instantly share code, notes, and snippets.

View edgarjaviertec's full-sized avatar
🏠
Working from home

Edgar Tec edgarjaviertec

🏠
Working from home
View GitHub Profile
@bladeSk
bladeSk / laravel-on-shared-hosting-htaccess.md
Last active November 10, 2025 02:25
Deploying Laravel on a shared hosting using only .htaccess

Deploying Laravel on a shared hosting using only .htaccess

Making Laravel work on a shared hosting can be troublesome, because Laravel needs to have its document root set to the public directory. This may not be configurable by a user or even desirable, when the server is hosting multiple websites.

Here's a simple method using only a .htaccess file placed in Laravel's root directory - e.g. alongside app, bootstrap, config, ... No changes whatsoever are necessary to your code.

The file rewrites all the requests so that requesting /file.png would in fact return /public/file.png and anything else is routed to /public/index.php. This also ensures that nothing outside the public folder can be accessed, thereby protecting any sensitive files like .env or database/*.

The simple method

#!/bin/bash
cd /var/www/html
NOW=$(date +%Y%m%d)
SQL_FILE=${NOW}_database.sql
# Backup database
wp db export ../backups/$SQL_FILE --add-drop-table
@pedroparra
pedroparra / store-example.js
Last active February 12, 2019 07:58
Ejemplo de store con redux.
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux';
// Preparamos nuestra funcion reducer
const myReducer = (state = 0, action) => {
switch(action.type) {
case 'sumar':
return state + 1;
case 'restar':
@tonymtz
tonymtz / uninstall_homebrew.sh
Created November 15, 2014 00:03
Uninstall Homebrew from OSX Yosemite
#!/bin/sh
function abort {
echo "$1"
exit 1
}
set -e
/usr/bin/which -s git || abort "brew install git first!"
@tim-reynolds
tim-reynolds / jquery.centerit.js
Created June 29, 2012 18:16
Setting scroll to center on an element (jQuery) - Super simple stuff
/*
If you have a horizontal (or vertical) scroll container and want to set the scroll to center a specific
element in the container you can use the following super simple technique.
I'm going to show you how it was derived, because it's important to know why, not just how.
*/
/*
Setup:
[HTML]
<div class="outer">