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
javascript:(function(){var l,r="";while(l=prompt(r)){try{r=String(eval(l));}catch(e){r="Error: "+e}}})(); |
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 Promise () { | |
this._thens = []; | |
} | |
Promise.prototype = { | |
/* This is the "front end" API. */ | |
// then(onResolve, onReject): Code waiting for this promise uses the | |
// then() method to be notified when the promise is complete. There |
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
/** | |
* The simplest processes (cooperative tasks) with Scheduler | |
* (sort of Erlang's processes but without messages yet) | |
* See also: http://www.dabeaz.com/coroutines/index.html | |
* | |
* Deps: JS 1.7 with generators (yield) | |
* | |
* by Dmitry Soshnikov <[email protected]> | |
* 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
<!DOCTYPE html> | |
<!-- | |
This is a simple experiment relying on ECMAScript 6 Proxies. To try this out, | |
use Aurora (http://www.mozilla.org/en-US/firefox/channel/). | |
The goal was to create a HTML writer where the method names were really just | |
the HTML tags names, but without manually creating each method. This uses | |
a Proxy to create a shell to an underlying writer object that checks each | |
method name to see if it's in a list of known tags. |
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 Yehonatan Daniv <[email protected]> | |
* | |
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
* | |
* 0. You just DO WHAT THE FUCK YOU WANT TO. | |
* | |
* supr.js is a simple wrapper for the Object.create mechanism of ES5, | |
* to ease the creation of objects via the Create function. |
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
// A response to jashkenas's fine proposal for minimalist JavaScript classes. | |
// Harmony always stipulated classes as sugar, so indeed we are keeping current | |
// JavaScript prototype semantics, and classes would only add a syntactic form | |
// that can desugar to ES5. This is mostly the same assumption that Jeremy | |
// chose, but I've stipulated ES5 and used a few accepted ES.next extensions. | |
// Where I part company is on reusing the object literal. It is not the syntax | |
// most classy programmers expect, coming from other languages. It has annoying | |
// and alien overhead, namely colons and commas. For JS community members who |
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
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
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
<script>var _errs=["<application id here>"];(function(a,b){if(b.location.protocol!="https:"){a.onerror=function(a,c,b) | |
{_errs.push({m:a,u:c,l:b});return!1};var d=function(){var a=b.createElement("script"), | |
c=b.getElementsByTagName("script")[0];a.src="http://errorception.com/projects/"+_errs[0]+"/beacon.js";c.parentNode.insertBefore(a,c)}; | |
a.addEventListener?a.addEventListener("load",d,!1):a.attachEvent("onload",d)}})(window,document);</script> |
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(F) { | |
var registered_ids = {}, | |
id_to_module_map = {}, | |
interim_actions = {}, | |
cleanup_actions = {}, | |
clicked_ids = {}, | |
queueing = true; | |
function register_id(id, callbacks, required_module) { | |
id = id.replace('*', '.*'); |
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
// Simulated static super references (as proposed by Allen Wirfs-Brock). | |
// http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super | |
//------------------ Library | |
function inherits(subC, superC) { | |
var subProto = Object.create(superC.prototype); | |
// At the very least, we keep the "constructor" property | |
// At most, we preserve additions that have already been made | |
copyOwnFrom(subProto, subC.prototype); |
OlderNewer