Skip to content

Instantly share code, notes, and snippets.

@aczietlow
aczietlow / drupal_sandbox_test.sh
Created October 6, 2014 22:12
Install module for testing using latest version of Drupal 7.
#!/bin/bash
# Download latest Drupal 7 and enable module to test.
if [ -z $1 ]; then
echo 'Please provide a module to include in the sandbox.'
return
fi
@aczietlow
aczietlow / prepare-commit-msg
Last active June 6, 2024 10:11
Git hook for prepare commit msg. Looks for an issue number in the branch name (a number between 3-9 digits long) and prepends it to the commit message.
#!/bin/sh
#
# A hook script to prepare the commit log message.
# Called by "git commit" with the name of the file that has the
# commit message, followed by the description of the commit
# message's source. The hook's purpose is to edit the commit
# message file. If the hook fails with a non-zero status,
# the commit is aborted.
#
# To enable this hook, rename this file to "prepare-commit-msg" and
@aczietlow
aczietlow / overridingVisibility.php
Created November 20, 2014 15:49
Accessing super class private variables
<?php
Class MyClass {
private $string = 'Can\'t touch this!';
public function doStuff() {
$this->string = $this->string . ' Na Na Na Na.';
}
}
@aczietlow
aczietlow / gist:1d2c8f7694e1471f2874
Created December 8, 2014 15:38
Behat tests for checkout css properties
<?php
/**
* @Given /^The element "(?P<selector>[^"]*)" should have a css property "(?P<property>[^"]*)" with a value of "(?P<value>[^"]*)"$/
*
* @TODO Need to find a way to test for css styles on elements.
* Or possibly we should just be checking the markup, and not the styling... Research this more.
*/
public function assertElementHasCssValue($selector, $property, $value)
{
$page = $this->getSession()->getPage();
@aczietlow
aczietlow / debugging_efq.php
Last active August 29, 2015 14:15
Debug entity field queries in Drupal
<?php
function MYMODULE_query_alter($query) {
if ($query->hasTag('efq_debug') && module_exists('devel')) {
dsm((string) $query);
dsm($query->arguments());
}
}
$query = new EntityFieldQuery;
$group_entities = $query->entityCondition('entity_type', 'node')

Behat

Behavior Driven Development - an “outside-in” methodology. It starts at the outside by identifying business outcomes, and then drills down into the feature set that will achieve those outcomes. - Dan North*

Benefits

  • Better code quality
  • Less Regression
  • Better Acceptance Criteria
  • Greater understanding of code base
@aczietlow
aczietlow / 0_reuse_code.js
Last active August 29, 2015 14:17
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
@aczietlow
aczietlow / .bash_profile.sh
Created September 8, 2015 18:51
git.sh shell prompt
#https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
source ~/.git-prompt.sh
GIT_PS1_SHOWUPSTREAM='verbose'
export PS1="[\u@\h:\W]\`__git_ps1\` \$ "
@aczietlow
aczietlow / .bash_profile.sh
Last active May 1, 2018 05:44
bash stuff for the mac
###########################################
# System Specific
###########################################
#mysql
#export PATH="$PATH:/usr/local/mysql/bin/mysql"
#alias mysql='/usr/local/mysql/bin/mysql'
#alias mysqldump='/usr/local/mysql/bin/mysqldump'
#alias mysqladmin='/usr/local/mysql/bin/mysqladmin'
@aczietlow
aczietlow / PHP[World]-2015.md
Last active August 22, 2016 18:25
PHP[world] 2015 session notes

PHP[World] 2015

TL;DR

  1. PHP 7 is amazing
  2. Drupal 8, Symfony 3, Magento 2, Laravel 3, PHPUnit 5, Zend Framework 3 are all dropping by the end of the year
  • Really need to brush up on my OOP skills, all the cool kids are doing it
  1. Open source is continuing to grow in government (including Drupal)
  2. Literally everyone here has a CI process (build tool, automated testing, automated deployment)