Skip to content

Instantly share code, notes, and snippets.

View montchr's full-sized avatar
I may be slow to respond.

chris montgomery montchr

I may be slow to respond.
View GitHub Profile
@montchr
montchr / 0_reuse_code.js
Created March 9, 2014 17:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@montchr
montchr / README.md
Created March 11, 2014 02:47
Webdev Resources

Web development on a Mac

Requirements

  • Mac OS X 10.8.4+

Prep

  1. Install the latest version of Xcode 5 (currently 5.0.2) from Downloads for Apple Developers or,
#!/bin/bash
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.
#!/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
#!/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" )
<?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
@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.
@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 / 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 / readme.md
Last active December 21, 2015 11:28
Enqueuing styles for WP child theme

Parent

Line 9 of lib/enqueue-sass.php:

Currently:

wp_register_style( 'esemci-stylesheet', get_template_directory_uri() . '/css/style.css', array(), '', 'all' );