Skip to content

Instantly share code, notes, and snippets.

View theodorosploumis's full-sized avatar
🏠
Working from home

Theodoros Ploumis theodorosploumis

🏠
Working from home
View GitHub Profile
@Dimitris1990
Dimitris1990 / potoyml.php
Last active February 13, 2024 14:21
Convert .po files from Drupal7 to .yml for Drupal9
<?php
/**
* First enable translation tracking (if it's disabled) by removing `collections.language.*`
* from /admin/config/development/configuration/ignore.
* After that, export all field translation .po files from the drupal7 site and save them
* in a directory in your project.
* The way the script is made requires some specifications:
* -The dir that the .po files are stored (e.g. /path/to/poFiles)
* -The dir that contains the language files (e.g. /path/to/config/sync/languages/)
* -The entities you want the translations from
@theodorosploumis
theodorosploumis / requirements_matrix.md
Last active February 14, 2024 14:34
System requirements matrix support
Software PHP Composer Drush Symfony Twig Node.js Drupal
Drupal 7.x 5.4+ 1.x 6+ 2.8 - 3.x 1+ 4+
Drupal 8.x 7.0+ 1.x 8+ 3.4 - 4.x 1+ 4+
Drupal 9.x 7.3+ 2.x 10+ 4.4 - 5.x 2+ 8+
Drupal 10.x 8.0+ 2.x 10+ 5.x 2+ 12+
Open Social 10.x 7.0+ 8.8 - 9.1
Open Social 11.x 7.4 - 8.x 9.x
Open Social 12.x 8.1+ 10.2.x
NextJS 12.x
<?php
// in src/Form directory.
namespace Drupal\mymodule\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\system\Form\SiteInformationForm;
/**
@natterstefan
natterstefan / HTMLToReact.tsx
Last active April 8, 2024 13:54
html-react-parser | TypeScript solution
/**
* Works in Next.js 10.x
*/
import React from 'react'
import parse, {
domToReact,
attributesToProps,
Element,
HTMLReactParserOptions,
} from 'html-react-parser'
@colorfield
colorfield / drupal-gatsby-next.md
Last active February 5, 2022 12:32
Drupal, Gatsby and Next

Drupal, Gatsby and Next

  • Gatsby and Next are both based on React.
  • No technical details here, just some personal opinions and resources
  1. Why not just Drupal Twig an jQuery
  2. When to use a Drupal backend
  3. When to use a Drupal frontend
  4. React and Vue
  5. Gatsby and Next
@findawayer
findawayer / next.js.default.webpack.js
Created December 22, 2020 04:54
Default next.js webpack config (serialized, captured with v10.0.3)
exports.config = {
externals: [ 'next' ],
optimization: {
noEmitOnErrors: false,
checkWasmTypes: false,
nodeEnv: false,
splitChunks: {
chunks: 'all',
cacheGroups: [Object],
maxInitialRequests: 25,
@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active April 20, 2024 21:34
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@fredrikbergqvist
fredrikbergqvist / Rss.ts
Created November 29, 2019 15:21
How to create an RSS feed for next.js
import React from "react";
import { NextPageContext } from "next";
const blogPostsRssXml = (blogPosts: IBlogPost[]) => {
let latestPostDate: string = "";
let rssItemsXml = "";
blogPosts.forEach(post => {
const postDate = Date.parse(post.createdAt);
if (!latestPostDate || postDate > Date.parse(latestPostDate)) {
latestPostDate = post.createdAt;
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
@juampynr
juampynr / RoboFile.php
Last active October 9, 2021 10:07
Drupal 8 common migration tasks
<?php
/**
* Command line tasks.
*
* @codingStandardsIgnoreStart
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD)
*/
class RoboFile extends \Robo\Tasks {