Skip to content

Instantly share code, notes, and snippets.

View ruby232's full-sized avatar

Rubisel Prieto Dupeyrón ruby232

View GitHub Profile
@davidjguru
davidjguru / Blocks.md
Created November 12, 2020 17:47 — forked from bdlangton/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@tanaikech
tanaikech / submit.md
Last active July 22, 2024 03:49
Downloading Shared Files on Google Drive Using Curl

Downloading Shared Files on Google Drive Using Curl

When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.

File size < 40MB

CURL

filename="### filename ###"
fileid="### file ID ###"
curl -L -o ${filename} "https://drive.google.com/uc?export=download&amp;id=${fileid}"
@crittermike
crittermike / import.php
Last active August 11, 2023 10:39
Importing Drupal 8 config programmatically
<?php
// Import arbitrary config from a variable.
// Assumes $data has the data you want to import for this config.
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html');
$config->setData($data)->save();
// Or, re-import the default config for a module or profile, etc.
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module');
@codediodeio
codediodeio / database.rules.json
Last active June 22, 2024 07:03
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@firomero
firomero / json
Created February 1, 2017 21:12
Provincias de Cuba
"Provincias": [{
"id": "1",
"nombre": 'Pinar del Río',
"municipios":["Consolación del Sur", "Guane", "La Palma", "Los Palacios", "Mantua", "Minas de Matahambre", "Pinar del Río", "San Juan y Martínez", "San Luis", "Sandino", "Viñales"]
}, {
"id": "2",
"nombre": 'Artemisa',
"municipios":[
"Alquízar", "Artemisa", "Bauta", "Caimito", "Guanajay", "Güira de Melena", "Mariel", "San Antonio de los Baños", "Bahía Honda", "San Cristóbal", "Candelaria"]
}, {
@JeffTomlinson
JeffTomlinson / MyService.php
Last active July 22, 2023 16:28
Drupal 8 Configuration Dependency Injection
<?php
namespace Drupal\my_module\Services;
use Drupal\Core\Config\ConfigFactory;
/**
* Class MyService.
*
* @package Drupal\my_module\Services
@d1i1m1o1n
d1i1m1o1n / text
Created October 6, 2016 12:16
How to disable auto-save in phpstorm
How to disable auto-save:
Go to File > Settings (Ctrl+Alt+S).
Go to Appearance & Behavior > System Settings.
Make sure the two are unchecked:
Save files on frame deactivation
Save files automatically if application is idle for x sec.
Go to Editor > General > Editor Tabs
Put a checkmark on "Mark modified files with asterisk"
(Optional but recommended) Under "Tab Closing Policy", select "Close non-modified files first". You may also want to increase the number of allowed tabs.
Click Apply > OK.
Language Vehicle Reason
GoLang Tesla The future, but want somebody I know to buy one first
Haskell Batmobile Looks awesome but you'll never figure out how to drive it
Java Hummer Uses way more resources than is strictly necessary
Perl Classic Mini A classic that has influenced many cars, but not practical for 2015
PHP Fiat Multipla Ugly, nobody wants to be seen driving this
Ruby Smart Car Practical design. Will get you around the city fast, but not great on motorways
Python VW Golf Solid. Reliable. Middle of the road.
@blackice2999
blackice2999 / menu-local-task.html.twig
Created August 3, 2015 10:52
Drupal 8 - How to add classes to link (render array) without using preprocess....
{#
/**
* @file
* Default theme implementation for a local task link.
*
* Available variables:
* - attributes: HTML attributes for the wrapper element.
* - is_active: Whether the task item is an active tab.
* - link: A rendered link element.
*