Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working with the amazing team at Landing. #liveeverywhere

Sterling Hamilton grok

🏠
Working with the amazing team at Landing. #liveeverywhere
View GitHub Profile
View gist:d4c2044e95cc761d685d
/**
* Excludes our theme from the WordPress update API calls.
*
* @param array $request The arguments used in an HTTP request
* @param string $url The request URL.
* @return array $request The arguments used in an HTTP request.
*/
public function excludeFromThemeUpdates($request, $url)
{
if(0 !== strpos($url, 'https://api.wordpress.org/themes/update-check'))
@grok
grok / bookmarklet.js
Last active Aug 29, 2015
Replicon Bookmarklet
View bookmarklet.js
javascript:(function(){var rows=jQuery('iframe#body').contents().find('.timesheet tr[type="time"]');rows.splice(-1,1);jQuery.map(rows,function(value,key){var that=value;var task=jQuery(value).find('.rowTask .taskPartName');var billing=jQuery(value).find('.rowBilling .additional');var task_number=jQuery(task).text().match(/\d{4}/g);var billing_numbers=jQuery(billing).text().match(/\d{4}/g);if(jQuery(billing_numbers).last().get(0)!==jQuery(task_number).last().get(0)){jQuery(that).css('background-color','#F26B6B');}else{jQuery(that).css('background-color','#6BD2F5');}});})();
@grok
grok / gist:e55e4ae71064a708c0d3
Created Oct 24, 2014
JIRA -- Subtasks get remaining hours.
View gist:e55e4ae71064a708c0d3
jQuery('.issuerow .progress').click(function() {
var estimates = jQuery(this).find('img');
var hours = '';
jQuery(estimates).each(function() {
if(typeof(jQuery(this).attr('title')) != 'undefined') {
hours = hours + jQuery(this).attr('title') + "\n";
}
});
alert(hours);
});
@grok
grok / after.css
Created Jun 24, 2014
This is a possible solution for the overlapping on the Tesla Pre-Owned page. Example: http://imgur.com/ZoqZ1pr
View after.css
.view-preowned-listing-page {
padding: 70px 18px;
}
View brandonsucks.js
var states = {
'online' : 'offline',
'offline' : 'online',
'trial' : 'term',
'term' : 'trial',
'active' : 'expired' ,
'expired' : 'active'
};
var button = $('.trigger');
View gitflow.md

WordPress and WorkFlows

By: Sterling Hamilton

From time to time we invite developers who are doing interesting things on Pantheon to share what they are doing with others. This time Sterling Hamilton of Noble Studios is sharing with us what he and his team have learned about using Pantheon and workflows with WordPress.

Git Workflows

The many combinations for workflows your team can use, will no doubt make it difficult in deciding how to begin working with WordPress on Pantheon. This article is intended to provide you a an example of a simple workflow for maintaining your WordPress installation.

As you read through, remember that this is not the "end all be all" solution. This is a guideline intended to give you an immediate path to follow. You can alter, or come up with alternatives down the road.

View gitflow.md

Git Workflows

The many combinations for workflows your team can use, will no doubt make it difficult in deciding how to begin working with WordPress within Pantheon. This is intended to provide you a simple workflow for maintaining your WordPress intallation.

As you read through, remember that this is not the "end all be all" solution. This is a guideline intended to give you an immediate path to follow. You can alter, or come up with alternatives down the road.

Assumptions

  • You have created a new website.
  • You are using a WordPress distribution.
  • You have switched your connection mode to Git.
@grok
grok / gist:f1f3ecc29859ee4679b1
Created May 12, 2014
setcookie() in WordPress 3.9.1
View gist:f1f3ecc29859ee4679b1
./wp-admin/post.php: setcookie( 'wp-saving-post-' . $post_id, 'saved' );
./wp-includes/class-snoopy.php: $this->setcookies();
./wp-includes/class-snoopy.php: $this->setcookies();
./wp-includes/class-snoopy.php: Function: setcookies()
./wp-includes/class-snoopy.php: function setcookies()
./wp-includes/comment.php: setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
./wp-includes/comment.php: setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
./wp-includes/comment.php: setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
./wp-includes/option.php: setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH );
./wp-includes/option.php: setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECO
@grok
grok / get-admin-post-id.php
Created Apr 30, 2014
This is a really lame way to get the WordPress Post ID when on the administration screen.
View get-admin-post-id.php
<?php
// ...
// This should NOT be this difficult ... but at the moment it's what we have.
private function _get_admin_post_id()
{
return absint(isset($_GET['post']) ? $_GET['post'] : (isset($_POST['post_ID']) ? $_POST['post_ID'] : 0));
}
@grok
grok / git-update.sh
Created Apr 28, 2014
This was an old script I wrote, I later converted to ruby: https://github.com/grok/script-update-repositories
View git-update.sh
#!/bin/bash
# This is where I want my script to start.
cd ~/Projects/
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all directories here - that are at least 1 level down, but don't go any further than 1 directory.
# Go into those directories and pull the repository.