Skip to content

Instantly share code, notes, and snippets.

@rpayanm
rpayanm / phpinfo.php
Created March 25, 2015 12:40
phpinfo
<?php
phpinfo();
name: Hello Module
description: Creates a page showing "Hello from Drupal 8".
package: Custom
type: module
core: 8.x
hello.hello:
path: '/hello'
defaults:
_controller: '\Drupal\hello\Controller\HelloController::hello'
_title: 'Is anyone here?'
requirements:
_permission: 'access content'
<?php
/**
* @file
* Contains \Drupal\hello\Controller\HelloController.
*/
namespace Drupal\hello\Controller;
/**
SELECT table_schema as `Database`, table_name AS `Table`, round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` FROM information_schema.TABLES ORDER BY (data_length + index_length) DESC;
<?php
$query_string = preg_replace('/\}|\{/', '', $query->__toString());
$arguments = $query->arguments();
foreach ($arguments as $key => $val) {
$arguments[$key] = '\'' . $val . '\'';
}
$result_query = strtr($query_string, $arguments);

Object Composition (Sobrescribir una clase sin editarla)

In modern PHP, you're going to spend a lot of time working with other people's classes: via external libraries that you bring into your project to get things done faster. Of course, when you do that: you can't actually edit their code if you need to change or add some behavior.

Fortunately, OO code gives us some really neat ways to deal with this limitation. In this tutorial, you'll learn a method called composition in which we'll create a wrapper class, which has some subtle advantages over using inheritance.

https://symfonycasts.com/screencast/oo-ep4/composition-ftw

https://drive.google.com/file/d/1fTRmwiBB0cZzNQNYabM0SXUDErFIUaBk/view?usp=sharing

`composer.json:`
```json
{
"autoload": {
"psr-4": {
"": "src/"
}
}
}

Ejemplo: m3u8,

  1. Inspeccionar código e ir a las peticiones que llegan y copiar la url.
  2. Ejecutar: $ ffmpeg -i "url.m3u8" -c copy v.ts