Skip to content

Instantly share code, notes, and snippets.

View kyletaylored's full-sized avatar
🍝
unfurling wet spaghetti

Kyle Taylor kyletaylored

🍝
unfurling wet spaghetti
View GitHub Profile
@kyletaylored
kyletaylored / drupalvm-setup.sh
Last active October 18, 2018 14:32
A shell script to help set up a standard DrupalVM project
#!/bin/bash
# Get project directory and git url
echo "Project code (used for project directory name):"
read project_code
echo "Project repo git url (can be blank):"
read project_git_url
# Clone DrupalVM
git clone git@github.com:geerlingguy/drupal-vm.git $project_code
@kyletaylored
kyletaylored / optimize_images.sh
Last active June 10, 2017 15:33
Script to run in a local directory to optimize all JPG and PNG images.
#!/bin/bash
# This script relies on jpegtran, a tool included with libjpeg.
# libjpeg comes bundled with ImageMagick on most nix platforms:
#
# Mac:
# brew install imagemagick
# brew install pngquant
#
# Ubuntu/Debian:
@kyletaylored
kyletaylored / requirements.txt
Last active April 17, 2018 20:11
Python script to extract content types from a Drupal 7 sitemap.xml.
tqdm==4.19.5
requests==2.18.4
beautifulsoup4==4.6.0
PyYAML==3.12
---
version: "2"
plugins:
duplication:
enabled: true
config:
languages:
php:
mass_threshold: 45
eslint:
@kyletaylored
kyletaylored / dom-loaded-test.html
Last active September 17, 2018 21:10 — forked from passcod/dom-loaded-test.html
onload, readyState, and DOMContentLoaded
<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function () {
console.log(''+(+new Date)+': Onload fired');
};
document.onreadystatechange = function () {
console.log(''+(+new Date)+': Ready state changed');
@kyletaylored
kyletaylored / lift-example.js
Last active October 2, 2018 21:10 — forked from monan/www.crozerkeystone.org.user.js
Acquia Lift API example
// ==UserScript==
// @name www.crozerkeystone.org
// @namespace https://www.crozerkeystone.org/
// @version 0.1
// @description Implements Acquia Lift
// @author Mike Monan
// @match *://www.crozerkeystone.org/*
// @grant none
// @xrequire https://code.jquery.com/jquery-latest.js
// @copyright 2017 acquia.com
@kyletaylored
kyletaylored / app.js
Last active October 4, 2018 21:17
Venom extractor
const cheerio = require('cheerio')
const fetch = require('node-fetch')
// Main function to run.
async function main(url) {
// Fetch URL, log content
await fetch(url)
.then(resp => {
resp.text().then(body => {
@kyletaylored
kyletaylored / lift-listener.js
Last active November 18, 2021 15:39
Acquia Lift Experience Builder: Removing dual wrappers when replacing content with CSS selector
window.addEventListener('acquiaLiftContentAvailable', function(event) {
function unwrap(wrapper) {
// place childNodes in document fragment
var docFrag = document.createDocumentFragment();
while (wrapper.firstChild) {
var child = wrapper.removeChild(wrapper.firstChild);
docFrag.appendChild(child);
}
// replace wrapper with document fragment
@kyletaylored
kyletaylored / swap.sh
Last active December 10, 2018 16:53
Docksal swap file command to increase swap size for Composer issues (beta)
#!/usr/bin/env bash
set -e # Abort if anything fails
echo "Checking current swap space..."
fin exec free -h
# Increase swap memory
echo "Creating 512M swap file..."
fin exec sudo dd if=/dev/zero of=/swapfile bs=1M count=512
@kyletaylored
kyletaylored / get_loc.js
Last active February 8, 2019 18:07
Get public ip location data using jQuery or Vanilla JS
// jQuery
(function($) {
$(document).ready(() => {
$.get("https://ipinfo.io/json").done((loc) => {
console.log(loc);
});
})
})(jQuery);
// Fetch (VanillaJS)