The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
| backspace 8 | |
| tab 9 | |
| enter 13 | |
| shift 16 | |
| ctrl 17 | |
| alt 18 | |
| pause/break 19 | |
| caps lock 20 | |
| escape 27 | |
| page up 33 |
| * { | |
| -webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */ | |
| -webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */ | |
| -webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */ | |
| -webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */ | |
| } |
| $ npm install --save-dev connect-modrewrite | |
| Then edit gulp/server.js | |
| var modRewrite = require('connect-modrewrite'); | |
| function browserSyncInit(baseDir, files, browser) { | |
| browser = browser === undefined ? 'default' : browser; | |
| browserSync.instance = browserSync.init(files, { | |
| startPath: '/index.html', |
| = IMAGEMAGICK | |
| Working with images, PDFs and the command line | |
| # convert from one format to another | |
| convert image.gif image.jpg | |
| # convert specific PDF page to image |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| (function() { | |
| 'use strict'; | |
| var throttle = function(type, name, obj) { | |
| obj = obj || window; | |
| var running = false; | |
| var func = function() { | |
| if (running) { return; } | |
| running = true; | |
| obj.requestAnimationFrame(function() { | |
| obj.dispatchEvent(new CustomEvent(name)); |
| var svg = document.querySelector( "svg" ); | |
| var svgData = new XMLSerializer().serializeToString( svg ); | |
| var canvas = document.createElement( "canvas" ); | |
| var ctx = canvas.getContext( "2d" ); | |
| var img = document.createElement( "img" ); | |
| img.setAttribute( "src", "data:image/svg+xml;base64," + btoa( svgData ) ); | |
| img.onload = function() { |
| var pubsub = {}; | |
| (function(q) { | |
| var topics = {}, subUid = -1; | |
| q.subscribe = function(topic, func) { | |
| if (!topics[topic]) { | |
| topics[topic] = []; | |
| } | |
| var token = (++subUid).toString(); | |
| topics[topic].push({ | |
| token: token, |