Skip to content

Instantly share code, notes, and snippets.

Avatar

Earth3300 earth3300

View GitHub Profile
@earth3300
earth3300 / SecureSessionHandler.php
Created Jan 10, 2021 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
View SecureSessionHandler.php
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
View navigation-console.html
<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 Aug 8, 2020
Paragraph styling to normalize text across websites. Font is Open Sans. Note the metric units in font-size and text-indent.
View paragraph.css
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 Jul 20, 2020
# Rewrite all requests to /foo
View .htaccess-dir-cached
# 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 Mar 11, 2020
Prints an htaccess file.
View printer.htac.php
<?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 Mar 6, 2020
Get the Paths Used in the Current Project
View get_paths.php
/**
* 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 Mar 5, 2020
ROOT directory .htaccess script when ALL files are in sub-directory.
View .htaccess-www-https-dir
# 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 Feb 15, 2020
Description: An absolutely positioned templated intended for HD monitors. Files: console.html, console.css
View 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 Jan 23, 2020
A complete rewrite module (WordPress flavoured) that includes rewriting to caching, a login rewrite, etc.
View printer.htac.php.part
/**
* 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 Dec 31, 2019
Reader View additional styling
View reader-view.css
body {
font: 12pt/1.66 serif, "Libre Baskerville" !important;
text-align: justify;
margin: 30px auto 0 96pt;
}
body[data-mode=light] {
color: #000;
}