Skip to content

Instantly share code, notes, and snippets.

Weston Ruter westonruter

Block or report user

Report or block westonruter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ericandrewlewis
ericandrewlewis / a.md
Last active Apr 27, 2019
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."

@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 Feb 16, 2019
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 Nov 8, 2019
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 Dec 20, 2015
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...
}
@tomjn
tomjn / gist:6140601
Last active Dec 20, 2015
If you're lucky enough to be using any version of PHP 5 with WordPress ( 100% chance! ) You can do this:
View gist:6140601
<?php
$posts = new posts_loop();
foreach( $posts as $id => $post ) {
the_title();
// etc...
}
// put this below in your functions.php:
@tomjn
tomjn / gist:6140172
Last active Dec 20, 2015
If you're lucky enought o be running WordPress on PHP 5.5, you can use generators for your post loops like this
View gist:6140172
<?php
// with the above we can now do things like this:
foreach ( posts_loop() as $p ) {
get_template_part( 'content', 'page' );
comments_template( '', true );
}
// put this below in your functions.php:
You can’t perform that action at this time.