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 restify = require('restify'); | |
| // Authentication | |
| var passport = require('passport'); | |
| var LocalStrategy = require('passport-local').Strategy; | |
| var sessions = require("client-sessions"); | |
| var server = restify.createServer(); | |
| server.use(restify.queryParser()); | |
| server.use(restify.bodyParser()); |
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
| // Usual function | |
| function distance(p1,p2){ | |
| var dx = p2.x-p1.x; | |
| var dy = p2.y-p1.y; | |
| return Math.sqrt(dx*dx + dy*dy); | |
| } | |
| // Faster approximation | |
| function distanceApprox(p1,p2){ | |
| // Approximation by using octagons approach | |
| var x = p2.x-p1.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
| for (var i=1; i <= 20; i++) | |
| { | |
| if (i % 15 == 0) | |
| console.log("FizzBuzz"); | |
| else if (i % 3 == 0) | |
| console.log("Fizz"); | |
| else if (i % 5 == 0) | |
| console.log("Buzz"); | |
| else | |
| console.log(i); |
NewerOlder