Skip to content

Instantly share code, notes, and snippets.

View kalenjohnson's full-sized avatar

Kalen Johnson kalenjohnson

View GitHub Profile
@kalenjohnson
kalenjohnson / cherry-pick-git
Created April 25, 2015 23:19
Cherry pick upstream to subdirectory
git cherry-pick -Xsubtree=<subdirectory> 517be2a88318de51f51397066575ab07fae825a1 --strategy=recursive -X <theirs>
var gulp = require('gulp'),
less = require('gulp-less'),
autoprefix = require('gulp-autoprefixer'),
sourcemaps = require('gulp-sourcemaps'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
livereload = require('gulp-livereload'),
@kalenjohnson
kalenjohnson / gist:0e5805894a75bcec0204
Last active June 1, 2016 20:36
Codeship Deploy to WPEngine
REMOTE_REPOSITORY=${REMOTE_REPOSITORY:?'You need to configure the REMOTE_REPOSITORY environment variable!'}
REMOTE_BRANCH=${REMOTE_BRANCH:?'You need to configure the REMOTE_BRANCH environment variable!'}
set -e
git fetch --unshallow || true
git push ${REMOTE_REPOSITORY} ${CI_COMMIT_ID}:${REMOTE_BRANCH}
cd wp-content/themes/<theme>
npm install -g bower gulp
npm install
bower install
gulp --production
@kalenjohnson
kalenjohnson / wp_all_posts_in_category
Created December 6, 2013 22:30
Wordpress Show all posts in each category
<?php
$category_IDs = get_all_category_ids();
// Loop through categories
foreach ( $category_IDs as $category_ID ) :
$query = new WP_Query( array(
'cat' => $category_ID,
'posts_per_page' => - 1,
) );
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
### Keybase proof
I hereby claim:
* I am kalenjohnson on github.
* I am kalenjohnson (https://keybase.io/kalenjohnson) on keybase.
* I have a public key whose fingerprint is C700 BAD5 FD8D 6FFF DEB1 FF1F F24E 0E71 AC8E 1CDE
To claim this, I am signing this object:
@kalenjohnson
kalenjohnson / row.php
Created June 12, 2015 18:21
Row Helper
<?php
/**
* Keep track of the amount of items in a row, and add another .row when necessary
*
* @param int $i
* @param int $item_count
* @param string $class_name
*
* @return bool|string
var affix = $('#affix-container');
affix.affix({
offset: {
top: function() {
if ($('#carousel-motivate').length !== 0) {
if ($('body').hasClass('admin-bar')) {
return (
$('#wpadminbar').outerHeight() +
@kalenjohnson
kalenjohnson / titles.php
Created February 3, 2015 20:16
Sage Title with namespace
<?php
namespace Roots\Sage\Titles;
/**
* Page titles
*/
function title() {
if (is_home()) {
if (get_option('page_for_posts', true)) {
class autoloader {
public static $loader;
public static function init()
{
if (self::$loader == NULL)
self::$loader = new self();
return self::$loader;