Skip to content

Instantly share code, notes, and snippets.

View earth3300's full-sized avatar

Earth3300 earth3300

View GitHub Profile
@earth3300
earth3300 / SecureSessionHandler.php
Created January 10, 2021 00:46 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
<footer class="site site-footer">
<div class="inner">
<nav class="console"
style="display: table; margin: 0 auto; text-align: center;">
<div>
<a href="/" class="arrow previous" title="Previous Page">
<span class="icon icon-left">‹</span>
</a>
<a href="/#" class="arrow next" title="Next Page">
<span class="icon icon-right">›</span>
@earth3300
earth3300 / paragraph.css
Last active August 8, 2020 20:19
Paragraph styling to normalize text across websites. Font is Open Sans. Note the metric units in font-size and text-indent.
p {
max-width: 14.5cm !important;
font-size: 3mm !important;
text-indent: 4mm !important;
line-height: 1.5 !important;
text-align: justify !important;
margin: 0 !important;
}
@earth3300
earth3300 / .htaccess-dir-cached
Last active July 20, 2020 18:55
# Rewrite all requests to /foo
# Rewrite to the cached file if it exists and is not a post or attachment.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# RewriteCond %{REQUEST_METHOD} !=POST
# RewriteCond %{QUERY_STRING} !.*=.*
# RewriteCond %{DOCUMENT_ROOT}/$1/index.html -f
# RewriteRule ^(.*) /$1/index.html [L]
</IfModule>
@earth3300
earth3300 / printer.htac.php
Created March 11, 2020 15:52
Prints an htaccess file.
<?php
/**
* Htaccess Printer
*
* Prints an `.htaccess` file.
*
* @package Earth3300\EC01
* @since 1.0.1
* @author Clarence J. Bos <cbos@tnoep.ca>
* @copyright Copyright (c) 2018, Clarence J. Bos
@earth3300
earth3300 / get_paths.php
Last active March 6, 2020 19:01
Get the Paths Used in the Current Project
/**
* Get the Paths Used in the Current Project
*
* Uses options values if these are set. Modify on a per-project basis.
* Intended to be used to save and retrieve files, but can be used more
* generically as it sets and standardizes the document root and the relative
* path to the directory in which the containing file resides.
*
* Last updated: 2020-03-06
* No. of lines: 42
@earth3300
earth3300 / .htaccess-www-https-dir
Last active March 5, 2020 21:20
ROOT directory .htaccess script when ALL files are in sub-directory.
# ALWAYS rewrite to the specified directory (excluding the directory itself).
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/main/
RewriteRule ^(.*)$ /main/$1
</IfModule>
@earth3300
earth3300 / console.css
Last active February 15, 2020 02:04
Description: An absolutely positioned templated intended for HD monitors. Files: console.html, console.css
/**
* Console
*
* An absolutely positioned template intended for an HD monitor. Does NOT
* support mobile by design.
*
* @link https://gist.github.com/earth3300/2715962ab786f3781a6e0e9f1b993f07
* File: console.css
* Created: 2020-02-10
* Update: 2020-02-14
@earth3300
earth3300 / printer.htac.php.part
Last active January 23, 2020 15:37
A complete rewrite module (WordPress flavoured) that includes rewriting to caching, a login rewrite, etc.
/**
* Rewrite with Caching (Complex).
*
* A complete rewrite module (WordPress flavoured) that includes rewriting to
* caching, a login rewrite, etc.
*
* @return string
*/
private function getRewriteCachingComplex()
{
@earth3300
earth3300 / reader-view.css
Last active December 31, 2019 20:03
Reader View additional styling
body {
font: 12pt/1.66 serif, "Libre Baskerville" !important;
text-align: justify;
margin: 30px auto 0 96pt;
}
body[data-mode=light] {
color: #000;
}