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 / 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 / Git and Branches.txt
Last active February 18, 2018 12:10
Git & Branches
## Create new branch and switch to it at the same time.
git checkout -b newbranch
## This is shorthand for:
## git branch newbranch
## git checkout newbranch
## Basic Merging
git checkout master
## Switched to branch 'master'
@davidjguru
davidjguru / Send commit to Drupal.org Git
Last active March 17, 2018 14:17
Drupal commit with author (format)
git commit -m "Text for the commit." --author="davidjguru <davidjguru@1024022.no-reply.drupal.org>"
@davidjguru
davidjguru / day-to-day prompt.txt
Created March 23, 2018 11:42
Common day-to-day commands for a damaged brain
# Recursive grep
$ grep -R -e “string” /path/
@davidjguru
davidjguru / formexample.info.yml
Created April 9, 2018 14:38
formexample file info
name: Form Example
type: module
description: Demonstrates how to build a form with Form API
package: Custom
core: 8.x
@davidjguru
davidjguru / formexample.install
Created April 9, 2018 14:46
formexample install file
<?php
/**
* @file
* Install, update and uninstall functions for the formexample module.
*/
/**
* Implements hook_install().
*
@davidjguru
davidjguru / formexample.routing.yml
Created April 9, 2018 14:50
formexample routing file
formexample_form:
path: 'formexample/myform'
defaults:
_title: 'Form Example Drupal 8'
_form: '\Drupal\formexample\Form\FormExample'
requirements:
_permission: 'access content'
@davidjguru
davidjguru / FormExample.php
Created April 9, 2018 14:58
formexample class file php
<?php
/**
* @file
* Contains \Drupal\formexample\Form\FormExample.
*/
namespace Drupal\formexample\Form;
use Drupal\Core\Form\FormBase;
@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 / alterforms.info.yml
Created April 20, 2018 12:45
Alterforms for Drupal 8 (info file)
name: Alter Forms
description: Custom module to alter forms
package: Development
type: module
core: 8.x
dependencies:
- devel:kint
- search_kint:search_kint