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
@kidGodzilla
kidGodzilla / invert-binary-tree.js
Created May 28, 2016
Invert a Binary Tree in Javascript
View invert-binary-tree.js
// This problem was inspired by this original tweet by Max Howell:
// Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off.
// So, let's invert a binary tree in Javascript
// Original Tree
// 4
// / \
// 2 7
// / \ / \
View plugin-minify-resource-output.php
<?php
/**
*
* Plugin fires OnWebPagePrerender system event, loads Minify HTML by Mr Clay and minifies the requested Resource HTML inc. inline css and js.
*
* If used in conjunction with StatCache the minified HTML is cached and served as a flat file via IIS Rewrite.
*
* CREDITS
*
* http://rtfm.modx.com/revolution/2.x/developing-in-modx/basic-development/plugins
@MoOx
MoOx / isDblTouchTap.js
Last active Jul 4, 2019
Double touch tap workaround for React based on onTouchTap (react-tap-event-plugin)
View isDblTouchTap.js
const dblTouchTapMaxDelay = 300
let latestTouchTap = {
time: 0,
target: null,
}
export default function isDblTouchTap(event) {
const touchTap = {
time: new Date().getTime(),
target: event.currentTarget,
@jareware
jareware / README.md
Last active Jun 7, 2018
Quick PSA on icon fonts and ligatures
View README.md

Long Live Icon Fonts!

or, a Quick PSA on icon fonts and ligatures.

tl;dr: keep using icon fonts, they are nice, just enable ligatures

These are my talking notes at the http://wwweeklies.com/ on 2015-12-04:

View ajax_svg.js
function loadSVG( url ) {
// AJAX-y load the SVG icon
var req = new XMLHttpRequest();
req.onload = serializeSVG;
req.open( 'get', url, true );
req.send( null );
}
function serializeSVG() {
@WebReflection
WebReflection / String.prototype.template.js
Last active Feb 17, 2019
ES6 Template like strings in ES3 compatible syntax.
View String.prototype.template.js
// this is now a module:
// https://github.com/WebReflection/backtick-template#es2015-backticks-for-es3-engines--
var template = require('backtick-template');
// just string
const info = 'template';
`some ${info}` === template('some ${info}', {info});
@christianseel
christianseel / introRTE
Created Aug 14, 2014
RTE for introtext #modx
View introRTE
<?php
// Add RTE for introtext if richtext option is enabled for the resource
// check "OnDocFormRender" event
$modx->regClientStartupHTMLBlock('<script>Ext.onReady(function() {
if(MODx.loadRTE) MODx.loadRTE("modx-resource-introtext");
});</script>');
@cvrebert
cvrebert / survey.md
Last active Sep 27, 2019
Click and focus behavior across browsers & OSes
View survey.md

Test apparatus: http://jsfiddle.net/hRub4/

(Windows = Windows 8.1 desktop)

  • Windows Chrome 39
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Firefox 30.0
    • Button focuses on click and via keyboard tabbing
    • Anchor focuses on click and via keyboard tabbing
  • Windows Internet Explorer 11
@evaisse
evaisse / object.toquerystring.js
Last active Oct 19, 2017
Object.toQueryString - Vanilla JS version - encode object to POST, GET AJAX calls
View object.toquerystring.js
/**
* Simply encode a base js object as {a:2, d:[1,"two"], c: {foo: {bar:1}}}
* And returns URL encoded string : a=2&d[0]=1&d[1]=two&c[foo][bar]=1"
*
* @param {Object} object A base javascript object : {}
* @param {String} base Optionnal base notation, should only be used by recursion for internal work
* @return {String} URL encoded query string
*/
Object.toQueryString = function (object, base) {
var queryString = [];
You can’t perform that action at this time.