This file contains 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
<html> | |
<head> | |
<title>...</title> | |
<style> | |
<!-- | |
p { | |
border-left:4px solid #00FF00; | |
display:block; |
This file contains 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
<div id="navbar" class="navbar"> | |
<ul id="navtabs" class="navtabs floatcontainer<vb:if condition="$show['member'] AND $notifications_total"> notify</vb:if>"> | |
{vb:raw template_hook.navtab_start} | |
<vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'"> | |
<li class="selected"><a class="navtab" href="{vb:link forumhome}">{vb:rawphrase forum}</a> | |
<ul class="floatcontainer"> | |
{vb:raw template_hook.navbar_start} | |
<vb:if condition="$show['searchbuttons']"> | |
<vb:if condition="$show['member']"> | |
<li><a href="search.php?{vb:raw session.sessionurl}do=getnew&contenttype=vBForum_Post">{vb:rawphrase new_posts_nav}</a></li> |
This file contains 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 the express framework | |
var express = require('express'); | |
// include the node-walker module | |
// -> npm install node-walker | |
var walker = require('node-walker'); | |
// the express server instance | |
var app = express.createServer(); |
This file contains 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 the filesystem module | |
var fs = require('fs'); | |
// fs.readFile: read a file and all its contents, | |
// then call a callback function | |
fs.readFile('/some/file', function (err, contents) { | |
// if any error occurred, throw it | |
if (err) throw err; |
This file contains 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
// create EventEmitter instance | |
var myEventEmitter = new EventEmitter(); | |
// attach a property | |
myEventEmitter.someVar = "some var"; | |
// add event listener for "test" | |
myEventEmitter.on('test', function () | |
console.log(this.someVar); | |
}); |
This file contains 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
// create EventEmitter instance | |
var myEventEmitter = new EventEmitter(); | |
// add event listener for "test" | |
myEventEmitter.on('test', function () | |
console.log('2'); | |
}); | |
// the following code will output 1 2 3 | |
console.log('1'); |
This file contains 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 fs = require('fs'); | |
// read a file | |
function read_the_file(filename, callback) { | |
// begin by reading a file | |
fs.readFile(filename, function (err, contents) { | |
// an error occurred, i.e. the file was not found. | |
// instead of throwing an error, skip the other |
This file contains 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 ee = new (require('events').EventEmitter)(); | |
var foo; | |
// listener function | |
ee.on('test', function (newValue) { | |
foo = newValue; | |
}); | |
// before emitting | |
foo = 'one'; |
This file contains 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 Robot = function(robot) { | |
robot.rotateCannon(-90); | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(); | |
//i'll add a clone but i need to refactor collision | |
//robot.clone(); | |
}; |
This file contains 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
// to install the connect framework, go to your applications directory | |
// and type "npm install connect" in your command prompt. | |
// to launch the webserver, place this file in your application | |
// directory and execute it using "node index.js" | |
var connect = require('connect') | |
, app = connect() | |
, webserver = require('http').createServer(app); |
OlderNewer