Skip to content

Instantly share code, notes, and snippets.

View swissspidy's full-sized avatar

Pascal Birchler swissspidy

View GitHub Profile
@ericandrewlewis
ericandrewlewis / gist:5962b31ca25c890badea
Created January 5, 2015 13:34
Create a media grid with a different order
window.wp.media({
frame: 'manage',
container: $mediaGridWrap,
library: {
orderBy: 'title',
order: 'ASC',
}
}).open();
@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."

@ericandrewlewis
ericandrewlewis / how-should-we-decide-what-features-to-bring-into-wordress-core.md
Last active August 29, 2015 14:11
How should we decide what features to bring into WordPress core?

How should we decide what features to bring into WordPress core?

I worked on the Media Grid feature for WordPress 4.0. I thought it was more or less a no-brainer that the feature made sense for core. So, I would be taken aback when a few committers and contributors asked questions like "What problem does this feature solve?" or "Which out of the 230 bugs in the Media Component does this fix?" Essentially, why. I found these conversations tricky to navigate. Even though I'd been contributing to the project for a few years, I was (and still am) getting my bearings on how to think about features for WordPress core.

@Rarst
Rarst / wp-core-contributors-by-version.php
Last active July 28, 2019 17:31
WordPress core contributors by version. Input data from https://api.wordpress.org/core/credits/1.1/?version=x.x
<?php
$data_dir = 'c:/server/www/dev/data/';
$releases = [ ];
foreach ( range( 3.2, 4.0, 0.1 ) as $version ) {
$version = number_format( $version, 1 );
$data = json_decode( file_get_contents( $data_dir . $version . '.json' ), true );
$groups = wp_list_pluck( $data['groups'], 'data' );
@deckerweb
deckerweb / gist:b7e70a52ed76b6486795
Last active August 8, 2021 02:39
WordPress Forms plugin comparison table - by David Decker (@deckerweb) of deckerweb.de
@mziwisky
mziwisky / Oauth2.md
Last active February 19, 2025 19:08
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.

@benwaldie
benwaldie / 2014-04-03 Send Keynote Presenter Notes to Evernote.applescript
Created April 3, 2014 14:14
This script sends presenter notes from a Keynote 6.2 presentation to Evernote.
--==============================
-- Send Keynote Presenter Notes to Evernote
-- Version 1.0.1
-- Written By: Ben Waldie <[email protected]>
-- http://www.automatedworkflows.com
-- Version 1.0.0 - Initial release
-- Version 1.0.1 - Updated for Keynote 6.2 compatibility
--==============================
@madrobby
madrobby / gist:9476733
Created March 10, 2014 23:34
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl -H 'Authorization: token INSERTACCESSTOKENHERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/owner/repo/contents/path
@gibrown
gibrown / gist:9419022
Created March 7, 2014 20:11
WP.com related posts query building
public static function post( $blog_id, $post_id, $mlt_fields = array( 'mlt_content' ), $analyzer = false ) {
switch_to_blog( $blog_id );
$post = get_post( $post_id );
$fld_bldr = new ES_WP_Field_Builder();
$tax_data = $fld_bldr->taxonomy( $post );
$mlt_content = $fld_bldr->mlt_content( array(
'title' => $fld_bldr->clean_string( $post->post_title ),
'content' => $fld_bldr->clean_string( $post->post_content ),
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/Sites/wp-plugins/$DIR_NAME/$BRANCH