Skip to content

Instantly share code, notes, and snippets.

View efpapado's full-sized avatar

Stathis [Efstathios] Papadopoulos efpapado

View GitHub Profile
@efpapado
efpapado / declaration_parent_compatibility.patch
Last active August 4, 2016 19:44
DS 8.x-2.x incompatibility on method declaration
diff --git a/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php b/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php
index d14d8a5..4c055fb 100644
--- a/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php
+++ b/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php
@@ -58,7 +58,7 @@ class TranslationLanguageRenderer extends DefaultLanguageRenderer {
/**
* {@inheritdoc}
*/
- public function getLangcode(ResultRow $row) {
+ public function getLangcode(ResultRow $row, $relationship = NULL) {
pv sqlfile.sql | mysql -uxxx -pxxxx dbname
@efpapado
efpapado / db_sync.sh
Created October 13, 2016 06:53
db sync
drush @SITE sql-dump --gzip | zcat | drush sql-cli
@efpapado
efpapado / tables_size.sql
Last active January 13, 2017 10:56
List tables by their size
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "___DB_NAME___"
ORDER BY (data_length + index_length) DESC;
-- Here's a query you can run to see the size per DB table:
SELECT
TABLE_SCHEMA,
diff --git a/src/Plugin/DsField/BundleField.php b/src/Plugin/DsField/BundleField.php
index 460cc62..ef9ff50 100644
--- a/src/Plugin/DsField/BundleField.php
+++ b/src/Plugin/DsField/BundleField.php
@@ -47,10 +47,8 @@ class BundleField extends DsFieldBase {
* {@inheritdoc}
*/
public function build() {
- $config = $this->getConfiguration();
$entity = $this->entity();
@efpapado
efpapado / tables_rows.sql
Created May 5, 2017 06:13
tables_rows.sql
SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'wodby' ORDER BY table_name;
drush rsync LOCALPATH @SITEALIAS:REMOTEPATH
@efpapado
efpapado / reset-D8-updates.sql
Created July 4, 2018 12:20
Reset D8 updates
DELETE FROM key_value WHERE collection='update_fetch_task';
@efpapado
efpapado / server.js
Created November 23, 2018 09:37
nodejs server that echoes the request
const http = require("http");
const querystring = require('querystring');
const hostname = "0.0.0.0";
const port = 3000;
const server = http.createServer((req, res) => {
console.log(`\n${req.method} ${req.url}`);
console.log(req.headers);
@efpapado
efpapado / clean-revisions.sql
Last active November 24, 2018 16:01
clean revisions
DELETE field_revision_body
FROM field_revision_body
LEFT JOIN field_data_body
ON field_data_body.revision_id = field_revision_body.revision_id
WHERE field_data_body.entity_id IS NULL;
-- optimize:
OPTIMIZE TABLE field_revision_body;