Skip to content

Instantly share code, notes, and snippets.

View nonom's full-sized avatar
🎯
Focusing

Antonio Martínez nonom

🎯
Focusing
View GitHub Profile
@nonom
nonom / ImageRenderExampleBlock.php
Created October 12, 2022 13:32 — forked from pixelmord/ImageRenderExampleBlock.php
[Drupal 8] Create file/ media_entity programmatically
<?php
/**
* @file
* Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlock.
*/
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
@nonom
nonom / big-xml.php
Created July 31, 2020 14:40 — forked from chrisguitarguy/big-xml.php
How to use a combination of XMLReader and SimpleXMLElement to parse large XML files in PHP.
<?php
/**
* an example of how to read huge XML files relatively quickly and efficiently
* using a few core PHP libraries.
*
*/
// Assume your file is very large, 140MB or somethig like that
$fn = __DIR__ . '/some_file.xml';