Skip to content

Instantly share code, notes, and snippets.

View Radiergummi's full-sized avatar
💻
Yes of course I can implement that 🥲

Moritz Friedrich Radiergummi

💻
Yes of course I can implement that 🥲
View GitHub Profile
@Radiergummi
Radiergummi / Cloudflare.js
Last active November 16, 2019 12:43
Cloudflare worker deployment
'use strict';
const axios = require('axios');
class Cloudflare {
constructor ( zone, emailAddress, apiKey ) {
this._zone = zone;
this._emailAddress = emailAddress;
this._apiKey = apiKey;
@Radiergummi
Radiergummi / OutputInterceptor.php
Created November 23, 2018 09:48
PHP class that allows to intercept output to a stream, like STDOUT. Very useful for testing CLI applications using `fwrite('', STDOUT);`.
<?php
/**
* Intercepts bytes written to an output stream and redirects them into a buffer instead
*/
class OutputInterceptor extends php_user_filter
{
/**
* Holds the PHP stream filter
*/
@Radiergummi
Radiergummi / TemplateEditor.vue
Last active October 11, 2018 11:44
Twig template editor Vue component
<template>
<article class="template-editor">
<header>
<h2 class="editor-heading">Twig Template editor</h2>
</header>
<section class="variable-editor">
<header>
<h3 class="variables-heading">
Variables
<span class="variable-count">{{ Object.keys(this.variables).length }}</span>
@Radiergummi
Radiergummi / http.js
Created July 26, 2018 21:31
Micro ajax wrapper in vanilla JS
/**
* Micro-wrapper for HTTP requests
*
* @type {Object}
*/
window.http = {
/**
* Builds a valid URL. Unless a full URL (including a protocol) is given, the current origin will be used.
*
@Radiergummi
Radiergummi / TimeSpan.php
Last active July 12, 2018 16:49
TimeSpan class - a flexible PHP class to handle time calculations
<?php
/**
* TimeSpan class
* ==============
*
* Provides a convenience class to handle time amounts and time spans: Ever wondered how to easily figure out how many
* hours there are between 09:15:31 and 18:55:01? This class is for you. Going with the example, it's as easy as:
*
* `echo (new TimeSpan('18:55:01'))->sub('09:15:31')->format('h:m'); // '09:39'`
@Radiergummi
Radiergummi / Spreadsheet.js
Created May 7, 2018 13:26
Updated version
'use strict';
import FileSaver from 'file-saver';
import JSZip from 'jszip';
class Spreadsheet {
/**
* Holds all replacement strings to escape
*
'use strict';
import FileSaver from 'file-saver';
import JSZip from 'jszip';
class Spreadsheet {
/**
* Holds all replacement strings to escape
*
@Radiergummi
Radiergummi / Cryptor.php
Last active March 3, 2023 13:11
A PHP class to encrypt and decrypt strings using a static application secret. Input is converted to hex strings to enable easier handling
<?php
namespace Vendor\Library;
use function bin2hex;
use function hex2bin;
use function openssl_decrypt;
use function openssl_encrypt;
use function random_bytes;
@Radiergummi
Radiergummi / OpentableWidget.vue
Created December 12, 2017 09:41
Wraps the Opentable widget into a Vue.js component
<template>
<div class="opentable-widget-container" v-html="content"></div>
</template>
<script>
'use strict';
/*
global window
*/
@Radiergummi
Radiergummi / README.md
Last active November 24, 2017 11:22
Phoenix

Phoenix

A lightweight and modular framework to document code projects

Reasoning

Born out of frustration while working on a Vue.js project, I decided to write something on my own. The amount of work to generate documentation for a simple project involving Vue.js components seemed tedious to me: While there are certain packages that parse single file components, it seemed near