Skip to content

Instantly share code, notes, and snippets.

Avatar

Weston Ruter westonruter

View GitHub Profile
View ZenHub-Extract-Release-Items.js
(( items ) => {
const lines = [];
for ( const item of items ) {
const title = item.querySelector('.zhc-issues-list-item__title > a').textContent;
const number = item.querySelector('.zhc-issues-list-item__issue_number').textContent;
const isPullRequest = Boolean( item.querySelector( '.zhc-icon--pull-request-closed' ) || item.querySelector( '.zhc-icon--pull-request-open' ) );
lines.push( `${number} [${isPullRequest ? 'PR' : 'IS'}] ${title}` );
}
@ericandrewlewis
ericandrewlewis / a.md
Last active Oct 27, 2020
The WordPress Customizer
View a.md

The WordPress Customizer

The WordPress Customizer is an interface for drafting changes to content while previewing the changes before they are saved. This is an alternative to the "save and suprise" model of changing settings without knowing what exactly will happen.

The customizer can be accessed in the admin interface under Appearance > Customize.

A screenshot of the customizer

#19909 is the trac ticket that introduced the Customizer during the 3.4 release cycle.

@ericandrewlewis
ericandrewlewis / gist:a1b127aefbd58c210666
Last active Jan 19, 2019
Towards a data model for scalable queries against rich WordPress post attribute data
View gist:a1b127aefbd58c210666

Towards a data model for scalable queries against rich WordPress post attribute data

This document is in draft status, and is being made available for peer review. If you have feedback, comment on this gist or email me.

Let's say you're a web developer. A client of yours is a gemstone dealer in Manhattan. This dealer has an inventory of gemstones that they'd like to put on their website.

Gemstones have a plethora of attributes: type of gemstone (e.g. sapphire or emerald), price, weight, width, height, depth, color, shape, country of origin, treatment (if it's heat treated), who certified these details, whether the stone is a single stone or a pair.

You're offered the task to make a website to display the gemstone inventory, which will include a search interface. So a user can say "I want to see sapphires that are no heavier than 1.33 karats that are oval, between $750 and $1250, between 1.11mm and 1.20mm that weren't heat treated, because heat treatment is cheap."

@discordier
discordier / gist:ed4b9cba14652e7212f5
Created Dec 4, 2014
options for phpStorm @noinspection annotation
View gist:ed4b9cba14652e7212f5
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@shadyvb
shadyvb / gist:df5116bf8634f017ca06
Last active Aug 29, 2015
Git+SVN steps/script
View gist:df5116bf8634f017ca06
# Update from SVN repo
svn up
# Commit the updates into Git repo, using the last revision id of SVN
git add .; git commit -m r`svn info $url | grep 'Last Changed Rev' | awk '{ print $4; }'` -n
# Merge the feature branch, after CR
git merge origin/FEATURE-BRANCH
# Run grunt or any pre-svn-commit steps
@franz-josef-kaiser
franz-josef-kaiser / MinFilterIterator.php
Last active Jan 18, 2021
An example plugin to show the use of the PHP SPL and subsidiary loops with a FilterIterator.
View MinFilterIterator.php
<?php
// Reduced to the minimum
class ThumbnailFilter extends FilterIterator
{
private $wp_query;
public function __construct( Iterator $iterator, WP_Query $wp_query )
{
NULL === $this->wp_query AND $this->wp_query = $wp_query;
parent::__construct( $iterator );
@mcfadden
mcfadden / Instructions.md
Created Oct 19, 2013
Making an IP camera with the Raspberry Pi Including on-board motion detection, and a password protected web server for viewing the camera stream
View Instructions.md

Making an IP camera with the Raspberry Pi

Including on-board motion detection

Requirements

  • Raspberry Pi (512MB rev2 recommended)
  • Raspberry Pi Camera board
  • SD Card (min 2BG, 8GB recommended for good measure. Class 10)

Optionally, a wifi adapter verified to work with raspberry pi ( I used Edimax Wireless Nano USB Adapter - http://www.amazon.com/gp/product/B005CLMJLU/ )

@jeremyfelt
jeremyfelt / hide-inactive-jetpack-modules.php
Last active Dec 26, 2015
Hide inactive Jetpack modules
View hide-inactive-jetpack-modules.php
<?php
/*
Plugin Name: Hide Inactive Jetpack Modules
Plugin URI: https://gist.github.com/jeremyfelt/7062883
Description: Hides Jetpack modules that are marked as inactive, providing for a shorter list.
Version: 0.1
Author: Jeremy Felt
Author URI: http://jeremyfelt.com
License: GPL2
*/
@jbenet
jbenet / simple-git-branching-model.md
Last active Apr 1, 2021
a simple git branching model
View simple-git-branching-model.md

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@tomjn
tomjn / gist:6140909
Last active Feb 21, 2020
If you're thinking of using WP_Query, try using this iterator instead, cleaner boilerplate, auto-cleans up after itself
View gist:6140909
<?php
$pages = new query_loop( array(
'post_type' => 'page'
));
foreach( $pages as $id => $post ) {
the_title();
// etc...
}