Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Matt Thomas betweenbrain

💭
I may be slow to respond.
View GitHub Profile
View customize WordPress toolbar 5
function remove_toolbar_items($wp_adminbar) {
$wp_adminbar->remove_node('wpseo-menu');
}
add_action('admin_bar_menu', 'remove_toolbar_items', 999);
@65
65 / mailchimp-googlescript.txt
Last active Jan 15, 2022
On Google Spreadsheet / Google Form submission, push new entry to a MailChimp subscription list with an `onformsubmit` trigger. Uses the MailChimp 3.0 API and Google Apps Script.
View mailchimp-googlescript.txt
/**
* Mailchimp API v3
* Add a subscriber to a list with interests on Google Form submit
*
* Updated to 3.0 from https://gist.github.com/acarrillo/5772508
*
* Edit the Google Sheet connected to your form
* Menu > Tools > Script Editor
* Copy and paste this into the file, remove anything there already
* Update the variables in the top section
@creimers
creimers / apollo-angular1-query.js
Created Mar 7, 2017
a basic example of how to use an apollo query with variables and angular 1
View apollo-angular1-query.js
queryJobs() {
const jobQuery = gql`
query($city: String) {
jobs(city: $city){
id
title
teaser
imageSmall
published
}
@599316527
599316527 / directive-delay-execute.js
Last active Aug 29, 2020
Vue.js directive: delay execute
View directive-delay-execute.js
var Vue = require('vue');
Vue.directive('delay-execute', {
acceptStatement: true,
bind: function () {
this._delayRunTimeout = parseInt(this.arg, 10) || 1000;
},
update: function (handle) {
this.reset();
this._delayRunTimer = setTimeout(handle, this._delayRunTimeout);
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active Sep 11, 2022
Uninstall nodejs from OSX Yosemite
View gist:d75101d9bdf764c890ef
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@brock
brock / nodereinstall.sh
Last active Aug 24, 2022
Complete Node Reinstall. I've moved this to a repo at http://git.io/node-reinstall
View nodereinstall.sh
#!/bin/bash
# node-reinstall
# credit: http://stackoverflow.com/a/11178106/2083544
## program version
VERSION="0.0.13"
## path prefix
PREFIX="${PREFIX:-/usr/local}"
@scotthorn
scotthorn / viewport-shots.js
Last active Jun 29, 2020
Nightwatch.js script for taking screenshots of a given URL at various browser widths.
View viewport-shots.js
/*
* Takes provided URL passed as argument and make full height screenshots of this page
* with several viewport widths using Nightwatch.js with Selenium.
*
* These viewport widths are taken from common android and iOS devices. Modify as needed.
*
* Takes an optional second argument for the path where screenshots are saved.
*
* Usage:
* $ nightwatch -t viewport-shots.js http://example.com
@CrowderSoup
CrowderSoup / find_replace.js
Created Feb 19, 2014
Replace all instances of a substring without Regex in JavaScript
View find_replace.js
var str = 'This is a test string.';
// Let's replace all spaces with ','
str = str.split(' ').join(',');
@umaar
umaar / webdriver-hover.js
Created Feb 17, 2014
Hover over an element in WebDriverJS
View webdriver-hover.js
/*
* Hover over an element on the page
*/
(function() {
"use strict";
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().usingServer().withCapabilities({'browserName': 'chrome' }).build();
@gunjanpatel
gunjanpatel / jdatabase.md
Last active Aug 27, 2021
Write subquery in Joomla 3 using JDatabase method.
View jdatabase.md

Here is an example of write subquery in Joomla! 3 using JDatabase method.

<?php
// Initialize variables.
$db       = JFactory::getDbo();
$subQuery = $db->getQuery(true);
$query    = $db->getQuery(true);

// Create the base subQuery select statement.