Skip to content

Instantly share code, notes, and snippets.

Daniel Bachhuber danielbachhuber

Block or report user

Report or block danielbachhuber

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
@jdorfman
jdorfman / the-markers.md
Last active Dec 2, 2018
The markers that show that the future of Open Source might not be as good as it is today.
View wp-api-select2.js
this.$el.find( '.taxonomy-terms' ).select2({
multiple: true,
ajax: {
url: WP_API_Settings.root + 'wp/v2/terms/' + this.options.taxonomy.slug,
data: function( term, page ) {
return {
search: term,
page: page,
_envelope: true
}
@kingkool68
kingkool68 / pew-infinite-scroll.js
Last active Jan 4, 2018
Plugin for handling the URLs to make infinite scrolling work properly on pages like this http://www.pewresearch.org/category/publications/
View pew-infinite-scroll.js
jQuery(document).ready(function() {
//Set-up some constants.
var scrollTimeout;
var scrollUsePushStateInstead = false; //Set to true to make the history stack of the browser include every point when posts were loaded. It's kind of annoying.
var scrollDelay = 200; //Milliseconds
var scrollLoading = false;
var triggerOffset = $(document).height() - $('#pagination').siblings().eq(-4).offset().top; //The point of this is to do one calculation up front instead of multiple calculations every time the infinite scroll is triggered.
// Simple feature detection for History Management (borrowed from Modernizr)
function supportsHistory() {
View .zshrc
v() {
DIR=`echo $PWD | sed 's,.*/projects,,'`
ARGS=$*
ssh -t vagrant@192.168.50.10 "cd /srv/www${DIR} ; ${ARGS}" 2> /dev/null
}
alias wp="v wp"
alias grunt="v grunt"
@markjaquith
markjaquith / gist:6225805
Last active Feb 19, 2019
WordPress multi-tenant directory structure sharing core files for opcode awesomeness, fast deployments, and low disk usage. With inspiration from @weskoop. "=>" indicates a symlink.
View gist:6225805
sites
|__ ms.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
| |__ wp-config.php
|__ one.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
@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:
@westonruter
westonruter / WordPress-Dependencies.md
Last active Oct 11, 2016
Gathering posts about the development of a core dependency system for WordPress.
View WordPress-Dependencies.md

I've been noticing that there seems to be a lot of interest and momentum lately surrounding plugn/theme dependencies. I am very excited about this. WordPress desperately needs a core dependency solution so that we can move the route of plugins being tiny interoperable building blocks, like what we've seen with NPM.

Here's a running list of the stuff I've been seeing lately about WordPress dependencies:

Dependencies. Allow plugins and themes to be dependent of one another. A theme could require a plugin or example, and WordPress would handle installing that plugin when you install that theme. Similar idea: Compatibility metrics. (Or: Can we be sure it is safe to upg

@kingkool68
kingkool68 / Seamless Git Deployment
Last active Dec 17, 2015
To push code changes to text servers I do this.
View Seamless Git Deployment
We have a private Git running on a server somewhere which we consider our central repository. Inside the .git/hooks/post-recieve is the following:
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
@johnpbloch
johnpbloch / Vagrantfile
Created Apr 16, 2013
Puppet awesomesauce for Vagrant
View Vagrantfile
config.vm.provision :puppet do |puppet|
# Add a folder in your root named .ppt
puppet.manifests_path = ".ppt/manifests"
# vagrant.pp is your main manifest and goes in .ppt/manifests
puppet.manifest_file = "vagrant.pp"
# Add puppet modules in .ppt/modules as git submodules; they will be pre-installed in Vagrant this way
puppet.module_path = ".ppt/modules"
# Config files, etc. go in .ppt/files. fileserver.conf (see below) defines the path for puppet to add
# when looking for files. That way, you can reference files with puppet:// protocols. Make sure you
# add the directory defined in fileserver.conf as a shared directory in the main Vagrantfile config
@johnbillion
johnbillion / gist:5225514
Last active May 29, 2019
Post Meta Revisions
View gist:5225514
<?php
/*
Plugin Name: Post Meta Revisions
Description: Revisions for the 'foo' post meta field
Version: 1.0
Author: John Blackbourn
Plugin URI: http://lud.icro.us/post-meta-revisions-wordpress
*/
You can’t perform that action at this time.