Skip to content

Instantly share code, notes, and snippets.

@jpdevries
jpdevries / gist:4579637
Last active December 11, 2015 09:28
MODX Revolution PHP Snippet to return site_start context setting of b.com context
<?php
// assumes there is a site_url context_setting for b.com with a value such as http://b.com/
$setting = $modx->getObject('modContextSetting', array(
'context_key' => 'b.com',
'key' => 'site_url',
));
return $setting->get('value');
@jpdevries
jpdevries / gist:4684764
Created January 31, 2013 17:49
example of manually coded main nav in MODX as opposed to using wayfinder for everything
<header>
<a href="[[++site_url]]" class="logo">Heart Coffee Roasters</a>
<nav class="primary">
<ul>
<li class="home"><a href="[[++site_url]]">Home</a></li>
<li class="about">
<a class="tap-touch " href="[[~12? &scheme=`full`]]">About<span class="extra"> Heart</span></a>
<div class="dropdown-mask">
<div class="dropdown">
<ul>
@jpdevries
jpdevries / gist:5347290
Created April 9, 2013 16:43
HTML Source for Pow Pass Map Page
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Pow Pass - Boreal</title>
@jpdevries
jpdevries / gist:5347393
Created April 9, 2013 16:57
Pow Pass Map Pin List
<div id="map-canvas">
<ul>
<!-- list all the resorts -->
<li data-id="4" data-href="/north-america/westcoast/oregon/cooper-spur-ski-area.html" data-ajax="/north-america/westcoast/oregon/cooper-spur-ski-area.html?ajax=1" data-ridden="">
<h3>Cooper Spur</h3>
<p class="coords">Coordinates:<span class="lat">45.4117233</span>,<span class="lng">-121.6055214</span></p>
</li>
<li data-id="6" data-href="/north-america/westcoast/california/mt.-shasta-ski-park.html" data-ajax="/north-america/westcoast/california/mt.-shasta-ski-park.html?ajax=1" data-ridden="">
<h3>Mt. Shasta</h3>
<p class="coords">Coordinates:<span class="lat">41.2759798</span>,<span class="lng">-122.2130865</span></p>
@jpdevries
jpdevries / gist:5347775
Created April 9, 2013 17:45
Pow Pass Map JavaScript
<script type="text/javascript">
function initialize() {
$.address.state('/');
var _pins = [];
$('#map-canvas li').each(function(){
var _title = $(this).find('h3').html();
var _lat = $(this).find('.lat').html();
var _lng = $(this).find('.lng').html();
_pins.push({title:_title,lat:_lat,lng:_lng,href:$(this).data('href'),ajax:$(this).data('ajax'),ridden:$(this).data('ridden'),id:$(this).data('id')});
@jpdevries
jpdevries / gist:5347795
Created April 9, 2013 17:47
Pow Pass AJAX Response
<h1><span>Boreal</span><i class="icon-ok"></i></h1>
<ul class="nav"><li class="prev"><a href="north-america/westcoast/california/alpine-meadows.html" class="prev" title="Alpine Meadows"><i class="icon-double-angle-left"></i>&nbsp;Alpine Meadows</a></li><li class="next"><a href="north-america/westcoast/california/donner-ski-ranch.html" class="next" title="Donner Ski Ranch">Donner Ski Ranch&nbsp;<i class="icon-double-angle-right"></i></a></li></ul>
<ul class="nav">
<li style="width:100%;float:none;text-align:center"><a href="north-america/westcoast/california/">&ndash;&nbsp;&nbsp;View California Resorts&nbsp;&nbsp;&ndash;</a></li>
</ul>
<p><strong><br /></strong><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Parking_lot_at_boreal.jpg/800px-Parking_lot_at_boreal.jpg" alt="" width="800" height="533" /></p>
<p><strong>Boreal Mountain Resort</strong> is a <a class="mw-redirect" title="Ski area" href="http://en.wikipedia.org/wiki/Ski_area">ski area</a> in <a title="So
@jpdevries
jpdevries / gist:5505905
Created May 2, 2013 22:16
Export PhotoShop Layers as .png (save as a .jsx file open in Adobe ExtendScript Toolkit)
// layerName.jsx
// Copyright 2006-2008
// Written by Jeffrey Tranberry
// Photoshop for Geeks Version 2.0
/*
Description:
Using an alert(); to display current Layer's name.
Set the name of the current layer to a string "Timmy"
*/
@jpdevries
jpdevries / gist:5514537
Created May 3, 2013 22:01
JSFL Script to turn PNG Sequence into Reflected SWF animation
/**
* @language JSFL
*
* @author JP DeVries
* @since 24.08.11
* @version 0.1
*
* @description
* This is a jsfl script that will take all png files from a source folder and create a swf of the sequence playing forwards, then backwards
* The file that is currently open and has focus in the IDE is used as the host for exporting.
@jpdevries
jpdevries / gist:5516772
Last active December 16, 2015 23:50
Using phpthumb in a MODX CMP
$modAuth = $this->modx->user->getUserToken('mgr');
$thumbQuery = http_build_query(array(
'src' => $image['urlAbsolute'],
'w' => 360,
'h' => 270,
'HTTP_MODAUTH' => $modAuth,
//'f' => $thumbnailType,
'q' => 80,
'wctx' => 'mgr',
@jpdevries
jpdevries / cacheguard.php
Last active February 28, 2017 08:40
Untick Empty Cache Checkbox for Unpublished Resources in MODX Revolution Plugin
<?php
/**
* cacheguard plugin for cacheguard extra
*
* Copyright 2013 by JP DeVries jp@modx.com
* Created on 06-21-2013
*
* cacheguard is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later