Skip to content

Instantly share code, notes, and snippets.

@htochko
htochko / CircularReferenceHandler.php
Last active February 26, 2026 13:34
Symfony: circular reference solution for Serializer:
/**
/* src/Srilizer/CircularReferenceHandler
*/
namespace App\Serializer;
class CircularReferenceHandler
{
/**
* @param object $object The entity that was already serialized
* @param string|null $format The format (json, xml, etc.)
@htochko
htochko / gist:c34af53c1ab3a5e6cbd427a14c7d5ac2
Created February 25, 2026 06:50
FIX leaflet.js rendering recomendations:
// Combine both fixes for a bulletproof map
var map = L.map('map', {
renderer: L.svg({ padding: 0.5 }), // Fixes polygon clipping
preferCanvas: true // Fixes lag with many points
});
// Check if you have any CSS global styles affecting img tags. Sometimes a global img { max-width: 100%; } or display: block; can interfere with Leaflet's tile positioning math. You can reset it for the map specifically:
/* CSS */
#mapId .leaflet-tile-container img {
@htochko
htochko / page.twig
Created January 10, 2025 09:50
Add svg logo as style in background
{% if templateOptions.params.logo %}
<style>
h2.sectionTitle::after {
position: absolute;
top: 0px;
display: block;
content: ' ';
height: 24px;
background-image: url("data:image/svg+xml,{{ templateOptions.params.logo|raw|url_encode }}");
background-position: center top;