Skip to content

Instantly share code, notes, and snippets.

View besfortoruci's full-sized avatar

Besfort Oruci besfortoruci

  • Prishtina, Kosovo
View GitHub Profile
@stevebauman
stevebauman / Mutable.php
Created February 16, 2023 14:50
Mutable Observers
<?php
namespace App\Observers;
trait Mutable
{
public static function mute(string|array $events = null)
{
if (is_null($events)) {
$events = ['*'];
@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:

@pauleveritt
pauleveritt / scratch.html
Created September 25, 2022 20:56
Idiomorph with a custom element.
<html>
<head>
<title>Custom Element Morph</title>
<script src="https://unpkg.com/idiomorph"></script>
</head>
<body>
<hello-world name="World"></hello-world>
<button id="update">Update</button>
<script defer>
class HelloWorld extends HTMLElement {
<script data-turbo-eval="false">
document.addEventListener('turbo:before-render', () => {
let permanents = document.querySelectorAll('[data-turbo-permanent]')
let undos = Array.from(permanents).map(el => {
el._x_ignore = true
return () => {
delete el._x_ignore
}
@dabit3
dabit3 / next-graph-nfts.js
Last active August 11, 2023 06:49
StackBlitz, GraphQL, The Graph, Zora, & Next.js
import React from 'react'
import { createClient } from 'urql'
const client = createClient({
url: 'https://api.thegraph.com/subgraphs/name/dabit3/zoranftsubgraph'
})
const query = `
query {
tokens(
@mchoiruln
mchoiruln / web.php.md
Last active March 8, 2021 17:46
PHPStorm complaints and solutions (Laravel 5.7 Projects)

Undefined variable $router

where : inside routes\web.php
solution : just add this comment on top that code or top of file after <?php

<?php
/** @var \Laravel\Lumen\Routing\Router $router */
$router->get('/', function () use ($router) {
    return $router->app->version();
});
@jakub-g
jakub-g / mac-pain.md
Last active March 20, 2024 08:53
MacOS for Windows users: overcoming the annoyances

Introduction

For a long time Windows user, starting using Mac can be an exercise in frustration and keeping your nerves at bay. Many things don't work as expected, need to be activated in some ways, keyboard shortcuts are non-existent or wildly different.

This page is a living reference of a Windows long-timer trying to do basic stuff on a Mac. If you see an easier way to achieve certain things, don't hesitate to drop a comment.

Related links:

@mfd
mfd / 06.png
Last active April 30, 2024 03:17
Gilroy font
06.png
@2bard
2bard / translation_notes
Created December 18, 2012 16:29
Using Symfony translation component in Twig outside of Symfony2 framework.
Note: I've left some of the full package names in tact to show exactly where the class comes from.
#### Pull dependencies in using composer ####
//Example composer.json
{
"require": {
"symfony/config" : "2.1.0",
"symfony/yaml" : "2.1.0",
"twig/twig": "1.9.0",