#Example
function Foo () {
EventEmitter.call(this);
}
Foo.prototype = mixin(Object.create(EventEmitter.prototype), {
doSomeThing: function () {
var data = {};
//....| /** | |
| * @class UniqArray {{{1 | |
| * @constructor | |
| * @extends Array | |
| */ | |
| function UniqArray(list = []) { | |
| Object.defineProperty(this, "__set__", { value: new Set(list) }); | |
| list = [...this.__set__]; | |
| var len = list.length; | |
| for (let i = 0; i < len; ++i) { |
| function getJSengine() { | |
| if (typeof __proto__ === "undefined") | |
| return "JScript(IE)"; | |
| switch (String(__proto__)) { | |
| case "[xpconnect wrapped native prototype]": | |
| return "SpiderMonkey(Firefox)"; | |
| case "[object Object]": | |
| switch (__proto__.constructor.name) { | |
| case "Object": |
#Example
function Foo () {
EventEmitter.call(this);
}
Foo.prototype = mixin(Object.create(EventEmitter.prototype), {
doSomeThing: function () {
var data = {};
//....| var [mixin, extend] = (function() { | |
| var wm = WeakMap(); | |
| function mixin(aTarget, ...aSources) { | |
| for (let source of aSources) { | |
| for (let key of Object.getOwnPropertyNames(source)) { | |
| let desc = Object.getOwnPropertyDescriptor(source, key); | |
| Object.defineProperty(aTarget, key, desc); | |
| } | |
| } | |
| return aTarget; |
| function defineProperties (aTarget, aSource) { | |
| var key, desc; | |
| for (key of Object.getOwnPropertyNames(aSource)) { | |
| desc = Object.getOwnPropertyDescriptor(aSource, key); | |
| desc.enumerable = false; | |
| Object.defineProperty(aTarget, key, desc); | |
| } | |
| return aTarget; | |
| } |
| // ==UserScript== | |
| // @id hateb_rm_sameTitleComemnts | |
| // @name hateb_rm_sameTitleComemnts.js | |
| // @version 1.0 | |
| // @namespace teramako | |
| // @author teramako | |
| // @description | |
| // @include http://b.hatena.ne.jp/entry/* | |
| // @run-at document-end | |
| // ==/UserScript== |
| const EXPORTED_SYMBOLS = ["eject"]; | |
| Components.utils.import("resource://gre/modules/ctypes.jsm"); | |
| const UINT = ctypes.unsigned_int; | |
| const DWORD = ctypes.uint32_t; | |
| const LPCWSTR = ctypes.jschar.ptr; | |
| if (ctypes.size_t.size == 8) { | |
| var WinABI = ctypes.default_abi; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Mutation Observer and Custom Event</title> | |
| </head> | |
| <body> | |
| <h1>Mutation Observer and Custom Event</h1> | |
| <button onclick="insertNode()">Node Insert</button> |
| /** | |
| * debaggable bind | |
| * set the original function to 'source' property on bind() | |
| */ | |
| (function(){ | |
| var bind = Function.prototype.bind; | |
| Function.prototype.bind = function () { | |
| var bound = bind.apply(this, arguments); | |
| bound.source = this.source || this; |