Skip to content

Instantly share code, notes, and snippets.

@Radon8472
Radon8472 / Blue Steel.md
Last active April 1, 2024 09:54
TerraFirmaCraft Alloy recipes

Diagram to create BlueSteel in minecraft TerraFirmaCraft

%%{ init: { 'flowchart': { 'curve': 'linear' } } }%%
flowchart TD 
    CU[Copper]
    ZN[Zinc]
    AU[Gold]
 NI[Nickel]
@Radon8472
Radon8472 / speedtest.inc.js
Created February 22, 2024 09:06
A class to benchmark run duration of functions
/**
* A class to benchmark (multiple) function calls
*
* @author Radon8472
* @since 2024-02-22
* @version 1.0
*
*
* @example
* Speedtest.messure(
@Radon8472
Radon8472 / markdown-details-collapsible.md
Created May 3, 2023 12:05 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to

<details>
  <summary>Click me</summary>
  
  ### Heading
  1. Foo
  2. Bar
     * Baz
 * Qux
@Radon8472
Radon8472 / custom-object-method.js
Last active February 23, 2023 09:22
Add custom method to DOM-Element via jQuery
/**
* improved version of https://stackoverflow.com/a/22649723
*
* function is bound to DOM-Element and can even used, when you load the "menu"
* via another jQuery selector later in code
*/
// Binds the function to each DOM-Element matching my selector
const $menu = $('.my-popup').each(function(i) {
/**
@Radon8472
Radon8472 / is_writeable-test.php
Last active August 2, 2024 10:03
Tests for php is_writeable function
<?php
/**
* is_writeable-test.php
*
* (on windows is_writeable sometimes returns false, even you have write-permissions, this testfile helps to check this)
*
* @see: https://bugs.php.net/bug.php?id=68926
*
*
* @since 2022-08-11
@Radon8472
Radon8472 / string_functions.inc.php
Last active February 7, 2021 17:32
Helper functions
<?php
/**
* creates a data url
*
* @version: 1.0
*
* @param string $data Data string that should be encoded
* @param string [$mime] Mime Type of the data (optional)
* @param string [$charset] charset of data (only used when it is not base64) (optional)
@Radon8472
Radon8472 / nbt-gitdiff.php
Created September 13, 2020 08:00
Textconf diff for minecraft files using TheFrozenFire/PHP-NBT-Decoder-Encoder
<?php
/**
* test - gitdiff.cmd.php
*
* written : 2018-05-01 by Radon8472
* last modified: 2019-06-22 by Radon8472
*
* @requires: https://github.com/TheFrozenFire/PHP-NBT-Decoder-Encoder
*
* reads nbt or dat-file from commdline parameter or Standard-input, to use it in git-diff textconv
@Radon8472
Radon8472 / post-checkout.sh
Last active July 28, 2023 11:14
Git Hooks
#!/bin/sh
#
# This hook is invoked when a git-checkout is run after having updated the worktree. The hook is given three parameters:
# the ref of the previous HEAD, the ref of the new HEAD (which may or may not have changed), and a flag indicating
# whether the checkout was a branch checkout (changing branches, flag=1) or a file checkout
# (retrieving a file from the index, flag=0). This hook cannot affect the outcome of git-checkout.
#
#
# @see: https://stackoverflow.com/a/35182000/2377961
# @see: https://gist.github.com/lyrixx/5867424
@Radon8472
Radon8472 / export-git-patches.sh
Created August 20, 2020 10:07
Export multiple patches
#
# exports multiple patches for a commit-range
# you can choose to select only commits matching a specific sub_dir
#
# usage: export-git-patches [commit_range] [sub_dir]
#
if [ $# -gt 1 ]; then
commit_range=$1
commit_path="$2"
@Radon8472
Radon8472 / functions.inc.php
Last active July 8, 2020 08:17
php helper functions (to ensure version compatibility)
<?php
/**
* Helper function to avoid problems with the switches argument order of implode since php 7.4.0
*
* @see: https://www.php.net/manual/function.implode.php
* @see: https://3v4l.org/MZRZA
*
* @param String $glue
* @param array $pieces
*