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 topics = ['Easy Handlebars Templating']; | |
| topics.shift(); | |
| //'Easy Handlebars Templating' |
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 topics = ['Native Loops','Functional Loops','Indications for Native Loops']; | |
| topics.shift(); | |
| //'Native Loops' |
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 array = [1,2,3,4,5,6,7,8,9,10]; | |
| for(var i = 0, _len = array.length; i < _len; i++){ | |
| //do something with array[i] | |
| } | |
| // new snippet | |
| var j = 0, _len = array.length; | |
| while(j < _len){ | |
| //do something with array[j] |
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
| topics.shift(); | |
| //'Functional Loops' |
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 array = [1,2,3,4,5,6,7,8,9,0], target = []; | |
| array.forEach(function(item){ | |
| //do something with each `item` here | |
| target.push(item); | |
| }); |
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 closuredObjects = [/*put a bunch of objects that need a closure here*/]; | |
| closuredObjects.forEach(function(item){ | |
| var invisibleProperties = {}; | |
| item.get = function(key){ | |
| return invisibleProperties[key]; | |
| }; | |
| item.set = function(key, value){ | |
| invisibleProperties[key] = value; | |
| return value; |
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
| topics.shift(); | |
| //'Indications for Native Loops' |
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
| function multiplyByTwo(item){return item*2;} | |
| function addTwo(item){return item+2;} | |
| function applyTransform(){ | |
| return Array.prototype.map.call(arguments, addTwo) | |
| .map(multiplyByTwo) | |
| .map(addTwo); | |
| } |
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
| ~function(NovelScript){ | |
| NovelScript.plugins.push(function(self){ | |
| var engine = new jWebAudio.SoundEngine(); | |
| var sources = []; | |
| self.on('audio:add', function(audioOptions){ | |
| var source; | |
| source = engine.addSoundSource({ | |
| 'url': audioOptions.src, | |
| 'preload': true, |
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
| !function(NovelScript){ | |
| NovelScript.plugin(function(self, options){ | |
| //do something to the current NovelScript object using the options provided | |
| }); | |
| //NovelScript.prototype is accessable here | |
| }(NovelScript); |