Skip to content

Instantly share code, notes, and snippets.

View megclaypool's full-sized avatar

Meg Claypool megclaypool

View GitHub Profile
@megclaypool
megclaypool / d8-responsive-image-programmatically.php
Last active July 16, 2021 17:35 — forked from szeidler/d8-responsive-image-programmatically.php
[How to render Drupal image field items(as responsive image!) programmatically -- PHP ] Load and render responsive image from field in Drupal 8
<?php
function _load_header_image($variables) {
if ($node = $variables['node']) {
// Load main_image
$file = $node->field_main_image->entity;
if ($file) {
$variables = array(
'responsive_image_style_id' => 'header_image',
'uri' => $file->getFileUri(),
@megclaypool
megclaypool / HowToSharedRepoModelOnGitHub.md
Created June 24, 2018 22:19 — forked from seshness/HowToSharedRepoModelOnGitHub.md
Shared Repository Model for Pull Requests and Code Review

The Shared Repository Model

$ git clone [email protected]:berkeley-food-recommendations/data-gathering.git

You're cloning the main repository - be careful! We're going to enforce a "no committing to master directly" rule, so no committing directly to master, please.

Short Version

@megclaypool
megclaypool / gist:da2485541a765d12018f71fc29e07ecb
Created March 8, 2018 15:55 — forked from aczietlow/gist:1d2c8f7694e1471f2874
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();
@megclaypool
megclaypool / gist:54d7b4e209a825985b3c6b7ab9898cd2
Last active July 16, 2021 16:09 — forked from CristinaSolana/gist:1885435
[Keeping a fork up to date]

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@megclaypool
megclaypool / 0_reuse_code.js
Created May 21, 2017 05:46
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