Skip to content

Instantly share code, notes, and snippets.

@josevh
josevh / flight_remove_trailing_slashes.php
Last active April 23, 2022 15:00
Remove trailing slashes in FlightPHP url's
<?php
// before any other route
Flight::route('*', function () {
$request = Flight::request();
if ($request->url != '') {
list($base, $query) = array_pad(explode('?', $request->url, 2), 2, null);
if (substr($base, -1) == '/' && strlen($base) > 1) {
$url = rtrim($base, '/');
if ($query !== null) {
$url .= '?' . $query;
@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@joostvanveen
joostvanveen / .htaccess
Last active September 10, 2023 02:37
.htaccess Security
######################################################################
## Word to the wise ##
## It is best to keep your htaccess files as clean as possible ##
## and set as many specs in your Apache config as you can. ##
## Htaccess slows down Apache. ##
## Review the entire file before use, especially the TODO sections. ##
######################################################################
Options -MultiViews
Options +FollowSymLinks
@tonymorris
tonymorris / waypoint-symbols-62s.md
Last active February 14, 2018 21:25
Waypoint symbols available for a Garmin 62s. Appears in a <sym> tag in gpx file.

Waypoint symbols on a Garmin 62s with Software Version 4.80

Markers

  1. Flag, Blue
  2. Flag, Green
  3. Flag, Red
  4. Civil
  5. Pin, Blue
  6. Pin, Green
  7. Pin, Red