Skip to content

Instantly share code, notes, and snippets.

<?
/**
* Determine if user can access invoice.
* @param WP_Post $invoice
* The invoice to check.
* @return boolean
* TRUE if user can access invoice.
*/
function can_access_invoice ($invoice) {
global $current_user;
function getDevice () {
var UA = navigator.userAgent;
var device = {};
device.isOldIE = UA.match(/MSIE\s[678]/);
device.isKindle = UA.match(/Kindle|Silk/i);
device.isAndroid = UA.match(/Android/i) && !device.isKindle;
device.isiOS = UA.match(/iPhone|iPad|iPod/i);
device.isUnsupportedMobile = (UA.match(/mobile|opera m/i) || device.isKindle) &&
!device.isiOS && !device.isAndroid;
return device;

Creating a culture a performance -- @iancarrico @rupl

For a small site, some slightly larger sites, none of this is mind-blowingly difficult it's just a matter of setting it up and commiting to it. @tsmith512

Getting everyone on board w/ performant on board w/ peformance.

Buy in at all levels

  • CXO - How will this effect our bottom line? People will stay around longer if website is quicker, more responsive. Loads ads more quickly. More pages, more ads
  • Product Owner - "We don't have time to work on performance" - Document in backlog to defer work to later. "Responsive cannot be performant" - Study "responsive" adds ~10% more code, and good techniques (lazy load images) take care of perf better.
diff --git a/docroot/profiles/publisher/modules/custom/pub_mpx/pub_mpx.module b/docroot/profiles/publisher/modules/custom/pub_mpx/pub_mpx.module
index 6b5441b..d973eda 100644
--- a/docroot/profiles/publisher/modules/custom/pub_mpx/pub_mpx.module
+++ b/docroot/profiles/publisher/modules/custom/pub_mpx/pub_mpx.module
@@ -1957,7 +1957,7 @@ function pub_mpx_date_combo_process_alter(&$element, &$form_state, $context) {
if (!$mpx_value_overrides_enabled) {
- $element['#disabled'] = TRUE;
+ // $element['#disabled'] = TRUE;
@robcolburn
robcolburn / set-mod-date.sh
Created June 3, 2015 19:15
Set the modification date / creation date of a set of photos to their filenames
# example 20150502_114929.jpg was taken on 2015-05-02 at 11:49:29
for f in *.jpg; do t=$(echo $f | sed -E 's/20([0-9]{6})_([0-9]{6}).jpg/\1\2/'); done
`exiftool` fix dates
```sh
exiftool "-FileModifyDate<DateTimeOriginal" "-FileCreateDate<FileModifyDate" .
```
`exiftool` commit
```sh
rm *._original
```
@robcolburn
robcolburn / ios9-applink.html
Last active September 23, 2015 17:38
1. Apple added prompts to every interaction with app links. 2. Apple also introduced to prevent js-circular redirects (every time you re-open safari it tries to re-open that app).
const {createStore} = require('redux');
const mapValues = require('lodash/object/mapValues');
const get = require('lodash/object/get');
const initialState = (typeof window !== "undefined" && window.PRELOAD) || {};
const reducers = {};
function serializeable(value) {
return (
value instanceof Error ? {error: value.stack}
@robcolburn
robcolburn / create-load.js
Last active November 19, 2015 19:21 — forked from jakerella/create-load.js
Simple load generation script to test web applications.
/**
* This script helps to artifically generate load on a web application through
* weighted requests to various endpoints. It may not be pretty, but it works
* for me. :) Feel free to use however you want.
*
* NOTE: Please use responsibly, don't run this script against a production server!
*
* @author Jordan Kasper (@jakerella)
* @license MIT
*/
diff --git a/applications/responsive/ShowPage/ShowPage.js b/applications/responsive/ShowPage/ShowPage.js
index af588ae..0adbee3 100644
--- a/applications/responsive/ShowPage/ShowPage.js
+++ b/applications/responsive/ShowPage/ShowPage.js
@@ -13,7 +13,7 @@ import recordPageView from '../../../lib/recordPageView';
import {isClassic, isTonightShowClassic} from '../../../lib/getShowType';
import derivativeSrc from '../../../lib/derivativeSrc';
import derivativeSrcSet from '../../../lib/derivativeSrcSet';
-import {getRelationship} from '../../../utils/jsonAPIHelpers';
+import {getRelationship, getRelationships, getDeepRelationship} from '../../../utils/jsonAPIHelpers';