Skip to content

Instantly share code, notes, and snippets.

bladeSk /
Last active Jun 1, 2022
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

bladeSk / SQLite-PHP-quickstart.php
Last active Jul 12, 2022
SQLite3 PHP Quickstart Tutorial
View SQLite-PHP-quickstart.php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
bladeSk / mouse cursor follows focus.ahk
Last active Apr 5, 2022
AutoHotKey: Make mouse cursor follow window focus
View mouse cursor follows focus.ahk
; Makes the mouse cursor follow window focus, but ONLY if the focus change
; wasn't caused by the mouse - e.g. Alt-Tab, Win+<Number>, hotkeys, ...
; Saves a lot of mousing around on multi-monitor setups!
Gui +LastFound
lastMouseClickTime := 0
hWnd := WinExist()
DllCall("RegisterShellHookWindow", UInt, hWnd)
bladeSk / index.html
Last active Aug 1, 2016
Basic WebGL example
View index.html
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>basic webgl example</title>
body { margin: 0; }
canvas { display: block; }