Skip to content

Instantly share code, notes, and snippets.

@BonsaiDen
Created February 9, 2012 19:49
Show Gist options
  • Save BonsaiDen/1782388 to your computer and use it in GitHub Desktop.
Save BonsaiDen/1782388 to your computer and use it in GitHub Desktop.
Stuffs
[{
"type": "comment.multi",
"value": "/**\n * Copyright (c) 2011 Ivo Wetzel.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */",
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 21,
"column": 4
}
}, {
"type": "block.paren",
"value": "(",
"start": {
"line": 23,
"column": 1
},
"end": {
"line": 23,
"column": 2
},
"lvl": 1,
"values": [{
"type": "identifier",
"value": "global",
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 8
}
}, {
"type": "punct.dot",
"value": ".",
"start": {
"line": 23,
"column": 8
},
"end": {
"line": 23,
"column": 9
}
}, {
"type": "identifier",
"value": "window",
"start": {
"line": 23,
"column": 9
},
"end": {
"line": 23,
"column": 15
}
}, {
"type": "operator.logic.or",
"value": "||",
"start": {
"line": 23,
"column": 16
},
"end": {
"line": 23,
"column": 18
}
}, {
"type": "identifier",
"value": "exports",
"start": {
"line": 23,
"column": 19
},
"end": {
"line": 23,
"column": 26
}
}]
}, {
"type": "punct.dot",
"value": ".",
"start": {
"line": 23,
"column": 27
},
"end": {
"line": 23,
"column": 28
}
}, {
"type": "identifier",
"value": "Class",
"start": {
"line": 23,
"column": 28
},
"end": {
"line": 23,
"column": 33
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 23,
"column": 34
},
"end": {
"line": 23,
"column": 35
}
}, {
"type": "keyword.function",
"value": "function",
"start": {
"line": 23,
"column": 36
},
"end": {
"line": 23,
"column": 44
}
}, {
"type": "identifier",
"value": "BaseClass",
"start": {
"line": 23,
"column": 45
},
"end": {
"line": 23,
"column": 54
}
}, {
"type": "block.paren",
"value": "(",
"start": {
"line": 23,
"column": 54
},
"end": {
"line": 23,
"column": 55
},
"lvl": 1,
"values": [{
"type": "identifier",
"value": "ctor",
"start": {
"line": 23,
"column": 55
},
"end": {
"line": 23,
"column": 59
}
}]
}, {
"type": "block.curly",
"value": "{",
"start": {
"line": 23,
"column": 61
},
"end": {
"line": 23,
"column": 62
},
"lvl": 1,
"values": [{
"type": "keyword.var",
"value": "var",
"start": {
"line": 25,
"column": 5
},
"end": {
"line": 25,
"column": 8
}
}, {
"type": "identifier",
"value": "c",
"start": {
"line": 25,
"column": 9
},
"end": {
"line": 25,
"column": 10
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 25,
"column": 11
},
"end": {
"line": 25,
"column": 12
}
}, {
"type": "string.single",
"value": "'constructor'",
"start": {
"line": 25,
"column": 13
},
"end": {
"line": 25,
"column": 26
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 25,
"column": 26
},
"end": {
"line": 25,
"column": 27
}
}, {
"type": "identifier",
"value": "func",
"start": {
"line": 26,
"column": 9
},
"end": {
"line": 26,
"column": 13
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 26,
"column": 14
},
"end": {
"line": 26,
"column": 15
}
}, {
"type": "identifier",
"value": "BaseClass",
"start": {
"line": 26,
"column": 16
},
"end": {
"line": 26,
"column": 25
}
}, {
"type": "block.brace",
"value": "[",
"start": {
"line": 26,
"column": 25
},
"end": {
"line": 26,
"column": 26
},
"lvl": 2,
"values": [{
"type": "identifier",
"value": "c",
"start": {
"line": 26,
"column": 26
},
"end": {
"line": 26,
"column": 27
}
}]
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 26,
"column": 28
},
"end": {
"line": 26,
"column": 29
}
}, {
"type": "identifier",
"value": "call",
"start": {
"line": 27,
"column": 9
},
"end": {
"line": 27,
"column": 13
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 27,
"column": 14
},
"end": {
"line": 27,
"column": 15
}
}, {
"type": "identifier",
"value": "BaseClass",
"start": {
"line": 27,
"column": 16
},
"end": {
"line": 27,
"column": 25
}
}, {
"type": "punct.dot",
"value": ".",
"start": {
"line": 27,
"column": 25
},
"end": {
"line": 27,
"column": 26
}
}, {
"type": "identifier",
"value": "call",
"start": {
"line": 27,
"column": 26
},
"end": {
"line": 27,
"column": 30
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 27,
"column": 30
},
"end": {
"line": 27,
"column": 31
}
}, {
"type": "identifier",
"value": "isBase",
"start": {
"line": 28,
"column": 9
},
"end": {
"line": 28,
"column": 15
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 28,
"column": 15
},
"end": {
"line": 28,
"column": 16
}
}, {
"type": "identifier",
"value": "isMethod",
"start": {
"line": 28,
"column": 17
},
"end": {
"line": 28,
"column": 25
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 28,
"column": 25
},
"end": {
"line": 28,
"column": 26
}
}, {
"type": "identifier",
"value": "i",
"start": {
"line": 29,
"column": 9
},
"end": {
"line": 29,
"column": 10
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 29,
"column": 11
},
"end": {
"line": 29,
"column": 12
}
}, {
"type": "number.integer",
"value": "0",
"start": {
"line": 29,
"column": 13
},
"end": {
"line": 29,
"column": 14
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 29,
"column": 14
},
"end": {
"line": 29,
"column": 15
}
}, {
"type": "identifier",
"value": "key",
"start": {
"line": 29,
"column": 16
},
"end": {
"line": 29,
"column": 19
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 29,
"column": 19
},
"end": {
"line": 29,
"column": 20
}
}, {
"type": "identifier",
"value": "props",
"start": {
"line": 29,
"column": 21
},
"end": {
"line": 29,
"column": 26
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 29,
"column": 26
},
"end": {
"line": 29,
"column": 27
}
}, {
"type": "identifier",
"value": "value",
"start": {
"line": 29,
"column": 28
},
"end": {
"line": 29,
"column": 33
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 29,
"column": 33
},
"end": {
"line": 29,
"column": 34
}
}, {
"type": "identifier",
"value": "gl",
"start": {
"line": 29,
"column": 35
},
"end": {
"line": 29,
"column": 37
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 29,
"column": 38
},
"end": {
"line": 29,
"column": 39
}
}, {
"type": "keyword.this",
"value": "this",
"start": {
"line": 29,
"column": 40
},
"end": {
"line": 29,
"column": 44
}
}, {
"type": "punct.semicolon",
"value": ";",
"start": {
"line": 29,
"column": 44
},
"end": {
"line": 29,
"column": 45
}
}, {
"type": "comment.line",
"value": "// Class constructor",
"start": {
"line": 31,
"column": 5
},
"end": {
"line": 31,
"column": 25
}
}, {
"type": "comment.line",
"value": "// Using new creates a new instance as usual",
"start": {
"line": 32,
"column": 5
},
"end": {
"line": 32,
"column": 49
}
}, {
"type": "comment.line",
"value": "// omitting it will act like a Super() constructor where the first",
"start": {
"line": 33,
"column": 5
},
"end": {
"line": 33,
"column": 71
}
}, {
"type": "comment.line",
"value": "// argument is the instance of the subclass",
"start": {
"line": 34,
"column": 5
},
"end": {
"line": 34,
"column": 48
}
}, {
"type": "keyword.var",
"value": "var",
"start": {
"line": 35,
"column": 5
},
"end": {
"line": 35,
"column": 8
}
}, {
"type": "identifier",
"value": "clas",
"start": {
"line": 35,
"column": 9
},
"end": {
"line": 35,
"column": 13
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 35,
"column": 14
},
"end": {
"line": 35,
"column": 15
}
}, {
"type": "keyword.function",
"value": "function",
"start": {
"line": 35,
"column": 16
},
"end": {
"line": 35,
"column": 24
}
}, {
"type": "block.paren",
"value": "(",
"start": {
"line": 35,
"column": 24
},
"end": {
"line": 35,
"column": 25
},
"lvl": 2,
"values": []
}, {
"type": "block.curly",
"value": "{",
"start": {
"line": 35,
"column": 27
},
"end": {
"line": 35,
"column": 28
},
"lvl": 2,
"values": [{
"type": "identifier",
"value": "isBase",
"start": {
"line": 37,
"column": 9
},
"end": {
"line": 37,
"column": 15
}
}, {
"type": "operator.assign.assign",
"value": "=",
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 17
}
}, {
"type": "keyword.this",
"value": "this",
"start": {
"line": 37,
"column": 18
},
"end": {
"line": 37,
"column": 22
}
}, {
"type": "operator.compare.not",
"value": "!=",
"start": {
"line": 37,
"column": 23
},
"end": {
"line": 37,
"column": 25
}
}, {
"type": "identifier",
"value": "gl",
"start": {
"line": 37,
"column": 26
},
"end": {
"line": 37,
"column": 28
}
}, {
"type": "punct.semicolon",
"value": ";",
"start": {
"line": 37,
"column": 28
},
"end": {
"line": 37,
"column": 29
}
}, {
"type": "keyword.statement.conditional.if",
"value": "if",
"start": {
"line": 38,
"column": 9
},
"end": {
"line": 38,
"column": 11
}
}, {
"type": "block.paren",
"value": "(",
"start": {
"line": 38,
"column": 12
},
"end": {
"line": 38,
"column": 13
},
"lvl": 3,
"values": [{
"type": "identifier",
"value": "ctor",
"start": {
"line": 38,
"column": 13
},
"end": {
"line": 38,
"column": 17
}
}, {
"type": "block.brace",
"value": "[",
"start": {
"line": 38,
"column": 17
},
"end": {
"line": 38,
"column": 18
},
"lvl": 4,
"values": [{
"type": "identifier",
"value": "c",
"start": {
"line": 38,
"column": 18
},
"end": {
"line": 38,
"column": 19
}
}]
}, {
"type": "operator.compare.equal",
"value": "==",
"start": {
"line": 38,
"column": 21
},
"end": {
"line": 38,
"column": 23
}
}, {
"type": "identifier",
"value": "func",
"start": {
"line": 38,
"column": 24
},
"end": {
"line": 38,
"column": 28
}
}]
}, {
"type": "block.curly",
"value": "{",
"start": {
"line": 38,
"column": 30
},
"end": {
"line": 38,
"column": 31
},
"lvl": 3,
"values": [{
"type": "block.paren",
"value": "(",
"start": {
"line": 39,
"column": 13
},
"end": {
"line": 39,
"column": 14
},
"lvl": 4,
"values": [{
"type": "identifier",
"value": "isBase",
"start": {
"line": 39,
"column": 14
},
"end": {
"line": 39,
"column": 20
}
}, {
"type": "punct.tenary",
"value": "?",
"start": {
"line": 39,
"column": 21
},
"end": {
"line": 39,
"column": 22
}
}, {
"type": "identifier",
"value": "ctor",
"start": {
"line": 39,
"column": 23
},
"end": {
"line": 39,
"column": 27
}
}, {
"type": "punct.colon",
"value": ":",
"start": {
"line": 39,
"column": 28
},
"end": {
"line": 39,
"column": 29
}
}, {
"type": "identifier",
"value": "call",
"start": {
"line": 39,
"column": 30
},
"end": {
"line": 39,
"column": 34
}
}]
}, {
"type": "punct.dot",
"value": ".",
"start": {
"line": 39,
"column": 35
},
"end": {
"line": 39,
"column": 36
}
}, {
"type": "identifier",
"value": "apply",
"start": {
"line": 39,
"column": 36
},
"end": {
"line": 39,
"column": 41
}
}, {
"type": "block.paren",
"value": "(",
"start": {
"line": 39,
"column": 41
},
"end": {
"line": 39,
"column": 42
},
"lvl": 4,
"values": [{
"type": "identifier",
"value": "isBase",
"start": {
"line": 39,
"column": 42
},
"end": {
"line": 39,
"column": 48
}
}, {
"type": "punct.tenary",
"value": "?",
"start": {
"line": 39,
"column": 49
},
"end": {
"line": 39,
"column": 50
}
}, {
"type": "keyword.this",
"value": "this",
"start": {
"line": 39,
"column": 51
},
"end": {
"line": 39,
"column": 55
}
}, {
"type": "punct.colon",
"value": ":",
"start": {
"line": 39,
"column": 56
},
"end": {
"line": 39,
"column": 57
}
}, {
"type": "identifier",
"value": "ctor",
"start": {
"line": 39,
"column": 58
},
"end": {
"line": 39,
"column": 62
}
}, {
"type": "punct.comma",
"value": ",",
"start": {
"line": 39,
"column": 62
},
"end": {
"line": 39,
"column": 63
}
}, {
"type": "identifier",
"value": "arguments",
"start": {
"line": 39,
"column": 64
},
"end": {
"line": 39,
"column": 73
}
}]
}, {
"type": "punct.semicolon",
"value": ";",
"start": {
"line": 39,
"column": 74
},
"end": {
"line": 39,
"column": 75
}
}]
}]
}]
}, {
"type": "group.curly.close",
"value": "}",
"start": {
"line": 42,
"column": 5
},
"end": {
"line": 42,
"column": 6
},
"lvl": 2
}, {
"type": "punct.semicolon",
"value": ";",
"start": {
"line": 42,
"column": 6
},
"end": {
"line": 42,
"column": 7
}
}, {
"type": "group.curly.close",
"value": "}",
"start": {
"line": 43,
"column": 1
},
"end": {
"line": 43,
"column": 2
},
"lvl": 1
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment