Skip to content

Instantly share code, notes, and snippets.

View earth3300's full-sized avatar

Earth3300 earth3300

  • 02:26 (UTC -04:00)
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;
@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
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@earth3300
earth3300 / color-conversion-algorithms.js
Created October 23, 2018 23:03 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@earth3300
earth3300 / jsonToTable.php
Created October 8, 2018 21:34 — forked from stilliard/jsonToTable.php
JSON to HTML table
<?php
/**
* JSON data to html table
*
* @param object $data
*
*/
function jsonToTable ($data)
{