Skip to content

Instantly share code, notes, and snippets.

View backlineint's full-sized avatar
🐱

Brian Perry backlineint

🐱
View GitHub Profile
@backlineint
backlineint / code-a-thon-setup.md
Last active April 8, 2016 20:59
PRC Code-a-Thon Development Environment Setup
@backlineint
backlineint / CustomSteps.php
Last active March 16, 2016 03:35
Custom Front-End Behat Steps
/**
* @When /^I am browsing using a "([^"]*)"$/
*/
public function iAmBrowsingUsingA($device) {
switch ($device) {
case "phone":
$this->getSession()
->resizeWindow((int) $this->customParameters['phone_width'], (int) $this->customParameters['phone_height'], 'current');
break;
case "tablet":
@backlineint
backlineint / tests.js
Created June 22, 2016 04:14
Webdriver Test Example
var wdio = require("webdriverio");
var webdrivercss = require("webdrivercss");
var assert = require("assert");
function assertShots (err, shots) {
assert.ifError(err);
Object.keys(shots).forEach(function(element) {
shots[element].forEach(function(shot) {
assert.ok(shot.isWithinMisMatchTolerance, shot.message);
@backlineint
backlineint / phantom-tests.js
Created June 24, 2016 18:14
PhantomCSS Test Example
casper.thenOpen(phantom.rootUrl)
.then(function() {
this.evaluate(function() {
// Evaluate any pre-test js here
});
})
.then(function() {
phantomcss.screenshot('.view-solutions .views-row:first-child', 'Solution Teaser');
})
.then(function() {
@backlineint
backlineint / wdio-tests.js
Created July 29, 2016 18:47
Example Webdriver IO Tests
var wdio = require("webdriverio");
var webdrivercss = require("webdrivercss");
var assert = require("assert");
function assertShots (err, shots) {
assert.ifError(err);
Object.keys(shots).forEach(function(element) {
shots[element].forEach(function(shot) {
assert.ok(shot.isWithinMisMatchTolerance, shot.message);
@backlineint
backlineint / package.json
Created July 29, 2016 18:48
Node Dependencies for WebDriverIO tests
{
"name": "empower",
"version": "1.0.0",
"description": "Dependencies for eMPower theme.",
"private": true,
"devDependencies": {
"bootstrap-sass": "^3.3.6",
"grunt": "^1.0.1",
"grunt-contrib-sass": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
@backlineint
backlineint / readme.md
Last active July 31, 2016 16:10
Readme for Theme Testing Workflow
@backlineint
backlineint / graphql_presnter.twig
Last active August 3, 2016 16:00
Twig Presenter Example
{%
include '@mytheme/components/body/components.body.twig' with graphql(
{
media: node(id @nid) {
title,
image: field_image,
media: field_featured_media {
video: field_video_link,
length: field_video_length,
credit: field_credit,
@backlineint
backlineint / modulename.routing.yml
Created September 9, 2016 16:30
Render Node Edit Form At Different Route
crm_events.event_session_form:
path: '/node/{node}/edit/session'
defaults:
_entity_form: 'node.edit'
requirements:
_permission: 'Event: Edit any content'
@backlineint
backlineint / taxonomy-prep.twig
Created December 7, 2016 14:58
Creating a Delimited List of Referenced Taxonomy Terms
{# Prep specialties for display #}
{# TODO - Convert to field_target_entity_join custom twig filter #}
{# Get the render array for specialty taxonomy terms - this may be a single
object, or may be an array of objects #}
{% set entity = content.field_physician_specialty|field_target_entity %}
{# If we only have one value, set it #}
{% if entity.name.value is defined %}
{% set specialties = entity.name.value %}
{# If we have multiple values, iterate through and delimit #}
{% else %}