Skip to content

Instantly share code, notes, and snippets.

View GaryJones's full-sized avatar

Gary Jones GaryJones

View GitHub Profile
@GaryJones
GaryJones / .jscsrc
Last active November 2, 2018 19:49
JSCS config file
{
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"requireMultipleVarDecl": "onevar",
"requireSpacesInsideObjectBrackets": "all",
@GaryJones
GaryJones / .csscomb.json
Created July 5, 2014 08:35
CSScomb config file
{
"exclude": ["node_modules/**", "vendor/**"],
"verbose": true,
"always-semicolon": true,
"block-indent": "\t",
"colon-space": [0, 1],
"color-case": "lower",
"color-shorthand": true,
"combinator-space": [1, 1],
filter:
excluded_paths:
- 'vendor/*'
- 'tests/*'
- 'src/wp-admin/includes/class-ftp*'
- src/wp-admin/includes/class-pclzip.php
- 'src/wp-content/*'
- 'src/wp-includes/ID3/*'
- 'src/wp-includes/SimplePie/*'
- 'src/wp-includes/Text/*'
@GaryJones
GaryJones / gist:e680bf0544cead75a213
Created May 21, 2014 10:51
Handle is_front_page() edge case settings
<?php
/*
is_front_page() requires that if the static radio button is chosen, that
a page is assigned to the Front Page dropdown. Without the latter,
is_front_page() doesn't return true for /.
is_home() will return true for / in this case, but that also will be
true for the page assigned as the blog page which already has a title.
The check therefore needs to cover several factors.
@GaryJones
GaryJones / .csscomb.json
Last active November 2, 2018 19:49
[Replaced] CSSComb file for WP core.
See https://github.com/cedaro/grunt-wp-css/blob/develop/tasks/config/default.json
@GaryJones
GaryJones / poedit-questions.md
Last active August 29, 2015 14:01
POEdit Keyword Header Value questions

Thanks for looking :-)

I was looking at some typical POEdit keyword header value in WordPress plugins and themes - e.g.:

'__;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n';

There's several things wrong here, but the oddity is:

_c,_nc:4c,1,2

@GaryJones
GaryJones / my-plugin.js
Last active August 29, 2015 13:59
JavaScript module template for plugins
/* global myPluginL10n */
var myPlugin = ( function ( $ ) {
function myPrivateFunction() {
}
function getStuff( id ) { // Private function
var jqxhr = $.get( myPlugin.ajax_url + '?x=y&id=' + id );
@GaryJones
GaryJones / functions.php
Last active January 11, 2016 05:19
Default styles for HTML5 galleries and captions.
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
@GaryJones
GaryJones / x-core.php
Created March 8, 2014 20:25
Main file for core library plugin.
<?php
/**
* X Core Plugin
*
* @package X_Core
* @author Gary Jones <[email protected]>
* @license GPL-2.0+
* @copyright 2014 Gary Jones
*
* @wordpress-plugin
/**
* {{singular}} Custom Post Type.
*
* @package {{plural}}
* @author Your Name <[email protected]>
* @license GPL-2.0+
* @link http://www.blazersix.com/wordpress-code-generators/
*
* @todo Remove unused code and update where needed.
*