Skip to content

Instantly share code, notes, and snippets.

View danielbachhuber's full-sized avatar

Daniel Bachhuber danielbachhuber

View GitHub Profile
@jdorfman
jdorfman / the-markers.md
Last active June 11, 2020 16:59
The markers that show that the future of Open Source might not be as good as it is today.
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 January 4, 2018 21:27
Plugin for handling the URLs to make infinite scrolling work properly on pages like this http://www.pewresearch.org/category/publications/
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() {
@joehoyle
joehoyle / .zshrc
Last active December 22, 2015 22:19
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 February 21, 2024 23:56
WordPress multi-tenant directory structure sharing core files for opcode awesomeness, fast deployments, and low disk usage. With inspiration from @weskoop. "=>" indicates a symlink.
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 December 20, 2015 13:39
If you're lucky enought o be running WordPress on PHP 5.5, you can use generators for your post loops like this
<?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 October 11, 2016 22:43
Gathering posts about the development of a core dependency system for WordPress.

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:

  • Strategies to implement selective loading of plugins on StackExchange
  • Nacin's suggestion that Dependencies be tackled for GSoC: > 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 December 17, 2015 05:09
To push code changes to text servers I do this.
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 April 16, 2013 03:21
Puppet awesomesauce for Vagrant
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 12:56
Post Meta Revisions
<?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
*/