Skip to content

Instantly share code, notes, and snippets.

<?php
function array_keys_recursive(array $array): array
{
return [
...array_keys($array),
...array_merge(
...array_values(array_map('array_keys_recursive', array_filter(array_filter($array, 'is_array'))))
)
];
@bdelespierre
bdelespierre / TypeHelper.php
Created April 7, 2025 07:57
TypeHelper.php
<?php
namespace App\Support;
use App\Exceptions\UnexpectedArgumentTypeException;
use Stringable;
use UnexpectedValueException;
class TypeHelper
{
@bdelespierre
bdelespierre / factorio-led-display.txt
Created December 13, 2023 08:39
Factorio Led Display Design
┌──────────┐
┌────┐ ┌───────────────┐ ┌────┐ ┌───────────────┐ ┌────┐ ┌───────────────┐ ┌────┐ ┌───────────────┐ │ │
│A=1 │ │D & 0b000000001│ │A=1 │ │C & 0b000000001│ │A=1 │ │B ---b000000001│ │A=1 │ │A & 0b000000001│ ┌───┐ ┌───┐ ┌───┐ ┌───┐ ┌─┐ ┌─┐ ┌─┐ ┌─┐ ┌────────────┐ ┌────┐ │ ┌──────┐ │ ┌───┐
│ ├─┬─┤A=1 ├─┐ │ ├─┬─┤A=1 ├─┐ │ ├─┬─┤A=1 ├─┐ │ ├─┬─┤A=1 ├─┐ │I=4│ │I=3│ │I=2│ │I=1│ │X│ │X│ │X│ │X│ │ │ │I/60│ │ │I<4x60│ │ │ │
└────┘ │ └───────────────┘ │ └────┘ │ └───────────────┘ │ └────┘ │ └───────────────┘ │ └────┘ │ └──────────────
let btns=Array.from(document.querySelectorAll('[data-control-name="people_connect"]'));
let next=function(){
btns.shift().dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }))
setTimeout(next, 1000);
}
next();
SELECT
nspname AS schemaname,relname,reltuples
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE
nspname NOT IN ('pg_catalog', 'information_schema') AND
relkind='r'
ORDER BY reltuples DESC;
(function(e,s,n) {
e.src = s;
e.onload = function() {
console.log('jQuery injected');
n(jQuery.noConflict());
};
document.head.appendChild(e);
})(document.createElement('script'), '//code.jquery.com/jquery-latest.min.js', function($){
(function follow() {
// change the inner HTML to your language
@bdelespierre
bdelespierre / tmux-cheatsheet.markdown
Created August 15, 2018 11:50 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Static Auto-completion

Create a file in:

/etc/bash_completion.d/foo

With the following content:

<?php
namespace Tests;
use App\Console\Kernel;
use Illuminate\Foundation\Testing\RefreshDatabaseState;
use Illuminate\Support\Facades\DB;
use RuntimeException;
trait RefreshSqliteDatabase
<?php
include __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance