Skip to content

Instantly share code, notes, and snippets.

MrTrick / test_dompdf_1.2.0.php
Created Feb 15, 2022
#Reproducing an error in dompdf 1.2.0
View test_dompdf_1.2.0.php
<?php declare(strict_types=1);
require __DIR__ . '/vendor/autoload.php';
$dompdf = new Dompdf\Dompdf();
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
MrTrick / AppServiceProvider.php
Created Feb 4, 2021
Simple direct-injection of custom requests with validation rules.
View AppServiceProvider.php
<?php declare(strict_types=1);
namespace App\Providers;
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
* Class AppServiceProvider.
MrTrick / M503
Created May 30, 2019
Melzi settings
View M503
ok 0
EPR:2 75 115200 Baudrate
EPR:3 129 0.000 Filament printed [m]
EPR:2 125 0 Printer active [s]
EPR:2 79 0 Max. inactive time [ms,0=off]
EPR:2 83 360000 Stop stepper after inactivity [ms,0=off]
EPR:3 3 80.0000 X-axis steps per mm
EPR:3 7 80.0000 Y-axis steps per mm
EPR:3 11 405.4591 Z-axis steps per mm
MrTrick / combined.hex
Last active Feb 5, 2019
Combining hex files
View combined.hex
View Puzzle Puzzle
Design a puzzle, consisting of:
• a small number (<10) of polyomino pieces of varied configurations, but the same unit size.
• a rectangular container of arbitrary height and width, ideally but not necessarily integral multiples of the polyomino unit size.
Having a single unique solution:
• where all pieces fit flat within the container.
• where all pieces are placed non-orthogonally wrt the container.
Ideally / Bonus Points
• Pieces are unique
MrTrick / example_output.txt
Last active Dec 11, 2017
Secret santa permutor
View example_output.txt
EAS=>PRB, MP=>AS, R=>E, B=>M
EAS=>PRB, MP=>ES, R=>A, B=>M
EAS=>PRB, MP=>EA, R=>S, B=>M
EAS=>MPR, MP=>EA, R=>B, B=>S
EAS=>MPB, MP=>AR, R=>E, B=>S
EAS=>MPR, MP=>AB, R=>E, B=>S
EAS=>MRB, MP=>EA, R=>P, B=>S
EAS=>MPR, MP=>EB, R=>A, B=>S
EAS=>MPB, MP=>ER, R=>A, B=>S
EAS=>PRB, MP=>EA, R=>M, B=>S
View snippet.js
* Send a single G-code line, and resolve with the response.
* @param {string} line A single line of G-Code
* @return {Promise} A promise that resolves with the response line, or rejects with the serial error.
send: function(line) {
var self = this, port = this.port;
//Clear any incoming data
return port.flush()
//Write the G-code line into the serial port, and set up a waiter with the response.
MrTrick / wat.php
Last active Aug 22, 2016
WSOD generator, hair-tearing-inducer
View wat.php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
//Check the log file can be written
View gist:52a172312df6d3b34d0ff4f51dc38e80
The key objectives to be met by the recommended solution design for this project are:
1. Correlate ORCID IDs with UTS IDs.
2. Provide receiving systems with correlated ORCID information.
3. Consider expected future use and users of systems and information.
4. Align with UTS Architectural Principles.
5. Respect privacy and the ability for users to “opt-out”.
View experimental_fixer.js
var _=require('lodash');
/** Run the given from/to replace patterns on every reference in the given node **/
function translateRefs(node, from, to) {
if (node.$ref) node.$ref = node.$ref.replace(from, to);
else if (typeof node === 'object') for(var i in node) if (node.hasOwnProperty(i)) translateRefs(node[i], from, to);
function importSchema(file, name, root) {
var schema = _.cloneDeep(require(built_schemas+"/"+file)); //Import and copy the schema
translateRefs(schema, /^#\/definitions\//, "#/definitions/"+name+"-"); // Convert every internal reference to the new path
translateRefs(root, new RegExp("^"+file+"#/definitions/"), "#/definitions/"+name+"-"); // Convert every base reference to the new path