Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@lyrixx
lyrixx / test.php
Last active November 10, 2023 14:27
Symfony Playgound with its Container and a custom configuration
<?php
use App\Kernel;
require __DIR__.'/vendor/autoload_runtime.php';
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@geekuillaume
geekuillaume / esphome-lilygot5.yaml
Created January 5, 2022 21:19
Configuration for ESPHome + LilyGo T5 4.7"
esphome:
name: lilygo-t5
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
@davidbgk
davidbgk / utils.css
Last active August 13, 2022 20:07
Let's start to reference some CSS utils
/* Applying it to the html element will provide smooth scrolling to anchors
https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-behavior */
html {
scroll-behavior: smooth;
}
/* Remove animations for folks who set their OS to reduce motion.
1. Immediately jump any animation to the end point
2. Remove transitions & fixed background attachment
@davidbgk
davidbgk / utils.py
Last active August 13, 2022 20:08
Let's start to reference some Python utils
def neighborhood(iterable, first=None, last=None):
"""
Yield the (previous, current, next) items given an iterable.
You can specify a `first` and/or `last` item for bounds.
"""
iterator = iter(iterable)
previous = first
current = next(iterator) # Throws StopIteration if empty.
for next_ in iterator:
@dsferruzza
dsferruzza / README.md
Last active January 23, 2024 06:24
Configure a memory_limit for scheduled tasks of a Laravel app on Clever Cloud

Problems

  • some of my Laravel's scheduled tasks fail because the default memory_limit of PHP is too low
  • running php -d memory_limit=xxx artisan schedule:run does not seem to have any effect
  • there is no way to provide a custom php.ini for CLI-only on Clever Cloud

Solution

This patch adds a simple way to set memory_limit using a CLI_MEMORY_LIMIT environment variable. This new setting only applies when the Laravel app is booted from CLI (like when running php artisan ... commands) and have no effect on the memory_limit value in web context.

@davidbgk
davidbgk / utils.js
Last active March 25, 2022 16:23
Let's start to reference some JS utils
// More resources: https://1loc.dev/ + https://htmldom.dev/ + https://thisthat.dev/ + https://vanillajstoolkit.com/
const qsa = (selector) => Array.from(document.querySelectorAll(selector))
// Another way inspired by fluorjs https://fluorjs.github.io/
function $(selector, root = document) {
if (selector instanceof Node) {
return [selector]
}
return root.querySelectorAll(selector)
@IanColdwater
IanColdwater / twittermute.txt
Last active May 23, 2024 18:37
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
Leave a comment with the name of an application (or multiple) that replaces a function typically done with a modern web browser.
I.E. an application that allows YouTube to be watched without a browser.
@lyrixx
lyrixx / BrokerFactory.php
Last active July 1, 2019 15:21
PHPStan extension to extract property type hint from constructor argument
<?php
use PHPStan\Broker\Broker;
use PHPStan\Broker\BrokerFactory as PhpstanBrokerFactory;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\Php\PhpPropertyReflection;
use PHPStan\Reflection\PropertiesClassReflectionExtension;
use PHPStan\Reflection\PropertyReflection;
use PHPStan\Type\ObjectType;