This file contains hidden or 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
> console.log(Promise.toString()) | |
function Promise() { [native code] } | |
undefined | |
> function Promise(execute) { | |
... this.then = execute; | |
... this.catch = function catch(handler) { | |
..... return this; | |
..... }; | |
... } | |
... ; |
This file contains hidden or 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 mistigri = (function(){ | |
/* | |
if (Promise === undefined) | |
{ | |
console.log("Making a fake Promise"); | |
var Promise = function Promise(execute) { | |
this.then = execute; // Mistigri always returns, even if it ran into problems | |
this.catch = function(onrej) { | |
return this; |
This file contains hidden or 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 handleAllIncludes = function handleAllIncludes(includes, config, rendered, size, finish) { | |
if (includes.work.length === 0) | |
{ | |
if (finish !== undefined) finish(rendered); | |
return; | |
} | |
if (finish === undefined) | |
{ | |
console.warn("Mistigri needs a callback - ignoring all includes"); | |
return; |
This file contains hidden or 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
Configuration options | |
--- | |
. | |
. | |
. | |
__reader__ : _function(string, function(string), function(Error))_ | |
A function that reads a template and passes it to the first callback | |
when it is ready. The second callback can be used in case of error. |
This file contains hidden or 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 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/> | |
<title>Test JS</title> | |
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> | |
<link rel="stylesheet" type="text/css" href=".css"/> | |
<script> | |
"use strict"; |
This file contains hidden or 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
// Does not exactly perform a clone, but all fields are same as original var | |
function clone(x) { | |
function Build() {}; | |
Build.prototype = x; | |
return new Build; | |
} |
This file contains hidden or 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 a = {}; | |
a.foo = function() { | |
return "foo"; | |
} | |
a.bar = function() { | |
return "bar"; | |
} |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct | |
{ | |
char* description; | |
} event; | |
typedef void (*fun)(); |
This file contains hidden or 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
; I have this in my code | |
(defn fun [f, continuation] (-> f continuation)) ; pass f to continuation | |
; I want to change it to this | |
(defn fun [argc, f, continuation] | |
(continuation | |
(fn [& args] |
This file contains hidden or 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
(defn dodo*fork [coroutine, return] | |
(let [outcome (promise)] | |
(println "starting coroutine") | |
(future | |
(coroutine ; run in parallel | |
(fn [& args] (deliver outcome {:return args})) | |
(fn [e] (deliver outcome {:error e})))) | |
(println "returning blocking function") | |
(return | |
(fn wait [return, error] |