Skip to content

Instantly share code, notes, and snippets.

View melissamcewen's full-sized avatar

Melissa McEwen melissamcewen

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
Handwash Laundromat Laundry Room
Cost per load Depends on upfront costs* $3-5 $1-2
Travel time 0 20-40 minutes 2-10 minutes
Time (Active) 6-15 minutes 2-10 minutes 2-10 minutes
Time (Passive) 1-6 hours. 80+ minutes 80+ minutes
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@melissamcewen
melissamcewen / restaurant.js
Last active September 21, 2016 20:37
Wit.ai figuring out slotting
findRestaurant({context,entities}) {
return new Promise(function(resolve, reject) {
var cuisine = firstEntityValue(entities, 'cuisine');
var neighborhood = firstEntityValue(entities, 'neighborhood');
console.log('cuisine:' + cuisine);
console.log('neighborhood:' + neighborhood);
if (cuisine && neighborhood) {
console.log('both cuisine and neighborhood present');
@melissamcewen
melissamcewen / OpenHeader.Js
Created August 4, 2016 18:18
Casper test1
module.exports = function(casper, scenario, vp) {
casper.mouse.move('.menu-toggle');
casper.click('.menu-toggle');
};
@melissamcewen
melissamcewen / entity-reference.feature
Last active March 12, 2018 21:25
See if a pane with a contextual view correctly displays
@api
Feature: related content appears on articles
In order to help visitors find related content
Items of the related content type should appear on articles with the same primary taxonomy
Scenario: When a related content item and an article have the same taxonomy, the related content item should display on the article
Given "taxonomy" terms:
| name |
| Tag one |
And "related_content" content:
@melissamcewen
melissamcewen / gist:1769f1fd749c28e5fb24c542c1de9653
Created July 15, 2016 20:39
Debugging proper rendering of field from a Drupal 7 view
$view = &$vars['view'];
if($view->name == 'VIEW_MACHINE_NAME'){
$rows = $vars['rows'];
foreach ($rows as $id => $row) {
//dpm($view->result[$id]);
dpm($view->render_field('field_related_content_type', $id));
}
}
@melissamcewen
melissamcewen / views-view-unformatted.tpl.php
Created July 15, 2016 17:01
Debugging Drupal 7 Views Result When Theming
<?php foreach ($rows as $id => $row): ?>
<?php dpm($view->result[$id]) ?>
<?php endforeach; ?>
@melissamcewen
melissamcewen / FeatureContext.php
Created July 12, 2016 19:32
Behat Tests for Drupal Paragraphs
<?php
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
use Behat\Behat\Event\StepEvent;
<?php
$plugin = array(
'single' => TRUE,
'title' => t('Category Topic Pane'),
'description' => t('A Pane showing the current node\'s children under the main menu, their descriptions, and their children'),
'category' => t('Category Topic'),
'render callback' => 'category_topics_pane_custom_pane_render',
'admin info' => 'category_topics_pane_custom_pane_admin_info',
'hook theme' => 'category_topics',
);