Skip to content

Instantly share code, notes, and snippets.

View michaelbrazell's full-sized avatar

Mike Murray michaelbrazell

View GitHub Profile
<div class="recipe" data-sly-use.recipe="com.citytechinc.cq.bootcamp.components.content.Recipe">
<div class="row">
<div class="col-xs-12 col-md-4">
<img src="${recipe.RecipeImage}" class="Image">
</div>
<div class="col-xs-12 col-md-8">
<h2>${recipe.title}</h2>
<div class="meta">
<p>Author: ${recipe.user}</p>
<p>Posted on: ${recipe.date} </p>
package com.citytechinc.cq.bootcamp.components.content;
import groovy.transform.Field;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.jcr.RepositoryException;
import org.apache.commons.lang3.StringUtils;
@michaelbrazell
michaelbrazell / junk.css
Created June 2, 2015 17:19
Fallout Reveal Website unminified css
@import url("//hello.myfonts.net/count/2dc302");
@import url("//hello.myfonts.net/count/2dc302");
@import url("//hello.myfonts.net/count/2dc302");
@import url("//hello.myfonts.net/count/2dc302");
@font-face {
font-family: 'schoolbook-web', serif;
font-weight: normal;
font-style: normal;
}
@font-face {
@michaelbrazell
michaelbrazell / XBL-ScreenShots-from-JSON
Last active August 29, 2015 14:19
Pull Screenshots from JSON datasource with a download link
<html>
<head>
<title>Screenshots!</title>
</head>
<body>
<h1>Screenshots!</h1>
<div id="container">
</div>
</body>
@michaelbrazell
michaelbrazell / XBL-Screenshot-Data
Created April 14, 2015 15:28
One time pull of my screenshot data from Xbox Live using Xbox Live API
[{"screenshotId":"95ee50ce-d030-49ff-9f4c-acb9d80cc80e","resolutionHeight":1080,"resolutionWidth":1920,"state":"Published","dateTaken":"2015-04-12 20:55:20","lastModified":"2015-04-12 20:55:36","userCaption":"","type":"UserGenerated","scid":"28360100-1f6f-4a8d-b425-4dbd7ffe16e1","titleId":2147358433,"rating":0,"ratingCount":0,"views":0,"titleData":"","systemProperties":"878353f4-d619-44d9-8d9d-161e81c17a83;","savedByUser":false,"achievementId":"","greatestMomentId":"","thumbnails":[{"uri":"http:\/\/screenshotscontent-t5001.xboxlive.com\/00090000004fa942-95ee50ce-d030-49ff-9f4c-acb9d80cc80e\/Thumbnail_Small.PNG","fileSize":80252,"thumbnailType":"Small"},{"uri":"http:\/\/screenshotscontent-t5001.xboxlive.com\/00090000004fa942-95ee50ce-d030-49ff-9f4c-acb9d80cc80e\/Thumbnail_Large.PNG","fileSize":258104,"thumbnailType":"Large"}],"screenshotUris":[{"uri":"http:\/\/screenshotscontent-t5001.xboxlive.com\/00090000004fa942-95ee50ce-d030-49ff-9f4c-acb9d80cc80e\/Screenshot-Original.png?sv=2013-08-15&sr=c&sig=Av3Oz549hie
@michaelbrazell
michaelbrazell / Author-Capabilities.php
Last active August 29, 2015 14:15
WP Add author capabilities to moderate comments to
<?php
/* Use this in Functions.php */
function add_publish_caps() {
// gets the contributor role
$role = get_role( 'contributor' );
// Adds capability to moderate comments, edit posts, but not publish posts.
// moderate_comments requires edit_posts which is why we need the remove_cap.
$role->add_cap( 'edit_posts' );
@michaelbrazell
michaelbrazell / WP Loop Through Custom Post Type with JSON
Last active September 24, 2018 06:21
Using WP REST API to Loop through Custom Post type with JSON
<html>
<head>
<title>Looping through json object</title>
<script type="text/javascript">
/*
Looping through your custom post type data using Wordpress rest API
You'll need this plugin as of 1/15/2015. http://wp-api.org/
Eventually this will be included in the WP Core. Supposed to be with 4.1, but that didn't happen.
*/
</script>
@michaelbrazell
michaelbrazell / Pods_Loop-through-post-type-by-category
Last active August 29, 2015 14:11
Usings Pods to loop through a number of posts outside the loop (in this case a custom pod called "links" ) and displaying them by category
<?php
// Declare paremeters of Pods
// Limiting by 4, and looping through the category slug called "for-parents"
$params = array(
'limit' => 4,
'where' => "category.slug = 'for-parents'"
);
// Create a variable called $links and assign that my pod called "link" pulling in the parameters from above
$links = pods('link', $params );
// If there are more than 0 links, let's display them!
<?php
/**
* I am creating a function here because I am calling it in my template
* using custom_header_template();
* but you do not need to do this
* Additionally, I have a lot of fields that I need to pull in, so I am assigning each one as a variable
* One of those fields is an image and I need the URL so I use the pods_image_url filter
* Additionally, I have a WYSYWIG that has custom shortcodes in it, so I have to use do_shortcode(); to call that field for the shortcode to be executed
*/
@michaelbrazell
michaelbrazell / gist:836f529ea4000c2b9cff
Created September 22, 2014 15:57
Looping through a post outside of Wordpress
<!-- This is called in the head of this file -->
<?php require('./blog/wp-blog-header.php'); ?>
<!-- way down the page -->
<div class="feature_blog">
<div class="feature_blog_content">
<h4>The Distance Lens Blog</h4>
<?php
$args = array( 'numberposts' => '1', 'category' => '1');