Skip to content

Instantly share code, notes, and snippets.

View onestepcreative's full-sized avatar

Josh McDonald onestepcreative

View GitHub Profile
@onestepcreative
onestepcreative / sample_html_markup.html
Last active December 30, 2015 22:39
A sample html document to illustrate coding standards.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
@onestepcreative
onestepcreative / empty_obj.js
Last active December 29, 2015 20:19
check to see if an object is empty
var objEmpty = function(obj) {
return (JSON.stringify(obj) == '{}');
}
;(function($, window, document, undefined) {
// INIT FOUNDATION *REQUIRED*
$(document).foundation();
// GLOBAL CLOSURE VARIABLES
var w = $(window), d = $(document);
// WINDOW HEIGHT + WIDTH VARS
// ===================================================================
// === FUNCTION TO SUPPORT CROSS-DOMAIN AJAX REQUESTS FOR CAT TREE ===
// ===================================================================
jQuery.ajax = (function(_ajax){
var protocol = location.protocol,
hostname = location.hostname,
exRegex = RegExp(protocol + '//' + hostname),
YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
@onestepcreative
onestepcreative / robust-cpt.php
Last active December 15, 2015 13:28
Add more robust functionality for custom post types in Wordpress. Adds custom post type "video" to search results & archive pages.
<?php
// =========================================================================
// ====== MORE ROBUST CUSTOM POST TYPE INTEGRATIONS
// =========================================================================
function combatPostTypeArchives($query) {
if(is_category() || is_tag() && empty( $query->query_vars['suppress_filters'])) {
function scrollTop(step) {
var start = window.pageYOffset;
var count = 0;
var intervalRef = setInterval( (function(interval, curOffset) {
return function() {
curOffset -= (interval * step);
console.info("offset = " + curOffset);
window.scrollTo(0, curOffset);
console.info("pageYoffset = " + window.pageYOffset);
count++;
<!-- // I FIND IT BEST TO LEAVE THIS TO "BLACK" // -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- // GIVE YOUR APP A NAME // -->
<meta name="application-name" content="Alvin Nguyen Photo" />
<!-- // THIS IS JUST LETS THE IPAD KNOW WE'RE WANTING TO RENDER A "WEB APP" // -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- // THESE ARE THE ICON IMAGES USED FOR THE "APP" ICON THAT APPEARS AFTER "SAVING TO HOMESCREEN" // -->
@onestepcreative
onestepcreative / StripeTutorialPage.html
Created November 13, 2012 20:20 — forked from boucher/StripeTutorialPage.html
Stripe Tutorial Payment Form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
// this identifies your website in the createToken call below
for ($i = 1; $i < 5; $i++) {
$content = get_post_meta($post->ID, 'video_card'.$i, true);
$max = // Number of videos that were returned.
echo '<li>';
if ($content) {
echo $content;
// RSS Dashboard Widget
function freshDashboardRSS() {
if(function_exists('fetch_feed')) {
include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
$feed = fetch_feed('http://blog.onestepcreative.com/feed/rss/'); // specify the source feed
$limit = $feed->get_item_quantity(7); // specify number of items
$items = $feed->get_items(0, $limit); // create an array of items
}
if ($limit == 0) echo '<div>The RSS Feed is either empty or unavailable.</div>'; // fallback message
else foreach ($items as $item) : ?>