Skip to content

Instantly share code, notes, and snippets.

# DESCRIPTION: Cap task to setup the current (initialized) git directory as a remote repository.
#
# INSTALL: Copy to home directory as ~/.caprc
# RUN: cap git:setup scm=t
#
# AUTHOR: Geoffrey Grosenbach http://peepcode.com
#
# Assumes ability to run commands as sudo and the presence of a "git" user and group on remote server.
# The Capistrano :user is used only to connect and setup directories.
@charlesroper
charlesroper / tmsanitize4e.rb
Created August 12, 2009 09:57
A script to fix filenames that are incompatible with Windows.
#!/usr/bin/ruby
# tmsanitize4e.rb
# A script to sanitize filenames that are incompatible with Windows.
require 'uri'
require 'find'
require 'fileutils'
include FileUtils::Verbose
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@kevinold
kevinold / git-flow_test.sh
Created August 19, 2010 16:45
testing git-flow on existing git repo
# In reply to my own question
# (http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/#comment-69995567)
# about using git-flow with existing git repos I experimented with a dummy
# git repo and it appears rather straight-forward
kold@Macintosh-27 $ git init test_git_flow
Initialized empty Git repository in /private/tmp/test_git_flow/.git/
(/tmp)
kold@Macintosh-27 $ cd test_git_flow/
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
# modified by t.broyer@ltgt.net - fixes diffs that introduce new files
# modified by m@rkj.me - fix sed syntax issue in OS X
#
# Generate an SVN-compatible diff against the tip of the tracking branch
@markjaquith
markjaquith / disable-plugins-when-doing-local-dev.php
Created June 24, 2011 10:24
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@markjaquith
markjaquith / disable-comments-query.php
Created July 25, 2011 16:08
Disable comments query plugin
<?php
/*
Plugin Name: Disable Comment Querying
Description: Disables comment queries
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@Viper007Bond
Viper007Bond / sync.php
Created August 1, 2011 23:11 — forked from anonymous/sync.php
Google Contacts Sync
<?php
/**
* Google Contacts Syncer
* by Alex Mills (http://www.viper007bond.com/)
*
* This script copies all contacts from Google account A to
* Google account B, wiping out all existing contacts in
* account B's account in the process.
*
@farinspace
farinspace / combos.php
Last active February 4, 2021 11:56
Recursive functions, I can never find exactly what I need in a pinch
<?php
function combos($data, &$all = array(), $group = array(), $val = null, $i = 0) {
if (isset($val)) {
array_push($group, $val);
}
if ($i >= count($data)) {
array_push($all, $group);
} else {
foreach ($data[$i] as $v) {
@curtismchale
curtismchale / show-post-relations-relations-post-type
Created August 25, 2011 23:24
Shows the related content on a WordPress site using Relations post type
function tan_show_related_content( $postid, $post_type ) {
global $wp_query, $post;
// Related IDs for this view ?
$ids = rpt_get_object_relation( $postid, $post_type );
if( $ids == false || empty($ids) )
return false;
$items_query = new WP_Query( array(
'post__in' => $ids,