Skip to content

Instantly share code, notes, and snippets.

View montchr's full-sized avatar
🎢

chris montgomery montchr

🎢
View GitHub Profile
@montchr
montchr / phpvm.sh
Created August 4, 2021 15:30
phpvm :: A rudimentary version manager for Homebrew-installed PHP versions.
#!/usr/bin/env bash
#
# phpvm
#
# A rudimentary version manager for Homebrew-installed PHP versions.
#
# @TODO run composer update?
# @TODO consider offerring to attempt a patch version upgrade
VERSION="$1"
@montchr
montchr / stylish-facebook.css
Created August 28, 2016 17:08
Hide Facebook Trending Topics
/* Hide Trending topics panel */
#pagelet_trending_tags_and_topics {
display: none;
}
@montchr
montchr / Gruntfile.js
Last active August 20, 2016 15:49
Sass color segfaults
module.exports = function(grunt) {
var SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler("crash.log");
grunt.initConfig({
sass: {
options: {
includePaths: [
@montchr
montchr / changelog.sh
Created July 6, 2016 20:00 — forked from kingkool68/changelog.sh
Bash script to generate a markdown change log of GitHub pull requests between tagged releases
#!/bin/bash
# Generate a Markdown change log of pull requests from commits between two tags
# Author: Russell Heimlich
# URL: https://gist.github.com/kingkool68/09a201a35c83e43af08fcbacee5c315a
# HOW TO USE
# Copy this script to a directory under Git version control
# Make the script executable i.e. chmod +x changelog.sh
# Run it! ./changelog.sh
# Check CHANGELOG.md to see your results
@montchr
montchr / is_assoc.php
Last active August 29, 2015 14:14
PHP check for array type
<?php
/**
* Check to see if the supplied array is associative.
*
* @link http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
* @return bool True if is associative, false if non-associative.
*/
function is_assoc($array) {
return (bool)count(array_filter(array_keys($array), 'is_string'));
@montchr
montchr / esemci-smc-typestax.php
Last active August 29, 2015 14:05
SMC: Esemci: Types and Taxonomies
<?php
/*
Plugin Name: Esemci: SMC (Main Site): Types and Taxonomies
Plugin URI: https://gist.github.com/montchr/b5806349e64f48b808b6
Description: Defines custom taxonomies and custom post types for the main SMC site (https://smc.temple.edu/).
Version: 0.1.0
Author: Chris Montgomery
Author URI: https://github.com/montchr
License: GPLv3
*/
@montchr
montchr / SMC-User-Migration.md
Last active August 29, 2015 14:01
Get a list of WordPress usernames and the number of posts attributed to them on the current site.

Export Users (Live WPEngine Site)

  1. Go to the specific site's Dashboard and click Users → Export User Data.
  • Select the following user meta fields to export:
    • Description
    • First name
    • Last name
    • LDAP login
    • Nickname
  • Change format to CSV.
<?php
/**
* Generates a domain-mapping safe URL on WordPress.com
* Core's ajaxurl uses admin_url() which returns *.wordpress.com which doesn't work for the front-end on domain-mapped sites.
* This works around that and generates the correct URL based on context.
*/
function my_admin_ajax_url( $path = '' ) {
if ( is_admin() )
$url = admin_url( 'admin-ajax.php' );
else
#!/bin/sh
libs=( "/usr/local/lib/libmacfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i64.2.dylib" \
"/usr/local/lib/libmacfuse_i64.2.dylib" \
"/usr/local/lib/libosxfuse_i32.la" \
"/usr/local/lib/libosxfuse_i64.la" \
"/usr/local/lib/pkgconfig/osxfuse.pc" )
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
program_is_installed () {
# set to 1 initially
local return_=1