Skip to content

Instantly share code, notes, and snippets.

@ammist
ammist / deploy.sh
Created November 29, 2017 18:55
Deploy with Rsync
#!/bin/sh
#whatever your SSH key is that you need to get the data from bitbucket and/or push to your environment.
ssh-add ~/.ssh/id_rsa
rm -rf projectname
git clone git@bitbucket.org:teamname/projectnamee.git projectname
cd projectname
#switch to whatever branch you have your code in
git checkout production
@ammist
ammist / cpt.php
Created November 4, 2017 00:59
Taxonomy/Post URL Rewrite rule example for WordPress
function my_rewrite_rules( $rules_array ) {
$new = array();
//get the list of categories and create a rewrite rules for each.
// We get them in order by parent so that we can quickly build the array we need.
$cats = get_terms( array( 'taxonomy' => 'category', 'hide_empty' => false, 'hierarchical' => true, 'fields' => 'all', 'orderby' => 'parent'));
// extract the parents and build the array for generating the rules
$cr = array();
@ammist
ammist / Regex-examples.md
Last active June 13, 2017 01:53
Regex Examples

Select the Directory part of URL's

/[0-9a-zA-z-_]+/

@ammist
ammist / wordpress.php
Created November 20, 2016 06:38
WordPress Posts, Postmeta, Posts 2 Posts Queries
/*
* Get the events for each person
*/
$events = new WP_Query(
array (
'post_type' => 'event',
'connected_type' => 'speaker_to_event',
'connected_items' => $speaker->ID,
@ammist
ammist / profile-summary.php
Last active July 13, 2016 01:59
ACF Fields in HTML Example with genesis tempate
<?php
/*
* Displays in a list form an ACF repeater field with three subfields
* Field: urls
* Sub-FieldS: label, link, style,
*
*/
$post = get_queried_object();
@ammist
ammist / multiplex-read.c
Created March 31, 2015 04:20
Basic Arduino Multiplexer code
/*
* Reading switches and tell to Serial.
*
*/
int numPins = 2;
int out[] = {4,5};
int in[] = {2,3};
@ammist
ammist / .gitignore
Last active August 29, 2015 14:06
Default Tech Liminal .gitignore file
*/.ssh
.ssh/*
.mysql_history
.vim*
.bash*
.htaccess
*~
.DS_Store
.svn
.cvs
@ammist
ammist / blog_table_move.sql
Last active August 29, 2015 14:05
Moving Posts from one site to Another.
rename table wp_79_posts to wp_tmp_posts, wp_79_postmeta to wp_tmp_postmeta, wp_79_terms to wp_tmp_terms, wp_79_term_taxonomy to wp_tmp_term_taxonomy, wp_79_term_relationships to wp_tmp_term_relationships, wp_79_p2p to wp_tmp_p2p, wp_79_p2pmeta to wp_tmp_p2pmeta;
create table wp_79_posts like wp_posts;
INSERT wp_79_posts SELECT * FROM wp_posts;
create table wp_79_postmeta like wp_postmeta;
INSERT wp_79_postmeta SELECT * FROM wp_postmeta;
--
create table wp_79_terms like wp_terms;
INSERT wp_79_terms SELECT * FROM wp_terms;
create table wp_79_term_taxonomy like wp_term_taxonomy;
@ammist
ammist / gist:0ec470e125b39d718b6b
Last active August 29, 2015 14:04
jQuery Carousel Basics
<html>
<head>
<script type='text/javascript' src='jquery-1.11.1.min.js'></script>
<script type='text/javascript'>
$( document ).ready(function() {
console.log( "ready!" );
});
</script>
@ammist
ammist / Notes
Created June 30, 2014 18:58
Image Getting w/ Genesis
Genesis_image will return full HTML (it may not be what you are looking for).