Skip to content

Instantly share code, notes, and snippets.

View westonruter's full-sized avatar

Weston Ruter westonruter

View GitHub Profile
(( 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 October 27, 2020 18:44
The WordPress Customizer

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 January 19, 2019 00:02
Towards a data model for scalable queries against rich WordPress post attribute data

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 December 4, 2014 06:23
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@shadyvb
shadyvb / gist:df5116bf8634f017ca06
Last active August 29, 2015 14:10
Git+SVN steps/script
# 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 January 18, 2021 19:15
An example plugin to show the use of the PHP SPL and subsidiary loops with a FilterIterator.
<?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 October 19, 2013 23:54
Making an IP camera with the Raspberry Pi Including on-board motion detection, and a password protected web server for viewing the camera stream

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 December 26, 2015 00:19
Hide inactive Jetpack modules
<?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 April 9, 2024 03:31
a simple git branching model

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 February 21, 2020 06:35
If you're thinking of using WP_Query, try using this iterator instead, cleaner boilerplate, auto-cleans up after itself
<?php
$pages = new query_loop( array(
'post_type' => 'page'
));
foreach( $pages as $id => $post ) {
the_title();
// etc...
}