Skip to content

Instantly share code, notes, and snippets.

View jrfnl's full-sized avatar
🐘
Herding 🐘

Juliette jrfnl

🐘
Herding 🐘
View GitHub Profile
@ruudk
ruudk / README.md
Created December 8, 2022 15:35
How to find the files that are the slowest to analyze with PHPStan?

How to find the files that are the slowest to analyze with PHPStan?

For us, PHPStan became a bit slower with every release. We have a very large codebase with 10.000+ classes. There seem to be a few known issues related to big arrays.

See: phpstan/phpstan#8353 phpstan/phpstan#8146

To understand which files are problematic we run the following command:

@mcclure
mcclure / add-to-Stylus-to-flag-nfts.css
Last active January 21, 2022 09:34
Download the "Stylus" browser extension and add this for all Twitter NFT users to be unambiguously flagged as such. Not written by me.
[style^='clip-path: url("#hex-hw-shapeclip-clipconfig");']
{
background-color: black;
}
[style^='clip-path: url("#hex-hw-shapeclip-clipconfig");']::before
{
background-color: black;
color: white;
content: "NFT USER lmao";
<?php
function spl_push_error_handler(ErrorHandler $handler, int $level = \E_ALL, int $priority = 0): void
{
// this function would be built into PHP, possibly with the addition of some extra functions to inspect and remove
// existing error handlers
// pushed error handlers would take priority over an error handlers set with set_errorhandler(), which would only be called
// if the error is not handled by a handler in the stack.
@mindplay-dk
mindplay-dk / php-upgrades.md
Last active December 28, 2023 16:46
PHP upgrades

Upgrading PHP

Guidelines for upgrading the minimum PHP version requirements of packages and projects.

This isn't meant to be an exhaustive guide to upgrading, but as a checklist for the most important upgrades.

PHP 5.3

The first version to support namespaces - any relevant PHP packages/projects usually have this version as the minimum requirement, so this document won't concern itself with upgrades prior to that.

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@Potherca
Potherca / README.md
Last active April 8, 2024 10:16
BASH script to clone all git repository in a Group on GitLab, or Organization on GitHub.

Introduction

Starting at a new employer always mean checking out various git repositories.

As the amount of repositories a company has grows, the time needed to clone all of those repositories also grows.

This script automates this task.

In order for this script to work, a personal access token is needed.

@Rarst
Rarst / .scrutinizer.yml
Last active August 13, 2019 11:37
Scrutinizer config to install PHPUnit on the fly, without shipping in project dependencies.
filter:
excluded_paths:
- 'tests/*'
checks:
php: true
build:
environment:
php:
version: 7.2
dependencies:
@mlocati
mlocati / exceptions-tree.php
Created March 9, 2017 10:58
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@DragonBe
DragonBe / php_conferences_2016.md
Last active February 9, 2018 08:02
Overview of PHP oriented conferences in 2016 (excluding polyglot and framework oriented conferences)
@matheuseduardo
matheuseduardo / get-page-by-slug.php
Last active March 23, 2022 07:58 — forked from micahblu/gist:5786794
get_page_by_slug - wordpress
<?php
/**
* Retrieve a page given its slug.
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $page_slug Page slug
* @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
* Default OBJECT.
* @param string|array $post_type Optional. Post type or array of post types. Default 'page'.