This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"condition": "event == 'update' AND data.status = 'published'", | |
"query": "query { type, id, text }", | |
"url": "http://example.com/hooks/update" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Import arbitrary config from a variable. | |
// Assumes $data has the data you want to import for this config. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 Fetch docs | |
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch | |
fetch('https://some.url.com') | |
.then(response => { | |
if (response.ok) { | |
return Promise.resolve(response); | |
} | |
else { | |
return Promise.reject(new Error('Failed to load')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save react react-dom && npm install --save-dev html-webpack-plugin webpack webpack-dev-server babel-{core,loader} babel-preset-{react,es2015,stage-0} style-loader css-loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input.form-submit.button-small { | |
padding: 4px 8px; | |
font-weight: bold; | |
} | |
.container-inline input.form-submit.button-small + .ajax-progress.ajax-progress-throbber .throbber { | |
position: absolute; | |
left: 19px; | |
margin-top: 7px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function assumes you have a Customizer export file in your theme directory | |
* at 'data/customizer.dat'. That file must be created using the Customizer Export/Import | |
* plugin found here... https://wordpress.org/plugins/customizer-export-import/ | |
*/ | |
function import_customizer_settings() | |
{ | |
// Check to see if the settings have already been imported. | |
$template = get_template(); | |
$imported = get_option( $template . '_customizer_import', false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given /^(?:|I )am on "(?P<page>[^"]+)"$/ | |
Given /^(?:|I )am on (?:|the )homepage$/ | |
Given :type content: | |
Given :vocabulary terms: | |
Given I am an anonymous user | |
Given I am at :path | |
Given I am logged in as :name | |
Given I am logged in as a user with the :permissions permission(s) | |
Given I am logged in as a user with the :role role(s) | |
Given I am logged in as a user with the :role role(s) and I have the following fields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// x, y, width, height | |
// x & y position from top left corner of document | |
// width & height of selection | |
// | |
// makeSelection(10,50,200,100); | |
function makeSelection(x,y,sw,sh){ | |
app.activeDocument.selection.select([ [x,y], [x,y+sh], [x+sw,y+sh], [x+sw,y] ]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; // or however you load Twig | |
require_once 'Lexer.php'; | |
require_once 'Indent.php'; | |
$twig = new Twig_Environment(new Twig_Loader_Filesystem('templates')); | |
$twig->addExtension(new Indent_Twig_Extension()); | |
$twig->setLexer(new Indent_Twig_Lexer($twig)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
Drupal.fooModule = Drupal.fooModule || {}; | |
Drupal.fooModule.success = function (response, status) { | |
// do some cusotm coding if needed. | |
// Call original method with main functionality. | |
Drupal.ajax.prototype.success.call(this, response, status); | |
}; | |
Drupal.behaviors.fooModule = { |
NewerOlder