Skip to content

Instantly share code, notes, and snippets.

View joeworkman's full-sized avatar

Joe Workman joeworkman

View GitHub Profile
@joeworkman
joeworkman / total-cms-blog-category-menu.php
Last active November 16, 2018 23:27
This will create menu items for every category in a Total CMS blog. You can place this snippet in any Foundation menu stack that supports custom HTML menus
<li class='has-dropdown'><a href='#'>Categories</a><ul class='dropdown'>
<?php
$cmsid = "blog";
$attribute = "category"; // tag, category, author
$href = "/blog/?category="; // URL to blog list with category filter
//-----------------------------------------------
// Do not modify below this line
//-----------------------------------------------
if ($publish) {
@joeworkman
joeworkman / total-cms-blog-menu.php
Last active February 5, 2019 20:52
This will create menu items for all blog posts inside Total CMS. You can place this snippet inside of any Foundation menu stack that supports custom HTML menus.
<li class='has-dropdown'><a href='#'>Blog</a><ul class='dropdown'>
<?php
$cmsid = "blog";
//-----------------------------------------------
// Do not modify below this line
//-----------------------------------------------
if ($publish) {
$totalblog = new \TotalCMS\Component\Blog($cmsid);
$posts = $totalblog->filter_posts();
@joeworkman
joeworkman / total-cms-blog-menu.php
Created November 16, 2018 16:33
This will create menu items for all blog posts inside Total CMS. You can place this snippet inside of any Foundation menu stack that supports custom HTML menus.
<li class='has-dropdown'><a href='#'>Blog</a><ul class='dropdown'>
<?php
$cmsid = "blog";
//-----------------------------------------------
// Do not modify below this line
//-----------------------------------------------
$totalblog = new \TotalCMS\Component\Blog($cmsid);
$posts = $totalblog->filter_posts();
foreach ($posts as $post) {
@joeworkman
joeworkman / inheritance.js
Created December 6, 2017 19:52
A JavaScript inheritance model
(function() {
// Parent Class
this.ClassA = function() {
var defaults = {
setting1: null,
setting2: 'hello',
}
// Create options by extending defaults with the passed in arugments

Keybase proof

I hereby claim:

  • I am joeworkman on github.
  • I am joeworkman (https://keybase.io/joeworkman) on keybase.
  • I have a public key ASDKpxAWcCSCV8UQxeYGLKvoxtLHMVCaJKOc96-ytUr0Kgo

To claim this, I am signing this object:

@joeworkman
joeworkman / Disalbe Enter Form submission
Created April 12, 2017 17:23
Disable Total CMS form submission with the enter key
$(document).keypress(function(event){
if (event.which == '13') {
event.preventDefault();
}
});
@joeworkman
joeworkman / Impact Video
Created April 12, 2017 14:18
Hotfix for Impact Video not scaling
$(window).load(function(){
function resizeToCover(video,container,natural_width,natural_height) {
// set the video viewport to slide size which is determined by parent stack JS
var scale_h = container.width() / natural_width;
var scale_v = container.height() / natural_height;
var scale = scale_h > scale_v ? scale_h : scale_v;
// don't allow scaled width < minimum video width
if (scale * natural_width < min_width) {scale = min_width / natural_width;};
@joeworkman
joeworkman / fastclick.js
Last active August 29, 2016 18:16
Off Canvas Mobile temp work around. Place this into the Javascript tab in your RapidWeaver project.
!function(){"use strict";function a(b,d){function e(a,b){return function(){return a.apply(b,arguments)}}var f;if(d=d||{},this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.touchBoundary=d.touchBoundary||10,this.layer=b,this.tapDelay=d.tapDelay||200,this.tapTimeout=d.tapTimeout||700,!a.notNeeded(b)){for(var g=["onMouse","onClick","onTouchStart","onTouchMove","onTouchEnd","onTouchCancel"],h=this,i=0,j=g.length;j>i;i++)h[g[i]]=e(h[g[i]],h);c&&(b.addEventListener("mouseover",this.onMouse,!0),b.addEventListener("mousedown",this.onMouse,!0),b.addEventListener("mouseup",this.onMouse,!0)),b.addEventListener("click",this.onClick,!0),b.addEventListener("touchstart",this.onTouchStart,!1),b.addEventListener("touchmove",this.onTouchMove,!1),b.addEventListener("touchend",this.onTouchEnd,!1),b.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(b.removeEventListener=function(a,c,d){var e=No
Verifying that +joeworkman is my blockchain ID. https://onename.com/joeworkman
@joeworkman
joeworkman / replace-cmd-data.sh
Created November 30, 2015 16:01
You can schedule the following shell script as a cron job on your hosting company in order to replace the cmd-data directory on your server with a "golden" master copy that you have saved to a new location. You will obviously want to change the directory locations where the files live to fit your server.
#!/bin/bash
rm -r /websites/cms.joeworkman.net/cms-data/
cp -r /home/joeworkman/cms-data-template /websites/cms.joeworkman.net/cms-data/