Skip to content

Instantly share code, notes, and snippets.

View davidjguru's full-sized avatar
🍅
Working within a pomodoro cycle

David Rodriguez davidjguru

🍅
Working within a pomodoro cycle
View GitHub Profile
@davidjguru
davidjguru / tmux-cheatsheet.markdown
Created November 19, 2017 10:38 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@davidjguru
davidjguru / README-Template.md
Created February 18, 2018 11:50 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@davidjguru
davidjguru / drupal7-multistep-form-example.php
Created April 15, 2018 18:43 — forked from drmalex07/drupal7-multistep-form-example.php
An example with multistep forms in drupal7. #drupal #drupal7 #multistep-form
<?php
function helloworld_multistep_example_form($form, &$form_state)
{
// We add 2 keys to form_state ("step" and "state") to keep track
// of state in a multistep form.
$step = isset($form_state['step'])? ($form_state['step']) : (1);
$form['heading'] = array(
'#type' => 'markup',
@davidjguru
davidjguru / IntegerDropdownWidget.php
Created May 8, 2018 12:06 — forked from crittermike/IntegerDropdownWidget.php
Drupal 8 form widget example: creates a select dropdown for integer fields. Place in src/Plugin/Field/FieldWidget
<?php
/**
* @file
* Defines a dropdown widget for integer fields.
*/
namespace Drupal\nba_content_core\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldFilteredMarkup;
use Drupal\Core\Field\FieldItemListInterface;
@davidjguru
davidjguru / .gitignore
Created June 19, 2018 15:47 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@davidjguru
davidjguru / delete_content_entities.d8.php
Created September 25, 2018 08:17 — forked from Jaesin/delete_content_entities.d8.php
Delete all content entities in Drupal 8.
<?php
// Delete all nodes.
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute());
// Delete all files.
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute());
// Delete all taxonomy terms.
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute());
@davidjguru
davidjguru / Table.php
Created December 6, 2018 23:51 — forked from chx/Table.php
Plain table migration source plugin
<?php
namespace Drupal\sd8_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Table source from database.
*
@davidjguru
davidjguru / MyService.php
Created October 26, 2019 19:29 — forked from JeffTomlinson/MyService.php
Drupal 8 Configuration Dependency Injection
<?php
namespace Drupal\my_module\Services;
use Drupal\Core\Config\ConfigFactory;
/**
* Class MyService.
*
* @package Drupal\my_module\Services
@davidjguru
davidjguru / settings.local.php
Created January 16, 2020 11:51 — forked from keopx/settings.local.php
Drupal 8 Redis settings.local.php
<?php
/**
* Set redis configuration.
*/
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
// $settings['cache']['default'] = 'cache.backend.redis';
@davidjguru
davidjguru / __INDEX.txt
Created May 15, 2020 09:50 — forked from facine/__INDEX.txt
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes: