Skip to content

Instantly share code, notes, and snippets.

JP DeVries jpdevries

Block or report user

Report or block jpdevries

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jpdevries
jpdevries / nosvg.js
Created Dec 16, 2015
PoC for a SVG "polyfill"
View nosvg.js
/*
<svg class="icon" data-png-fallback="assets/img/src/icons/black/png/icon-modx">
<title>Best CMS Ever</title>
<use xlink:href="assets/img/icons.svg#icon-modx"></use>
</svg>
*/
var hasSVG = false; //your feature detection here
(function(hasSVG){
if(!hasSVG) {
@jpdevries
jpdevries / gruntfile.js
Last active Feb 9, 2016
SVG-Sprite Gruntfile
View gruntfile.js
module.exports = function(grunt) {
// Project configuration.
var initConfig = {
pkg: grunt.file.readJSON('package.json'),
dirs: { /* just defining some properties */
lib: './lib/',
theme: '../',
assets: 'assets/',
img: 'img/'
@jpdevries
jpdevries / gist:7c17dce93df93ca932e2
Last active Aug 29, 2015
Duplicate MODX User Group from Command Line
View gist:7c17dce93df93ca932e2
<?php
/**
* Duplicates a MODX User Group
* USAGE:
* php duplicateusergroup.php 1 New\ Group
* php duplicateusergroup.php 1 New\ Group newuser you@you.com password
*/
$tstart = microtime(true);
set_time_limit(0);
@jpdevries
jpdevries / ie-9-fu.html
Created Apr 4, 2015
Tell IE 9 users to update their browser.
View ie-9-fu.html
<!--[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 / isNakedDay
Last active Aug 29, 2015
isNakedDay PHP Snippet for MODX Revolution
View isNakedDay
<?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 / eureka-media-browser.html
Last active Aug 29, 2015
HTML-first crack at a Flexible Media Browser
View eureka-media-browser.html
<!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 / modernizr-fallback.html
Created Mar 16, 2015
Load modernizr.js from CDN with local fallback
View modernizr-fallback.html
<!-- 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 / settings-table.js
Last active Aug 29, 2015
settings-table for modern browsers
View settings-table.js
$('.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 / settings-table-oldie.js
Last active May 21, 2016
settings-table for old browsers
View settings-table-oldie.js
$('.settings-table').each(function(){
$(this).on('focusin click','tbody > tr:not(.setting-form)',function(e){
$(this).addClass('open').siblings('.open').removeClass('open');
});
});
@jpdevries
jpdevries / SassMeister-input.scss
Created Mar 8, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
html.js {
.js-hide {
display:none;
}
}
You can’t perform that action at this time.