Skip to content

Instantly share code, notes, and snippets.

Matúš Koprda bladeSk

Block or report user

Report or block bladeSk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bladeSk
bladeSk / laravel-on-shared-hosting-htaccess.md
Last active Jun 14, 2019
Deploying Laravel on a shared hosting using only .htaccess
View laravel-on-shared-hosting-htaccess.md

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
bladeSk / SQLite-PHP-quickstart.php
Last active May 23, 2019
SQLite3 PHP Quickstart Tutorial
View SQLite-PHP-quickstart.php
<?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);
@bladeSk
bladeSk / mouse cursor follows focus.ahk
Last active Jan 18, 2019
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
bladeSk / index.html
Last active Aug 1, 2016
Basic WebGL example
View index.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>basic webgl example</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>
You can’t perform that action at this time.