Skip to content

Instantly share code, notes, and snippets.

View miquelbrazil's full-sized avatar

Miquel Brazil miquelbrazil

View GitHub Profile
@hameedullah
hameedullah / customtaxonomydropdown.php
Created May 28, 2011 23:50
Custom Taxonomy drop downs for parents and child
<?php
/*
Plugin Name: Custom Taxonomy DropDown
Author: Hameedullah Khan
Aurhot URI: http://hameedullah.com
*/
// change this to your taxonomy
$brand_taxonomy = 'category';
@soupmatt
soupmatt / zzz_pow.conf
Created July 1, 2011 13:51
Apache reverse proxy config for pow
<VirtualHost *:80>
ServerName pow
ServerAlias *.dev
ServerAlias *.xip.io
ProxyPass / http://localhost:20559/
ProxyPassReverse / http://localhost:20559/
ProxyPreserveHost On
</VirtualHost>
@Grinderofl
Grinderofl / json_source.php
Created October 27, 2011 09:08
PHP CakePHP: JSON DataSource
<?php
// CORE/app/models/datasources/json_source.php
/**
* JSON Source module for CakePHP.
*
* @package cake
*/
@jnwheeler44
jnwheeler44 / gist:1334019
Created November 2, 2011 16:01
Convert text to a dom element in jQuery
// Had an interesting problem today by trying to load a textarea's contents as dom elements.
// Here's what I did:
// get my value and convert into a dom element
var string = $('#article_body').val();
var element = $("<div>" + string + "</div>");
// from there, I can get what I need
element.find("video").attr('src');
@pdewouters
pdewouters / term dropdown select
Created January 11, 2012 01:33
suggestion for hierchical dropdown
case 'taxonomy_select':
$names= wp_get_object_terms( $post->ID, $field['taxonomy'] );
$terms = get_terms( $field['taxonomy'], 'hide_empty=0' );
$selected = '';
foreach ( $terms as $term ) {
if (!is_wp_error( $names ) && !empty( $names ) && !strcmp( $term->slug, $names[0]->slug ) ) {
$selected = $term->slug;
} else {
}
@MarkRose
MarkRose / reuse_agent.sh
Last active September 11, 2023 06:42
Reuse existing ssh-agent or start a new one
# Reuse an existing ssh-agent on login, or create a new one. Append this to your .bashrc
# I have no idea who the author of the original concept was for reusing agents. This
# version also handles the case where the agent exists but has no keys.
GOT_AGENT=0
for FILE in $(find /tmp/ssh-* -type s -user ${LOGNAME} -name "agent.[0-9]*" 2>/dev/null)
do
SOCK_PID=${FILE##*.}
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

@jo-snips
jo-snips / events-conditional-wrappers.php
Last active December 21, 2023 12:27
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@hotestimator
hotestimator / qbwc.php
Created April 24, 2012 23:13
Quickbooks Web Connector in PHP, raw.
<?php
require('includes/init.php');
/**
* QB_xml_request
*
* This class turns the posted xml file into a
* key/value pair object we can work with.
*
* @param xml object array
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",