Skip to content

Instantly share code, notes, and snippets.

View earth3300's full-sized avatar

Earth3300 earth3300

View GitHub Profile
@earth3300
earth3300 / printer.css-gen-dat.php
Last active September 18, 2019 21:03
Prints a CSS data array with blank attributes to a PHP file.
<?php
/**
* EC01 CSS Generator Printer (from Data)
*
* Generates CSS data arrays and saves to file(s).
*
* @package Earth3300\EC01
* @since 1.0.1
* @author Clarence J. Bos <cbos@tnoep.ca>
* @copyright Copyright (c) 2018, Clarence J. Bos
@earth3300
earth3300 / printer.css-json-php.php
Last active September 18, 2019 21:05
Converts a JSON string into a PHP array within a function.
<?php
/**
* EC01 JSON to PHP (Array) Printer
*
* @package Earth3300\EC01
* @since 1.0.1
* @author Clarence J. Bos <cbos@tnoep.ca>
* @copyright Copyright (c) 2018, Clarence J. Bos
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL v3.0
* @link https://gist.github.com/earth3300/665ac34b0f784f9c659cf89c66ebbeee/
@earth3300
earth3300 / data.php
Last active September 17, 2019 21:04
CSS style data in a PHP array.
<?php
/**
* EC01 CSS Data (Earth3300\EC01)
*
* Structural Configuration
*
* File: data.php
* Created: 2019-09-07
* Updated: 2019-09-16
* Time: 03:34 EDT
@earth3300
earth3300 / data.php
Last active February 5, 2020 19:22
Semi Intelligent Document Creation (IQ: ~50)
<?php
/**
* EC01 Data (Earth3300\EC01)
*
* Data and configuration information for the other files.
*
* File: data.php
* Created: 2019-09-05
* Updated: 2019-24
* Time: 06:56 EDT
@earth3300
earth3300 / cfig.printer.php
Last active September 3, 2019 14:12
Prints a set of configuration files. WordPress flavoured.
<?php
/**
* Config Printer Class
*
* Prints a configuration file.
*
* File: printer.cfig.php
* Created: 2019-03-14
* Updated: 2019-09-03
* Time: 10:10 EDT
@earth3300
earth3300 / header.php
Created June 20, 2019 22:35
A header template with wp_head() as optional. Included constants are required (see wp-config.tmpl.php).
<?php
/** Set the header and start building the page. */
header('Content-type: text/html; charset=utf-8;');
/** The `DOCTYPE` is `html` (HTML5) */
$str = '<!DOCTYPE html>' . PHP_EOL;
/** Default Language is `en` or `en-CA`. The class is added as a complete string (i.e. 'class="..." ) */
$str .= sprintf('<html lang="%s">%s', SITE_LANG, PHP_EOL);
@earth3300
earth3300 / site-uploads-dir-filter.php
Last active June 15, 2019 20:24
Filters the WordPress uploads directory array to a non-standard location.
if ( ! function_exists( 'site_uploads_dir_filter' ) )
{
/**
* Site Uploads Directory Filter
*
* Filters the directory array to a non-standard location.
*
* @link https://gist.github.com/earth3300/cee9a803e5cee0b04f216d53ae9aef1f
*
* @return array
@earth3300
earth3300 / login.min.css
Last active June 18, 2019 21:42
A Login Script to Use as a First Layer of Defence for a Standard Login Form (PHP)
[hidden]{display:none}html{font-size:100%;line-height:150%}button,html,input{font-family:sans-serif}body{margin:0}strong{font-weight:700}p{margin:1em 0}form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal}button,input{font-size:100%;margin:0;vertical-align:baseline}button,input{line-height:normal}button{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}[hidden]{display:none!important}.pure-button{display:inline-block;zoom
@earth3300
earth3300 / odf2html.sh
Created June 5, 2019 23:18 — forked from kkappel/odf2html.sh
export all LibreOffice or MS-Word files to html, uses OpenOffice or Libre Office and tidy
#!/bin/bash
# odf2html.sh - export all odt od doc files to html by shellscript
# Inspired by Marco Fioretti,
# who wrote this Article in 2012: http://www.techrepublic.com/blog/linux-and-open-source/how-to-convert-doc-and-odf-files-to-clean-and-lean-html/
# Klaus Kappel
CONFIG=tidy.conf
# first clean the dir, if script runs in cron job
# rm -rf $2
@earth3300
earth3300 / class-template.php
Last active May 31, 2019 12:17
A generic class template using authorization layers before running.
<?php
/**
* A generic class template using authorization layers before running.
*
* File: article.php
* Created: 2019-05-31
* Updated: 2019-05-31
* Time: 07:54 EDT
*/