Skip to content

Instantly share code, notes, and snippets.

View backlineint's full-sized avatar
🐱

Brian Perry backlineint

🐱
View GitHub Profile
@bbenjamin
bbenjamin / drupalJqueryRemoval.md
Last active February 7, 2023 13:21
Issues relevant to Drupal JavaScript modernization and jQuery removal

Presentation Slides

https://docs.google.com/presentation/d/17Zpy5fZQsWsoZBhisA3rQiZy_JrK9MPR_HdgAisQ9XI/edit?usp=sharing

jQuery UI

@bran
bran / d8-responsive-image-programmatically.php
Created January 3, 2019 18:33 — forked from szeidler/d8-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(),
@blazeyo
blazeyo / package.json
Last active October 19, 2018 21:18
Package json for transpiling javascript. Put it in the root of you drupal composer project and run `yarn install`. `yarn watch:js-dev` will start the file watcher.
{
"name": "project-name",
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"babel-core": "6.24.1",
"babel-plugin-add-header-comment": "^1.0.3",
"babel-preset-env": "1.4.0",
"chalk": "^1.1.3",
"chokidar": "1.6.1",
@neodigm
neodigm / zurb_foundation_equalizer_alternative.js
Created May 2, 2017 21:38
Lightweight Zurb Foundation Equalizer alternative
// Lightweight ZF Equalizer alternative
// Will make two or more HTML elements the same height
// Usage: eq2.makeEqual("[data-equalizer-watch='your_pattern']");
var eq2 = {
Mx: 0,
makeEqual: function( data_eqlzr_watch ){
$( data_eqlzr_watch ).each(function(){
eq2.Mx = ( this.clientHeight > eq2.Mx ) ? this.clientHeight : eq2.Mx;
});
$( data_eqlzr_watch ).css("height", eq2.Mx + "px");
@richard-flosi
richard-flosi / assertions-compareScreenshot.js
Created August 27, 2014 14:25
Nightwatch with Visual Regression testing
// assertions/compareScreenshot.js
var resemble = require('resemble'),
fs = require('fs');
exports.assertion = function(filename, expected) {
var screenshotPath = 'test/screenshots/',
baselinePath = screenshotPath + 'baseline/' + filename,
resultPath = screenshotPath + 'results/' + filename,
diffPath = screenshotPath + 'diffs/' + filename;
@matthewpizza
matthewpizza / install-composer.sh
Created February 13, 2014 03:55
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {