Skip to content

Instantly share code, notes, and snippets.

View ptahdunbar's full-sized avatar
I may be slow to respond.

(afro)TekGod ptahdunbar

I may be slow to respond.
View GitHub Profile
- simple
- public over private
- personal vanity
- internet is global
- permalinks
- one important item per page
- don't break the browser
- don't wanker in technology
- a medium is not a grande
- break convention for your users
Custom Post Types:
http://codex.wordpress.org/Custom_Post_Types
http://kovshenin.com/archives/custom-post-types-in-wordpress-3-0/
http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress/
Page Templates:
// Find wp-config.php
for ( $i = 0; $i < $depth = 10; $i++ ) {
$path = str_repeat( '../', $i );
if ( file_exists( $path . 'wp-config.php' ) ) {
require_once( $path . 'wp-config.php' );
break;
}
}
@ptahdunbar
ptahdunbar / getVacTeamByName.php
Created December 6, 2012 13:55
Get your Vac Team number!
/**
* Echos which VAC team you belong to.
*
* @params string $name Name of the person employed by VC Consulting.
* @return int Vac Team
*/
function getVacTeamByName($name = '')
{
$nameTotal = 0;
foreach ( str_split($name) as $char ) {
@ptahdunbar
ptahdunbar / Update WordPress urls in DB from old domain to new domain.
Created December 19, 2012 09:42
Please note: 1) this gists does not take into account serialized data that plugins may have added. 2) also does not support WordPress multisite.
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://wp.old', 'http://wp.new');
UPDATE wp_posts SET guid = REPLACE(guid, 'http://wp.old', 'http://wp.new');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://wp.old', 'http://wp.new');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://wp.old', 'http://wp.new')
WHERE option_name = 'home' OR option_name = 'siteurl';
-- Optional, uncomment the following lines if you left comments on your site.
-- UPDATE wp_postsmeta SET comment_author_email = REPLACE(comment_author_email, '@wp.old', '@wp.new');
@ptahdunbar
ptahdunbar / yellow-widgets-tutorial
Created March 20, 2013 08:56
Widgets and Widget Areas
<?php
// functions.php
register_sidebar(array(
'id' => 'custom',
'name' => 'Custom Widget Area',
));
<div class="widget-area widget-area-custom">
if (!dynamic_sidebar('custom')) {
echo "DevOps provisioning made easy"
pwd
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js" charset="utf-8"></script>
<script>
function showHint(str) {
jQuery.get("gethint.php?q=" + str, function(data){
document.querySelector('#txtHint').innerHTML = data;
});
return false;
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js" charset="utf-8"></script>
<script>
function showHint(str) {
console.log(str)
jQuery.get("gethint.php?q=" + str, function(data){
document.querySelector('#txtHint').innerHTML = data;
});
# V2
## Install
- [Install Docker Toolbox](https://github.com/docker/toolbox)
> You should have `docker`, `docker-machine`, and `docker-compose` in your $PATH by this point.
### Show a list of available machines
`docker-machine ls`