Skip to content

Instantly share code, notes, and snippets.

View ruby232's full-sized avatar

Rubisel Prieto Dupeyrón ruby232

View GitHub Profile
@ruby232
ruby232 / Dockerfile
Created April 3, 2024 21:13
Rust con Docker
FROM rust:latest
# Instalar dependencias del OS si es necesario
WORKDIR /app
COPY . .
# Si no se quiere instalar ninguna dependencia, comentar esta linea
RUN cargo install --path .
# El CMD depende de lo que se quiera desarrollar
CMD ["app"]
[{"on":"06:00", "off":"07:30"}]
@ruby232
ruby232 / Blocks.md
Created May 7, 2023 23:32 — forked from davidjguru/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');
@ruby232
ruby232 / submit.md
Last active April 5, 2023 12:50 — forked from tanaikech/submit.md
Downloading Shared Files on Google Drive Using Curl

pip install gdown gdown 1l_5RK28JRL19wpT22B-DY9We3TVXnnQQ

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

@ruby232
ruby232 / gist:098ac44df6c14971209c0fa8fb560860
Created November 16, 2022 12:18 — forked from rmetzler/gist:2947828
find all non UTF-8 encoded files
find . -type f | xargs -I {} bash -c "iconv -f utf-8 -t utf-16 {} &>/dev/null || echo {}" > utf8_fail
@ruby232
ruby232 / updates.php
Last active August 30, 2022 19:50
Delete a field in entity type programatically
<?php
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\Entity\FieldConfig;
// Deleting field storage.
FieldStorageConfig::loadByName('entity_type', 'field_name')->delete();
// Deleting field.
FieldConfig::loadByName('entity_type', 'bundle', 'field_name')->delete();
@ruby232
ruby232 / updates.php
Last active August 30, 2022 19:41
Delete configuration items in Drupal 9
<?php
Drupal::configFactory()->getEditable('field.field.block_content.hero.field_image')->delete();
@ruby232
ruby232 / git-pull.sh
Last active October 16, 2021 12:47
Pull from git if exists changes
#!/bin/sh
# Take from https://stackoverflow.com/a/3278427/3384529
git fetch
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
@ruby232
ruby232 / menu-local-task.html.twig
Created October 13, 2021 18:17 — forked from blackice2999/menu-local-task.html.twig
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.
*