Skip to content

Instantly share code, notes, and snippets.

View joeworkman's full-sized avatar

Joe Workman joeworkman

View GitHub Profile
@joeworkman
joeworkman / upgrade_sendy.sh
Created March 21, 2019 18:55
This upgrades the version of Sendy installation for you. It creates a symlink from public_html to the actual version that you are running live. The public_html folder is doc root.
#!/usr/bin/zsh
if [ "$#" -ne 2 ]; then
echo "Usage: $0 OLD_VERSION NEW_VERSION" >&2
exit 1
fi
export OLD=$1
export NEW=$2
@joeworkman
joeworkman / replace-cms-data.sh
Created March 15, 2019 21:24
You can run this script as a cron/scheduled job on your host to replace the cms-data folder contents with a templated version that you may have. You will need to replace the paths to the cms-data folders inside this script in order for it to work.
#!/bin/bash
rm -r /home/username/websites/total-cms.com/cms-data/
cp -r /home/username/websites/total-cms.com/cms-data-template/ /home/username/websites/total-cms.com/cms-data/
@joeworkman
joeworkman / total-cms-category-post-submenu.php
Last active March 16, 2019 02:41
This will create a Total CMS menu of categories/tags/authors with a submenus of all posts in that are assigned to that category/tag/author
<?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) {
$totalblog = new \TotalCMS\Component\Blog($cmsid);
$attrs = $totalblog->list_attributes($attribute);
@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;};