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
| // Original - @Gozola. This is a reimplemented version (with a few bug fixes). | |
| window.WeakMap = window.WeakMap || (function () { | |
| var privates = Name() | |
| return { | |
| get: function (key, fallback) { | |
| var store = privates(key) | |
| return store.hasOwnProperty("value") ? | |
| store.value : fallback | |
| }, |
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
| head | |
| meta(charset="utf-8") | |
| meta(http-equiv="X-UA-Compatible", content="IE=edge,chrome=1") | |
| title= title | |
| link(rel='stylesheet', href='/public/js/libs/nodeunit/nodeunit.css') | |
| script(src="/public/js/libs/nodeunit/nodeunit.js") | |
| script(data-main="/public/js/app-test", src="/public/js/libs/require/require.js") | |
| <!-- nodeunit HTML --> |
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
| define([/* dependencies */], function(dep){ | |
| return { | |
| "test my module": function (test) { | |
| // run test | |
| } | |
| }; | |
| }); |
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
| if (typeof(Name) === 'undefined') { | |
| (function(global) { | |
| "use strict"; | |
| function defineNamespace(object, namespace) { | |
| var privates = Object.create(object), | |
| base = object.valueOf; | |
| Object.defineProperty(object, 'valueOf', { | |
| value: function valueOf(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
| var Mage = { | |
| cast: function _cast() { | |
| console.log(this.name + ' cast ' + magic); | |
| } | |
| }; | |
| var BlackMage = { | |
| fira: function _fira() { this.cast('fira') }, | |
| watera: function _watera() { this.cast('watera') } | |
| blizarra: function _blizarra(){ this.cast('blizarra') } |
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
| module.exports = function (mediator) { | |
| mediator.once('boot.ready', f); | |
| }; | |
| var f = function() { | |
| //UGH! MAKES EVERY MODULE CODE START WITH 1 INDENTS... solution? | |
| } |
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
| //handles audio information of clients, eg. codecs they can play | |
| module.exports = function(availClients, unavailClients, io) { | |
| var util = require('util'); | |
| //for each connection | |
| io.sockets.on('connection', handleConnection); | |
| function handleConnection (socket) { | |
| //fired when the client discovered it's codec capabilities | |
| socket.on('codecCapability', function (mp3, mp4, ogg) { |
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 fs = require('fs'); | |
| var http = require('http'); | |
| var events = require('events'); | |
| var MyServer = new function() { | |
| var server = Object.create(new events.EventEmitter); | |
| server.on("response", function(response) { | |
| response.writeHead(200, {'Content-Type': 'text/plain'}); | |
| response.end('Hello World\n'); |