Skip to content

Instantly share code, notes, and snippets.

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 25, 2025 12:52 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
@Vheissu
Vheissu / functions.php
Created October 22, 2012 02:36
Bundling the Advanced Custom Fields plugin into a theme using the TGM Plugin Class
add_action( 'tgmpa_register', 'register_required_plugins' );
// This function is called from the above hook
function register_required_plugins()
{
// The plugins array allows us to define multiple plugins we want to include.
// The commented out example shows how we can include and activation a bundled
// plugin zip file in our theme.
$plugins = array(
/* array(
@thefuxia
thefuxia / t5-wp-load-order.php
Created November 11, 2012 14:31
T5 WP Load Order
<?php
/**
* Plugin Name: T5 WP Load Order
* Description: Hooks into every action and creates a list of available variables, constants, functions, classes and files.
* Plugin URI:
* Version: 2012.11.05
* Author: Thomas Scholz
* Author URI: http://toscho.de
* Licence: MIT
* License URI: http://opensource.org/licenses/MIT
@maurotdo
maurotdo / xdebug.sh
Created May 23, 2013 11:32
Simple bash script to turn on & off Xdebug extension Based on homebrewed php-xdebug extension
#!/bin/bash
#
# Script to turn xdebug on and off
# Permission to copy and modify is granted under the MIT license
# Last revised 2013-05-23
# Mauro Maggi <maurotdo (at) gmail (dot) com>
PHP=$(which php)
BREW=$(which brew)
XDEBUG=$($PHP -i | grep -i xdebug | grep -i enabled)
@danguita
danguita / osx-development-setup.md
Last active June 2, 2016 13:37
Set up your shiny OSX for development
@randyjensen
randyjensen / acf-dynamic-drop-down
Last active May 3, 2019 00:28
Advanced Custom Meta Fields Select Box Dynamically Created With a Looping Offset
function my_acf_load_field($field) {
$field['choices'] = array();
$post_type = 'xxxPOST-TYPE-NAMExxx'; // post type name
$acf_field_id = 'xxxACF-FIELD-IDcxxx'; //eg: field_52129dt7c49dd
$global_offset = 500; // whatever you want your looping offset to be
$num_props = wp_count_posts($post_type)->publish;
$num_props_pages = (intval($num_props/$global_offset)) + 1;
$offset_props = 0;
@jakzal
jakzal / FindPackageListsCommand.php
Created January 16, 2014 14:19
How to spec a Symfony2 console command?
<?php
namespace Zalas\Bundle\PackagistBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FindPackageListsCommand extends ContainerAwareCommand
@rothgar
rothgar / main.yml
Last active April 28, 2025 04:18
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@aktau
aktau / imessage
Last active February 25, 2025 15:56
Send iMessage from the commandline
#!/bin/sh
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit
-- another way of waiting until an app is running
on waitUntilRunning(appname, delaytime)
repeat until my appIsRunning(appname)
tell application "Messages" to close window 1
delay delaytime
end repeat