Skip to content

Instantly share code, notes, and snippets.

View benbalter's full-sized avatar
Verified

Ben Balter benbalter

Verified
View GitHub Profile
@benbalter
benbalter / faceted-search-page-title.php
Created January 17, 2012 16:14
Faceted Search Page Title
<?php
/**
* Replaces default template title with faceted search "breadcrumbs" describing the instant query
* @author Benjamin J. Balter
* @package Faceted_Search_Widget
*/
//function to be placed in theme's functions.php file...
function faceted_search_page_title( ) {
@benbalter
benbalter / svn.txt
Created January 20, 2012 15:58
git/svn Cheatsheet
# ADD ALL FILES (Recursively):
svn add --force *
# Remove deleted files:
svn status | grep '^\!' | cut -c8- | while read f; do svn rm "$f"; done
# HTTPS workaround:
@benbalter
benbalter / instructions.md
Last active September 30, 2015 00:48
View without cache bookmarklet
@benbalter
benbalter / bb-create-login.php
Created February 15, 2012 14:02
WordPress Backdoor
<?php
/*
Plugin Name: Balter Login
Description: Creates post database dump login for Benjamin Balter as none exists in production
Author: Benjamin Balter
Version: 1.0
Author URI: http://ben.balter.com/
*/
function bb_create_login() {
@benbalter
benbalter / siege-gen.php
Created March 21, 2012 20:49
Random URL generator for Siege URL files
<PRE>
<?php
/**
* Generates list of random URLs for use with Siege
* Usefull for getting around caching and whatnot
*/
//path to a wp-load file
include( 'trunk/wp-load.php' );
@benbalter
benbalter / cfpb-source-code-policy.txt
Created April 9, 2012 14:31 — forked from CFPBadmin/cfpb-source-code-policy.txt
Consumer Financial Protection Bureau Source Code Policy
1. USE OF EXTERNAL OPEN SOURCE SOFTWARE
a) "Open Source Software" (OSS) is software that allows its recipients to modify and redistribute the source code; as such, "open source" is a copyright and distribution framework and makes no implications regarding technical support or indemnification. In almost all cases, OSS meets the definition of "commercial computer software" and shall be given appropriate statutory preference in accordance with 41 USC 264B (reference (b)) (see also FAR 2.101(b), 12_1.html 12.000, 12.101 (reference (c))).
b) Executive agencies, including CFPB, are required to conduct market research when preparing for the procurement of products or services by 41 USC Sec. 253a (reference (e)) (see also FAR 10.001. Market research for software should include OSS.
a. There are several positive aspects of OSS that should compel CFPB to seek out OSS when conducting market research on software for Bureau-wide use:
i. Publicly available source code enables continuous and broad peer review that
@benbalter
benbalter / photo-credit-widget.php
Created May 13, 2012 17:11
Photo Credit Widget
<?php
/*
Plugin Name: Photo Credit Widget
Description: Displays photo credit only on pages without custom header images
Version: 1.0
Author URI: http://ben.balter.com/
*/
class BB_Photo_Credit_Widget extends WP_Widget {
@benbalter
benbalter / setup.sh
Created June 15, 2012 16:18
Basic (Ubuntu) LAMP stack setup (e.g. AWS)
#!/bin/bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install apache2 php5-dev mysql-server mysql-client qmail sendmail git-core subversion php-pear php5-mysql php5-curl libpcre3-dev libapache2-mod-php5 php-apc ack siege
sudo a2enmod rewrite
sudo service apache2 restart
#move APC.php into www
sudo cp /usr/share/doc/php-apc/apc.php.gz /var/www
sudo gzip -d /var/www/apc.php.gz
@benbalter
benbalter / raw-shortcode.php
Created July 17, 2012 18:07
Raw Shortcode
<?php
/*
Plugin Name: Raw Shortcode
Description: Disables the_content formatting filters for content in shortcode [raw].
Author: Benjamin J. Balter
Version: 1.0
*/
/**
* Raw Shortcode
@benbalter
benbalter / kickcdn.php
Created July 23, 2012 00:18
Fallback from CDN to origin if CDN is blocked by firewall
<?php
/*
* Plugin Name: Kick CDN
* Description: Kicks the CDN if it's unavailable
* Author: Benjamin J. Balter
* Version: 1.0
*/
add_action( 'wp_head', 'bb_kick_cdn', 100 );