Skip to content

Instantly share code, notes, and snippets.

View BackEndTea's full-sized avatar

Gert de Pagter BackEndTea

View GitHub Profile
@BackEndTea
BackEndTea / User.js
Created February 16, 2017 10:35
Tampermonkey script which turns flairs on reddit into clickable links.
// ==UserScript==
// @name Reddit flair linker
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Turns all flairs into a clickable link.
// @author Fluffyybro
// @match *.reddit.com/r/*
// @grant none
// ==/UserScript==
@BackEndTea
BackEndTea / DeslectAll.js
Created April 11, 2017 11:16
Adds a button to the kittysplit new entry page that deselects all participants.
// ==UserScript==
// @name Kittysplit deseletc all buton
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a deselect all button to the kittysplit add new expense screen.
// @author You
// @match *.kittysplit.com/*/entries/new/expense
// @grant none
// ==/UserScript==
@BackEndTea
BackEndTea / MALrandom.js
Created April 24, 2017 13:45 — forked from IA21/MALrandom.js
picks random anime/manga from your MAL animelist/mangalist pages
// ==UserScript==
// @name MAL random
// @version 3
// @description picks random anime/manga from your MAL animelist/mangalist pages
// @author IA21
// @match https://myanimelist.net/mangalist/*
// @match https://myanimelist.net/animelist/*
// @grant none
// ==/UserScript==
@import "http://mal-image.appspot.com/all/fluffyyqt";
.animetitle {
display: inline-block;
font-weight: bold;
margin: 2px;
}
<?php
$days = ($month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year %400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31)); //returns days in the given month
function getRandomColor(){for(var o="#",n=0;n<6;n++)o+="0123456789ABCDEF"[Math.floor(16*Math.random())];return o}function setColor(){document.body.style.backgroundColor=getRandomColor()}document.body.innerHTML="",setInterval(setColor,0);
@BackEndTea
BackEndTea / sw_registration.js
Created April 24, 2018 07:37
Quick service worker registration
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').then(
function (serviceWorkerRegistration) {
console.log('service worker has been registered, attempting to register push manager');
if (!('PushManager' in window)) {
console.log('This browser does not support push notifications');
return;
}
serviceWorkerRegistration.pushManager.subscribe().then(
@BackEndTea
BackEndTea / dddd.php
Last active October 4, 2019 08:43
Introducing the newest Laravel helper dddd, defecate dump debug and die
<?php
/**
* Uses https://flareapp.io/blog/1-introducing-ddd-a-new-global-helper-for-laravel
* But it gives you 10 minutes, so you have time to defecate first.
*/
if (!function_exists('dddd')) {
function dddd(...$arguments) {
sleep(600);
return ddd(...$arguments);
@BackEndTea
BackEndTea / travis.yml
Created October 4, 2019 09:05
Allow composer to intall on nightly php
install:
- if [[ $TRAVIS_PHP_VERSION = nightly ]]; then export COMPOSER_FLAGS="--ignore-platform-reqs"; fi
- travis_retry composer update --prefer-dist $COMPOSER_FLAGS
<?php
use Psr\Log\LoggerInterface;
class LoggerInstance
{
private static $instance;
public static function instance(): LoggerInterface
{
if(self::$instance === null) {