Skip to content

Instantly share code, notes, and snippets.

@mindplay-dk
mindplay-dk / bias-quiz.md
Last active July 18, 2024 14:54
Bias quiz with Claude (or ChatGPT)

I want you to quiz me in my knowledge of biases, using the following method:

  1. Provide a brief and relatable (first- or third-person) story describing a hypothetical situation, in which one of these biases occur - and ask me to identify the type of bias.
  2. If I guess wrong the first time, provide a clue - something relating to the story. But don't be too obvious.
  3. If I guess wrong a second time, provide the answer, and relate it to the story - include a brief explanation of how/why my answer was wrong, explain the name of the correct bias, and the difference between the correct bias versus my answer.
  4. Begin from step 1 again with a different bias.

Below is a list of biases I'd like you to quiz me on:

  • Ambiguity Effect Bias: The tendency to choose options with known outcomes over those with unknown outcomes.
@mindplay-dk
mindplay-dk / vivaldi.css
Last active July 17, 2024 09:02
Vivaldi custom CSS
div#tabs-tabbar-container {
padding-top: 5px !important;
height: 34px !important;
}
div#header {
min-height: calc(40px / var(--uiZoomLevel)) !important;
}
.button-toolbar.workspace-popup.tabbar-workspace-button.button-menu {
@mindplay-dk
mindplay-dk / css-capture.js
Last active March 25, 2024 12:38
Capture CSS rules being used on the page
/**
* This script captures all CSS rules that are in use on the current page.
*
* - Paste the script into the browser console.
* - Run `collector.rules` to get a list of CSS rules in use.
* - As a diagnostic, run `collector.rulesWithComments` to get a list of CSS rules with comments.
*/
var collector = (() => {
const rulesInUse = new Set();
@mindplay-dk
mindplay-dk / factory.php
Created March 24, 2024 16:53
factory.php
<?php
class UserProvider
{
public function __construct(
#[Service("user.cache-path")]
public readonly string $cache_path
) {}
#[Service("user.cache")]
@mindplay-dk
mindplay-dk / reactive.js
Last active January 27, 2024 13:51
reactive JS 🤔 everything is a signal? 🤷‍♂️
/*
I know this is probably bonkers and there must be a million reasons this wouldn't
actually work, but hear me out... what if variables were reactive by default?? 😏
*/
function fetchTodayFortune() {
return fetch("https://api.example.com/fortune")
.then((response) => response.json())
@mindplay-dk
mindplay-dk / waitForElement.js
Last active March 25, 2024 10:17
waitForElement function (wait for element matching selector)
let animationCounter = 0;
export function waitForElement(selector) {
return new Promise((resolve) => {
const elem = document.querySelector(selector);
if (elem) {
resolve(elem); // already in the DOM
}
@mindplay-dk
mindplay-dk / ReflectionParameter.md
Created October 11, 2023 10:40
PHP ReflectionParameter overview

With so many parameter modes in PHP, I wanted to know exactly what ReflectionParameter is going to return.

<?php

class Database {}

$fns = [
    function ($str) {},
    function ($str ="hello") {},
@mindplay-dk
mindplay-dk / twitter.svg
Created September 7, 2023 07:36
Twitter Logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mindplay-dk
mindplay-dk / ts-sql-libs.md
Last active October 14, 2023 16:14
TypeScript SQL libs

Type-safe TS SQL Libs

A list of query-builders and other SQL query and/or schema abstractions.

Libraries with no activity for 2+ years will be considered "dead", as these are not keeping up with the language or ecosystem - but they may be added and may remain on the list, if they contain different or interesting ideas.

Fluent

from(books).where(books.author.lower().like('%bob') and similar.

@mindplay-dk
mindplay-dk / psr-middleware.php
Created December 13, 2022 11:32
PSR Handlers as middleware
<?php
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
// There are essentially 3 handler/middlerware patterns:
//