Skip to content

Instantly share code, notes, and snippets.

@chaunceyt
chaunceyt / Blocks.md
Created May 14, 2020 15:16 — 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');
@chaunceyt
chaunceyt / docker-help.md
Created January 5, 2020 15:50 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@chaunceyt
chaunceyt / state_capitals.json
Created January 5, 2020 15:48 — forked from bradtraversy/state_capitals.json
JSON array of states and capitals
[
{
"abbr": "AL",
"name": "Alabama",
"capital": "Montgomery",
"lat": "32.361538",
"long": "-86.279118"
},
{
"abbr": "AK",

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@chaunceyt
chaunceyt / ansible_conditionals_examples.yaml
Created July 25, 2017 13:01 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
@chaunceyt
chaunceyt / .vimrc
Created September 4, 2016 15:58 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
#!/bin/bash
yum update -y
yum -y install git.x86_64
cd /opt
git clone -v https://github.com/ansible/ansible.git --recursive
source /opt/ansible/hacking/env-setup
echo "localhost" > ~/ansible_hosts
export ANSIBLE_HOSTS=~/ansible_hosts
@chaunceyt
chaunceyt / FeatureContext.php
Created February 12, 2016 15:09 — forked from jhedstrom/FeatureContext.php
Step-definition for complex node structure (field collection + entity reference).
<?php
/**
* @Given /^I am viewing a product with the following related products:$/
*/
public function assertRelatedProducts(TableNode $relatedProducts) {
// First, create a product.
$product = (object) array(
'title' => 'Parent Product',
'type' => 'product',
'uid' => 1,
@chaunceyt
chaunceyt / 0_reuse_code.js
Created January 14, 2016 03:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console