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
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
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(Object, String){ | |
// (C) WebReflection - Mit Style License | |
// @about implementing "in" operator as generic object method | |
// returns primitive value or object itself | |
function toValue(obj) { | |
switch (true) { | |
case isInstanceOf(obj, Boolean): | |
case isInstanceOf(obj, Number): |
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 track(object) { | |
// how to track old libraries, by Andrea Giammarchi | |
// var report = track(genericObject); | |
// ... run whatever you run usually ... | |
// console.log(report); | |
function createGetterSetterIfNecessary(key) { | |
return hasOwnProperty.call(result, key = key.slice(1)) ? | |
result[key] |
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
document.createElement = function ( | |
createElement, // the native one | |
createResponse // the function "in charge" | |
) { | |
return function (nodeName) { | |
var result, src; | |
// if we are creating a script | |
if (/^script$/i.test(nodeName)) { | |
// result will be a place holder | |
result = createElement.call( |
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
document.retrieveSelector = (function (filter) { | |
// (C) WebReflection - Mit Style License | |
function elementsOnly(element) { | |
return element.nodeType == 1; | |
} | |
function createSelector(element, documentElement, path, first) { | |
var |
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
var module = (function create( | |
namespace, handler, module, Proxy | |
) { | |
// ------------------------------------ | |
// (C) WebReflection - MitStyle License | |
// ------------------------------------ | |
// @dependency npm install node-proxy | |
// ------------------------------------ | |
// var sys = module.sys; | |
// sys.print("it works!"); |
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
// could be used to inspect objects runtime | |
// e.g. with IDE for suggestion | |
// requires a modern JS engine in the IDE | |
var properties = function ( | |
getNames, // alias Object.getOwnPropertyNames | |
getDescriptor,// alias Object.getOwnPropertyDescriptor | |
has, // alias {}.hasOwnProperty | |
toString // alias Function.prototype.toString | |
) { | |
// (C) WebReflection - Mit Style License |
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 (Object) { | |
/** | |
* @name Object.prototype.define | |
* @description A simplified and intuitive way to define objects properties. | |
* @requires Object.defineProperty, Array.prototype.forEach (native or shimmed) | |
* @author Andrea Giammarchi (@WebReflection) | |
* @license Mit Style | |
*/ | |
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
<!doctype html> | |
<html> | |
<head> | |
<title>wru</title> | |
<!-- https://github.com/WebReflection/wru --> | |
<script src="define.js"></script> | |
<script>function wru(wru){var assert=wru.assert,async=wru.async; | |
// enojy your tests! |
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 () { | |
// Andrea Giammarchi - Mit Style License | |
// note: it's not production ready | |
function dispatch(callback) { | |
callback.call(this.r, this.e); | |
} | |
function add(callback) { | |
this.handlers.indexOf(callback) < 0 && |
OlderNewer