Skip to content

Instantly share code, notes, and snippets.

Avatar

Juampy NR juampynr

View GitHub Profile
@jibran
jibran / FileEntity.php
Created Mar 24, 2017
Migrating Drupal 7 File Entities to Drupal 8 Media Entities
View FileEntity.php
<?php
// modules/custom/my_custom_module/src/Plugin/migrate/source/FileEntity.php
namespace Drupal\my_custom_module\Plugin\migrate\source;
use Drupal\Core\Database\Query\Condition;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
/**
* Drupal 7 file_entity source from database.
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 22, 2022
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

View jb-setup.md
@mitchwongho
mitchwongho / Docker
Last active May 19, 2022
Docker 'run' command to start an interactive BaSH session
View Docker
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@e0ipso
e0ipso / magic.php
Created Sep 13, 2013
Brief introduction to some OOP features present in PHP5.
View magic.php
<?php
/**
* A base class with getters and setters incorporated.
*/
class ObjectBase {
/**
* Setter function for a generic attribute.
*
* @param string $property_name
@satooshi
satooshi / junit.php
Last active Dec 10, 2021
Parse JUnit xml log generated by PHPUnit (phpunit ---log-junit build/logs/junit.xml) and print elapsed time each test case. If you want to color time at certain threshold time, get ColorCLI class (see https://gist.github.com/satooshi/4750401).
View junit.php
<?php
function run($path)
{
$xml = simplexml_load_file($path);
$project = $xml->testsuite;
echo sprintf("total: %s msec", formatMsec($project['time'])) . PHP_EOL;
foreach ($project->testsuite as $testsuite) {