Skip to content

Instantly share code, notes, and snippets.

View kalenjohnson's full-sized avatar

Kalen Johnson kalenjohnson

View GitHub Profile
### 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
@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 / 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 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;
class InstagramFeed {
protected $keys;
public function __construct($user_id, $access_code)
{
$this->keys = [
'user_id' => $user_id,
'access_code' => $access_code,
];
add_action('plugins_loaded', 'remove_jetpack_widget_conditions',11);
function remove_jetpack_widget_conditions(){
remove_action( 'init', array('Jetpack_Widget_Conditions','init') );
}
wp_enqueue_script('duchateau_js', get_template_directory_uri() . $assets['js'], array(), null, true);
wp_localize_script( 'duchateau_js', 'wp_api', array(
'url' => esc_url_raw(get_json_url()),
'theme' => esc_url_raw(get_template_directory_uri())
) );