Skip to content

Instantly share code, notes, and snippets.

🍝
unfurling wet spaghetti

Kyle Taylor kyletaylored

🍝
unfurling wet spaghetti
Block or report user

Report or block kyletaylored

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kyletaylored
kyletaylored / sitemapper.php
Last active May 14, 2019
just scratch pad for now
View sitemapper.php
<?php
if (php_sapi_name() == 'cli' && empty($argv[1])) {
dd("Pass a file name as an argument. \n\n ./index.php filename.csv");
}
//*********** Sitemap Processor Class ***********
class SitemapProcessor {
private $paths;
private $json;
@kyletaylored
kyletaylored / .codeclimate.yml
Created Apr 25, 2019
Codeclimate base for Drupal 7
View .codeclimate.yml
---
version: "2"
plugins:
phpmd:
enabled: true
config:
file_extensions:
- php
- inc
- module
@kyletaylored
kyletaylored / go.sh
Created Apr 22, 2019
Combine access.log files and run GoAccess report at the same time.
View go.sh
input="goaccess.log"
output="goaccess.html"
touch $input
for var in "$@"
do
cat $var >> $input
done
goaccess $input -o $output --log-format=COMBINED
@kyletaylored
kyletaylored / parser.php
Created Apr 19, 2019
Sitemap XML De-duplicator
View parser.php
<?php
$xml=simplexml_load_file("sitemap.xml") or die("Error: Cannot create object");
$storage = [];
$xmltxt = fopen("xml.txt", "w");
$count = $skipped = 0;
// Normalize and remove duplicates.
foreach ($xml as $sxe) {
$count++;
$loc = strtolower($sxe->loc);
@kyletaylored
kyletaylored / loader.js
Last active Feb 14, 2019
Load scripts with JS
View loader.js
// Load JS function
var loadJS = function(url, callback){
var scriptTag = document.createElement('script');
scriptTag.src = url;
scriptTag.onload = callback;
scriptTag.onreadystatechange = callback;
document.body.appendChild(scriptTag);
};
// Load CSS function
@kyletaylored
kyletaylored / get_loc.js
Last active Feb 8, 2019
Get public ip location data using jQuery or Vanilla JS
View get_loc.js
// jQuery
(function($) {
$(document).ready(() => {
$.get("https://ipinfo.io/json").done((loc) => {
console.log(loc);
});
})
})(jQuery);
// Fetch (VanillaJS)
@kyletaylored
kyletaylored / swap.sh
Last active Dec 10, 2018
Docksal swap file command to increase swap size for Composer issues (beta)
View swap.sh
#!/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 / app.js
Last active Oct 4, 2018
Venom extractor
View app.js
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 => {
View lift-example.js
// ==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 / dom-loaded-test.html
Last active Sep 17, 2018 — forked from passcod/dom-loaded-test.html
onload, readyState, and DOMContentLoaded
View dom-loaded-test.html
<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function () {
console.log(''+(+new Date)+': Onload fired');
};
document.onreadystatechange = function () {
console.log(''+(+new Date)+': Ready state changed');
You can’t perform that action at this time.