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 Something = function(){ }; | |
| Something.prototype.someFunc = function(){ | |
| if(this==Something.prototype){ | |
| console.log("called on prototype"); | |
| } else { | |
| console.log("called on instance of Something"); | |
| } | |
| }; |
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
| [{k:"z"},{k:"f"},{k:"a"},{k:"b"}].sort(function(a,b){ | |
| return a.k==b.k?0:a.k<b.k?-1:1; | |
| }); | |
| // yields : | |
| // [{k:"a"},{k:"b"},{k:"f"},{k:"z"}] |
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
| <html> | |
| <head> | |
| <script> | |
| function draw() { | |
| var canvas = document.getElementById("canvas"); | |
| var ctx = canvas.getContext("2d"); | |
| var offset = 150; | |
| var radius = 0; | |
| var orbits = 10; | |
| var pi = 3.1415926535897932384626433832795028; |
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
| <html> | |
| <body><div id="test"></div></body> | |
| <script src="jade.js"></script> | |
| <script> | |
| var jade = require("jade"); | |
| var template = "h1 #{value}"; | |
| var model = { | |
| escape: 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
| escape : function(attr) { | |
| var html; | |
| if (html = this._escapedAttributes[attr]) return html; | |
| var val = this.attributes[attr]; | |
| return this._escapedAttributes[attr] = escapeHTML(val == null ? '' : val); | |
| }, |
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 f1 = function(){ | |
| console.log(arguments); | |
| }; | |
| var f2 = function(a,b,c){ | |
| var args = []; | |
| for(var i=0;i<arguments.length;i++){ | |
| args[i] = arguments[i]; | |
| } | |
| args.push("__4__"); |
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
| \=======\ | |
| \\o/=\o/\ | |
| \ \=======\ Weeeeeeeeeeeee | |
| \ \\o/=\o/\ | |
| \ \=======\ | |
| \ \_______\ | |
| \/_=___=_/ | |
| _\\__\\_ | |
| ``\\``\\` | |
| _\\__\\_ |
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 Circle = function(options){ | |
| var private = { | |
| privateSecretToken: "this is a secret" | |
| }; | |
| return new (Backbone.Model.extend({ | |
| initialize: function(){ | |
| console.log(""); |
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 extend = function (protoProps, classProps) { | |
| var child = inherits(this, protoProps, classProps); | |
| child.extend = extend; | |
| return child; | |
| }; | |
| // Set up inheritance for the model, collection, and view. | |
| Backbone.Model.extend = Backbone.Collection.extend = Backbone.Controller.extend = Backbone.View.extend = extend; |
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 JimBob = function Barf(x){ this.x = x; }; | |
| JimBob.prototype.klass = "JimBobbbbb"; | |
| var creator = function(c, args){ | |
| var instance_of = {}; | |
| instance_of[c.klass] = function(){ | |
| return c; | |
| }; | |
| return new (instance_of[c.klass].call(this, args)); | |
| }; |