This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
// / \ / \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dblTouchTapMaxDelay = 300 | |
let latestTouchTap = { | |
time: 0, | |
target: null, | |
} | |
export default function isDblTouchTap(event) { | |
const touchTap = { | |
time: new Date().getTime(), | |
target: event.currentTarget, |
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:
- This Seriously, Don’t Use Icon Fonts post came out
- This I agree with: SVG is really nice for the Web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'); |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 = []; |
NewerOlder