Skip to content

Instantly share code, notes, and snippets.

View gaffling's full-sized avatar
🕚
I don't have time to hurry!

Igor Gaffling gaffling

🕚
I don't have time to hurry!
View GitHub Profile
@gaffling
gaffling / save_mail_attachments.php
Last active March 4, 2021 12:06
[SAVE MAIL ATTACHMENTS/InlineImages] #php #class #function #attachments
<?php
/* ----------------------------------------------------------------------- */
/* [SAVE MAIL ATTACHMENTS/InlineImages] #php #class #function #attachments */
/* ----------------------------------------------------------------------- */
/**
* INSPIRED BY
* @see http://cantstopgeeking.blogspot.com/2018/12/php-email-message-class-for-extracting.html
@gaffling
gaffling / css_avatar.php
Last active August 31, 2021 19:58
[CSS AVATAR] Generate an HtML/CSS Avatar from agiven Name #php #function #avatar
<?php
/* -------------------------------------------------------------------------------- */
/* [CSS AVATAR] Generate an HtML/CSS Avatar from agiven Name #php #function #avatar */
/* -------------------------------------------------------------------------------- */
/**
* CSS_AVATAR() Generate an HtML/CSS Avatar from agiven Name
* @see [css credits] [https://codepen.io/lunamatic/pen/NWbXxaR]
* @param [string] $nick [Name that should generate an avatar (without name it will return only the css)]
@gaffling
gaffling / delete_older_than.php
Last active March 24, 2021 07:14
[Delete Old] Delete files older than a given age (in seconds) #php #function #delete
<?php
/* -------------------------------------------------------------------------------------------- */
/* [Delete Old] Delete files older than a given age (in seconds) recusiv #php #function #delete */
/* -------------------------------------------------------------------------------------------- */
// TEST
delete_older_than('limit', 1);
/**
* delete_older_than()
@gaffling
gaffling / cc.php
Created February 17, 2021 12:36
[CC LICENSES] Print CC License Image from given Parameter #php #function #cc
<?php
/* ---------------------------------------------------------------------------- */
/* [CC LICENSES] Print CC License Image from given Parameter #php #function #cc */
/* ---------------------------------------------------------------------------- */
/**
* creativecommonsLicense() CC LICENSES INFO HTML
* @see https://de.wikipedia.org/wiki/Creative_Commons
* @param integer $adaptations [1-3]
@gaffling
gaffling / isAnimatedGIF.php
Created January 11, 2021 15:34
[is animated GIF] Detect if a GIF file is animated or not #php #function #gif
<?php
/* ----------------------------------------------------------------------------- */
/* [is animated GIF] Detect if a GIF file is animated or not #php #function #gif */
/* ----------------------------------------------------------------------------- */
/**
* Detect if a GIF file is animated or not
*
* We read through the file til we reach the end of the file, or we've found at least 2 frame headers
@gaffling
gaffling / JWT.php
Last active January 21, 2021 08:45
[Token Class] Simple PHP JSON Web Token (JWT) #php #class #jwt
<?php
/**
* JWT (JSON Web Token) Implementation
*
* Minimum implementation used by Realtime auth, based on this:
*
* READ https://codeofaninja.com/2018/09/rest-api-authentication-example-php-jwt-tutorial.html
* INFO http://self-issued.info/docs/draft-jones-json-web-token-01.html
* CODE https://github.com/luciferous/jwt
@gaffling
gaffling / javascript_log_function.htm
Last active December 9, 2020 07:16
[JS Log] Vanilla JavaScript Log Function #js #function #log
<!--
/* ----------------------------------------------------------- */
/* [JS Log] Vanilla JavaScript Log Function #js #function #log */
/* ----------------------------------------------------------- */
-->
<script>
function log(msg, color) {
@gaffling
gaffling / HighlightCodeClass.php
Last active November 4, 2020 14:41
[Highlight Code Class] Easy Highlight HTML and PHP Code #php #class #syntaxlightning
<?php
/* ------------------------------------------------------------------------------ */
/* [Highlight Code] Easy Highlight HTML and PHP Code #php #class #syntaxlightning */
/* ------------------------------------------------------------------------------ */
class highlight {
private static $highlight = array();
private static $start_line = 0;
private static $cache_path = null;
@gaffling
gaffling / BadWordFilter.php
Created September 9, 2020 09:43
[Bad Word Filter] Stay away from bad and offensive words #php #class #text
<?php
/* -------------------------------------------------------------------------- */
/* [Bad Word Filter] Stay away from bad and offensive words #php #class #text */
/* -------------------------------------------------------------------------- */
// the class
class BadWordFilter {
// variable for storing bad words
@gaffling
gaffling / text2rtf.php
Last active August 26, 2020 06:30
[Create MS Word RTF] Text to Microsoft Word #php #class #word
<?php
/* ------------------------------------------------------------- */
/* [Create MS Word RTF] Text to Microsoft Word #php #class #word */
/* ------------------------------------------------------------- */
/**
* @uses https://github.com/phprtflite/PHPRtfLite
* @see http://sigma-scripts.de/phprtflite/docs/
* @see https://joelonsoftware.com/2008/02/19/why-are-the-microsoft-office-file-formats-so-complicated-and-some-workarounds/
*/