Resources in the wild:
How-to steps:
| function Deferred(){} | |
| (function(){ | |
| Deferred.prototype = { | |
| _isAsync: true, | |
| _done: null, | |
| _fail: null, | |
| _always: null, |
| var view = ko.views.manager.currentView, | |
| scimoz = view.scimoz, | |
| selection = scimoz.selText || scimoz.text, | |
| service = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService), | |
| log = function() { | |
| var message = ''; | |
| for (var i = 0; i < arguments.length; i++) { | |
| message += arguments[i] + ' '; | |
| } | |
| var view = ko.views.manager.currentView, | |
| scimoz = view.scimoz, | |
| selection = scimoz.selText, | |
| result = null, | |
| log = function() { | |
| var message = ''; | |
| for (var i = 0; i < arguments.length; i++) { | |
| message += arguments[i] + ' '; | |
| } |
| RegExp.fromString = function(str, flags) { | |
| return new RegExp(str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), flags); | |
| }; |
| var obj_normalize = (function() { | |
| function runNormalizer(currentValue, normalizer) { | |
| if (typeof normalizer === 'function') | |
| return normalizer(currentValue); | |
| // other types of normalization, like Regexp-Replace | |
| return currentValue.replace(normalizer[0], normalizer[1]); |
| // atma-class | |
| // common node.js and browser | |
| var Article = Class('Article', { | |
| Base: Class.Serializable({ | |
| date: Date | |
| }), | |
| _id: null, | |
| date: null, | |
| body: '', |
Resources in the wild:
How-to steps:
| window.dragger = (function() { | |
| var requestAnimationFrame = (function() { | |
| return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || | |
| function(callback) { | |
| return setTimeout(callback, 17); | |
| } | |
| })(); |
| var x = new RegExp( "/" ) | |
| console.log(x.test( "/hello" )); | |
| var serializedRegexParser = /^\/(.+)\/(\w+)?$/ | |
| var serializedRegex = x.toString(); | |
| console.log('serializedRegex:', serializedRegex); | |
| var matches = serializedRegexParser.exec(serializedRegex); | |
| var [full, regexString, regexFlags] = matches; |
| import '/bower_components/spectrum/spectrum.css'; | |
| import '/bower_components/spectrum/spectrum.js'; | |
| define ColorPickButton { | |
| slot domInsert () { | |
| this.$.find('.color-picker').spectrum({ | |
| cancelText: 'Abbrechen', | |
| chooseText: 'Auswählen', | |
| allowEmpty: true, |