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) {
@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,
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
drush rsync LOCALPATH @SITEALIAS:REMOTEPATH
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;
@efpapado
efpapado / dont_cache_routes.patch
Created May 30, 2017 07:02
Drupal 8 multilingual 404
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 5d92e77..725d64c 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -167,7 +167,7 @@ public function getRouteCollectionForRequest(Request $request) {
'query' => $query_parameters,
'routes' => $routes,
];
- $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']);
+// $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']);
@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);