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
| import scala.collection.mutable.ListBuffer | |
| val msg1 = new Network1(1); | |
| val msg2 = new Network1(2); | |
| val msg3 = new Network1(3); | |
| val pipeline = new PipeLine[Network1](); | |
| pipeline.register((x: Network1) => new GetUndeliveredOrders(x)) | |
| .register((x: Network1) => new GetDeliveryInfo(x)) | |
| .register((x: Network1) => new GetPodImage(x)) |
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 utils = utils || {}; | |
| // pipeline | |
| utils.pipeline = function(){ | |
| var handlers = []; | |
| var register = function(handler){ | |
| if(typeof handler !== 'function') | |
| throw { name: 'InvalidTypeException', description: 'handler should be a function'} |
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
| // set up arrays | |
| var numbers = [1,12,4,18,9,7,11,3,101,5,6]; | |
| var strings = ['this','is','a','collection','of','words']; | |
| // array.reduce - find largest number | |
| var largestValue = numbers.reduce(function(x,y){ return x > y ? x : y }); | |
| console.log('largest number: ' + largestValue); | |
| // array.reduce - find longest string |
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 utils = utils || {}; | |
| utils.linq = function(){ | |
| range = function(start, end){ | |
| var numbers = []; | |
| for(var x=start; x<=end;x++) | |
| numbers.push(x); | |
| return numbers; | |
| } |
NewerOlder