Skip to content

Instantly share code, notes, and snippets.

@jpdevries
jpdevries / settings-table.js
Last active August 29, 2015 14:16
settings-table for modern browsers
$('.settings-table').each(function(){
var _that = $(this);
_that.find('tbody > tr:not(.setting-form)').on((!Modernizr.touch) ? 'focusin' : 'click',function(e){
$(this).toggleClass('open').siblings('.open').removeClass('open');
}).addClass('clickable');
});
@jpdevries
jpdevries / modernizr-fallback.html
Created March 16, 2015 16:13
Load modernizr.js from CDN with local fallback
<!-- try to load modernizr from a CDN, use h5bp-ish style fallback to load locally if needed -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script>try{Modernizr} catch(e) {document.write('<script src="./assets/js/vendor/modernizr-2.8.3.min.js"><\/script>')}</script>
@jpdevries
jpdevries / eureka-media-browser.html
Last active August 29, 2015 14:17
HTML-first crack at a Flexible Media Browser
<!doctype html>
<!-- if you like markup please stop by and say hello over at http://markup.tips -->
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="HTML-first crack at a Flexible Media Browser">
<meta name="viewport" content="width=device-width, initial-scale=1">
@jpdevries
jpdevries / isNakedDay
Last active August 29, 2015 14:18
isNakedDay PHP Snippet for MODX Revolution
<?php
$start = date('U', mktime(-12, 0, 0, 04, $d, date('Y')));
$end = date('U', mktime(36, 0, 0, 04, $d, date('Y')));
$z = date('Z') * -1;
$now = time() + $z;
if ( $now >= $start && $now <= $end ) {
return true;
}
return false;
@jpdevries
jpdevries / ie-9-fu.html
Created April 4, 2015 04:47
Tell IE 9 users to update their browser.
<!--[if IE 9]>
<script>alert('Your browser is ' + (Math.round((new Date() - new Date(2011,3,12)) / (1000 * 60 * 60 * 24)) + ' days') + 'out of date and does not properly support the Flexible Box Model. Problem is it thinks it does and will unsuccesfully attempt to. Please return in a modern browser.');</script>
<![endif]-->
@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')});