- An unobtrusive revenue system, and possibly an api for in-game currency
- A viewport that's either full-screen, or full-window. Distraction-free environment
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 toggleWidget = function(selector){ | |
| var state = { | |
| on: false | |
| , onFunc: function(){} | |
| , offFunc: function(){} | |
| , $el: $(selector) | |
| } | |
| o.$el.mouseenter(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
| function Foo() {this.bak = 'bax';} | |
| Object.prototype.bar = 'baz5'; | |
| Foo.prototype.bar = 'baz'; | |
| Foo.bam = 'ban'; | |
| var foo = new Foo(); | |
| /* | |
| At this point, the chains are: | |
| Foo -> Function.prototype -> null | |
| foo -> Foo.prototype -> Object.prototype -> null |
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 client = new XMLHttpRequest(); | |
| client.open('GET', 'maxid.php', false); | |
| client.send(null); | |
| maxid=client.responseText; | |
| JSON.parse(maxid); | |
| return maxid; |
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($, root) { | |
| root.x24 = { | |
| slide: new Backbone.Model.extend({ | |
| id: 'i1', | |
| title: 't1', | |
| text: 'tt1', | |
| link: 'l1' | |
| }) | |
| } |
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 = 0; i < 10; i++) { | |
| process.nextTick(function (i) { console.log(i); }.bind(this, i)); | |
| } | |
| // Prints 10 x 10 times | |
| // I want it to print 1 - 10 without using an external array to store i | |
| /* | |
| In browser test edition |
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 loadFunction() { | |
| var obj = {}; | |
| Request({ | |
| url: "http://0.0.0.0:4567/annotations/" + annotationId, | |
| onComplete: function (response) { | |
| if ( obj.oncomplete ) obj.oncomplete(response); | |
| } | |
| }).get(); |
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 MyClass = function() { | |
| this.cosa = 0; | |
| console.log('constructor'); | |
| }; | |
| (function() { | |
| var func1 = function() { | |
| console.log('func1'); | |
| console.log(this.cosa); | |
| }; |
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 router() { | |
| function router(method, url) { | |
| var r = get_routes(method), rl = r.length | |
| for (var i = 0; i < rl; ++i) { | |
| if (r[i].type == 'string') { | |
| if (r[i].url == url) | |
| return [[url], r[i].callback] } | |
| else { | |
| var route = r[i] |
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 interface = function(inter){ | |
| return { | |
| test: function(testee) { | |
| for ( var prop in inter ) { | |
| if ( !(prop in testee) ) return false } | |
| return true | |
| } | |
| } | |
| } |