diff --git a/app.js b/app.js
index 729bfdb8ff..73e19ad850 100644
--- a/app.js
+++ b/app.js
@@ -158,7 +158,9 @@ var trusted = [
'wss://hub.togetherjs.com',
'*.ytimg.com',
'wss://fcctogether.herokuapp.com',
- '*.bitly.com'
+ '*.bitly.com',
+ 'http://cdn.inspectlet.com/',
+ 'http://hn.inspectlet.com/'
];
app.use(helmet.contentSecurityPolicy({
diff --git a/public/js/lib/bonfire/bonfireInit.js b/public/js/lib/bonfire/bonfireInit.js
index 2100c87a3f..55c80ea99d 100644
--- a/public/js/lib/bonfire/bonfireInit.js
+++ b/public/js/lib/bonfire/bonfireInit.js
@@ -67,7 +67,7 @@ var requests;
// (re)initializes the plugin
var reset = function() {
requests = 0;
- plugin = new jailed.Plugin(path+'plugin_v0.1.4.js', api);
+ plugin = new jailed.Plugin(path+'plugin_v0.1.5.js', api);
plugin.whenDisconnected( function() {
// give some time to handle the last responce
setTimeout( function() {
diff --git a/public/js/lib/bonfire/plugin_v0.1.4.js b/public/js/lib/bonfire/plugin_v0.1.4.js
deleted file mode 100644
index f71c0d34f1..0000000000
--- a/public/js/lib/bonfire/plugin_v0.1.4.js
+++ /dev/null
@@ -1,82 +0,0 @@
-
-// executes the given code and handles the result
-var run = function(code) {
- var result = {
- input: code,
- output: null,
- error: null,
- type: null
- };
-
- try {
- var codeExec = runHidden(code);
- result.type = typeof codeExec;
- result.output = stringify(codeExec);
- } catch(e) {
- result.error = e.message;
- }
-
- application.remote.output(result);
- self.close();
-};
-
-
-// protects even the worker scope from being accessed
-var runHidden = function(code) {
-
- var importScript = function(url) {
- var error = null;
- try {
- importScripts(url);
- } catch (e) {
- error = e;
- console.log('Unable to load ramda!');
- }
- };
- var indexedDB = null;
- var location = null;
- var navigator = null;
- var onerror = null;
- var onmessage = null;
- var performance = null;
- var self = null;
- var webkitIndexedDB = null;
- var postMessage = null;
- var close = null;
- var openDatabase = null;
- var openDatabaseSync = null;
- var webkitRequestFileSystem = null;
- var webkitRequestFileSystemSync = null;
- var webkitResolveLocalFileSystemSyncURL = null;
- var webkitResolveLocalFileSystemURL = null;
- var addEventListener = null;
- var dispatchEvent = null;
- var removeEventListener = null;
- var dump = null;
- var onoffline = null;
- var ononline = null;
- importScript("https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js");
- var _ = R;
-
-
- return eval(code);
-}
-
-
-// converts the output into a string
-var stringify = function(output) {
- var result;
-
- if (typeof output == 'undefined') {
- result = 'undefined';
- } else if (output === null) {
- result = 'null';
- } else {
- result = JSON.stringify(output) || output.toString();
- }
-
- return result;
-}
-
-
-application.setInterface({run:run});
diff --git a/public/js/lib/bonfire/plugin_v0.1.5.js b/public/js/lib/bonfire/plugin_v0.1.5.js
new file mode 100644
index 0000000000..9e63a18b88
--- /dev/null
+++ b/public/js/lib/bonfire/plugin_v0.1.5.js
@@ -0,0 +1,88 @@
+
+// executes the given code and handles the result
+var run = function(code) {
+ var result = {
+ input: code,
+ output: null,
+ error: null,
+ type: null
+ };
+
+ try {
+ var codeExec = runHidden(code);
+ result.type = typeof codeExec;
+ result.output = stringify(codeExec);
+ } catch(e) {
+ result.error = e.message;
+ }
+
+ application.remote.output(result);
+ self.close();
+};
+
+
+// protects even the worker scope from being accessed
+var runHidden = function(code) {
+
+ var importScript = function(url) {
+ var error = null;
+ try {
+ importScripts(url);
+ } catch (e) {
+ error = e;
+ console.log('Unable to load %s!', url);
+ }
+ };
+ var indexedDB = null;
+ var location = null;
+ var navigator = null;
+ var onerror = null;
+ var onmessage = null;
+ var performance = null;
+ var self = null;
+ var webkitIndexedDB = null;
+ var postMessage = null;
+ var close = null;
+ var openDatabase = null;
+ var openDatabaseSync = null;
+ var webkitRequestFileSystem = null;
+ var webkitRequestFileSystemSync = null;
+ var webkitResolveLocalFileSystemSyncURL = null;
+ var webkitResolveLocalFileSystemURL = null;
+ var addEventListener = null;
+ var dispatchEvent = null;
+ var removeEventListener = null;
+ var dump = null;
+ var onoffline = null;
+ var ononline = null;
+ importScripts(
+ "https://cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min.js");
+ importScripts(
+ "https://cdnjs.cloudflare.com/ajax/libs/chai/2.2.0/chai.min.js"
+ )
+
+ var expect = chai.expect;
+ var assert = chai.assert;
+
+
+ return eval(code);
+}
+
+
+// converts the output into a string
+var stringify = function(output) {
+ var result;
+
+ if (typeof output == 'undefined') {
+ result = 'undefined';
+ } else if (output === null) {
+ result = 'null';
+ } else {
+ result = JSON.stringify(output) || output.toString();
+ }
+
+ return result;
+}
+
+
+application.setInterface({run:run});
diff --git a/seed_data/bonfireMDNlinks.js b/seed_data/bonfireMDNlinks.js
index 891e307687..29bed7d4ca 100644
--- a/seed_data/bonfireMDNlinks.js
+++ b/seed_data/bonfireMDNlinks.js
@@ -1,7 +1,7 @@
// MDN Links
/* These links are for Bonfires. Each key/value pair is used to render a Bonfire with approrpiate links.
-
+
The text of the key is what the link text will be, e.g. Global Array Object
General convention is to use the page title of the MDN reference page.
@@ -14,11 +14,12 @@ var links =
"Global String Object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
"Boolean Objects" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean",
"RegExp" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp",
+ "Global Function Object": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function",
"Arguments object" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments",
// ========= PROPERTIES/MISC
"String.length" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length",
-
+
// ========== OBJECT METHODS
"Object.getOwnPropertyNames()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames",
@@ -68,7 +69,7 @@ var links =
"Math.min()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min",
"Math.pow()" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow",
"Remainder" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_(.25)",
-
+
// ======== GENERAL JAVASCRIPT REFERENCES
"Arithmetic Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators",
"Comparison Operators" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators",
diff --git a/seed_data/bonfires.json b/seed_data/bonfires.json
index 2a9a396b99..2ee74a11d9 100644
--- a/seed_data/bonfires.json
+++ b/seed_data/bonfires.json
@@ -562,6 +562,23 @@
],
"MDNlinks" : ["Object.hasOwnProperty()", "Object.getOwnPropertyNames()"]
},
+ {
+ "_id": "a97fd23d9b809dac9921074f",
+ "name": "Arguments Optional",
+ "difficulty": "2.22",
+ "description": [
+ "Create a function that sums two arguments together. If only one argument is provided, return a function that expects one additional argument and will return the sum.",
+ "For example, add(2, 3) should return 5, and add(2) should return a function that is waiting for an argument so that var sum2And = add(2); return sum2And(3); // 5
",
+ "If either argument isn't a valid numbers, return undefined"
+ ],
+ "challengeSeed": "function add() {\n return false;\n}\n\nadd(2,3);",
+ "tests": [
+ "expect(add(2, 3)).to.equal(5);",
+ "expect(add(2)(3)).to.equal(5);",
+ "expect(add('http://bit.ly/IqT6zt')).to.be.undefined;"
+ ],
+ "MDNlinks": ["Global Function Object", "Arguments object"]
+ },
{
"_id": "a2f1d72d9b908d0bd72bb9f6",
"name": "Make a Person",
diff --git a/views/bonfire/show.jade b/views/bonfire/show.jade
index 6c9997d4b4..071acd1d0b 100644
--- a/views/bonfire/show.jade
+++ b/views/bonfire/show.jade
@@ -15,7 +15,7 @@ block content
script(src='/js/lib/codemirror/mode/javascript/javascript.js')
script(src='/js/lib/jailed/jailed.js')
script(src='/js/lib/bonfire/bonfireInit.js')
- script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js")
+ script(src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.13.0/ramda.min.js")
.row