Skip to content

Instantly share code, notes, and snippets.

View JustAnotherMark's full-sized avatar

Mark Jones JustAnotherMark

View GitHub Profile
@JustAnotherMark
JustAnotherMark / listeners.js
Created July 12, 2018 09:48
Get listeners for an element (jQuery)
$._data($('.selector').get(0), "events")
@JustAnotherMark
JustAnotherMark / states.js
Created June 20, 2018 12:14
Reacting to Drupal 8 JavaScript #states events
// Sample of core/misc/states.js starting at line 64 (currently).
// console.log() can be used to find the name of events being triggered by Drupal states.
states.Dependent.prototype = {
initializeDependee: function initializeDependee(selector, dependeeStates) {
var state = void 0;
var self = this;
function stateEventHandler(e) {
// console.log(e.data.state) will output the state whenever it is triggered.
@JustAnotherMark
JustAnotherMark / youtube-custom-speed.js
Created May 23, 2016 08:50
Custom Youtube video speed
vid = document.getElementsByClassName("video-stream html5-main-video")[0];
vid.playbackRate = 3.5;
@JustAnotherMark
JustAnotherMark / FeatureContext.php
Created May 16, 2016 16:21
Run Behat tests on a site with HTTP basic auth.
<?php
/**
* Before every scenario log in to HTTP basic auth.
*
* @BeforeScenario
*/
public function beforeScenario() {
$username = 'username';
$password = 'password';
@JustAnotherMark
JustAnotherMark / module_name.module.php
Last active December 30, 2015 08:49
How to disable 'in code' Views provided by contrib modules that you're never going to use and are just cluttering up the admin lists.
<?php
/**
* Implements hook_views_default_views_alter().
*
* Disables views provided by contrib modules that are unnecessary.
*/
function module_name_views_default_views_alter(&$views) {
// Disable the default 'tweets' view provided by the Twitter module.
if (isset($views['tweets'])) {