Skip to content

Instantly share code, notes, and snippets.

View hegemonic's full-sized avatar

Jeff Williams hegemonic

View GitHub Profile
@hegemonic
hegemonic / parse-tree.json
Created March 21, 2013 00:33
Parse tree for ol3 type expression
{
"type": "RecordType",
"fields": [
{
"type": "FieldType",
"key": {
"type": "NameExpression",
"name": "animate"
},
"value": {
@hegemonic
hegemonic / class.js
Created December 28, 2012 22:39
issue with escodegen.attachComments and leading block comments
/**
* @class MyClass
*/
function MyClass() {}
@hegemonic
hegemonic / gist:4118882
Created November 20, 2012 16:12
Callback doc proposals

Syntax Proposal 1

  1. Callbacks are documented in a @typedef.
  2. If a parameter contains a callback function, its type should refer to the @typedef.
  3. If a parameter refers to a @typedef for a Function, templates should give it special treatment. (This would probably necessitate adding a callback: true property to one of the doclets at parse time.)

Example

/**
{
"type": "Program",
"start": 20,
"end": 193,
"commentsBefore": [
"* @constructor "
],
"loc": {
"start": {
"line": 2,
[
{
"comment": "/** @constructor */",
"meta": {
"lineno": 2,
"path": "tmp",
"filename": "overload.js",
"code": {
"id": "astnode344078580",
"name": "Person",
@hegemonic
hegemonic / gist:3687286
Created September 9, 2012 21:01
Like https://gist.github.com/3687189, but with a method named n
/** @constructor */
function Person() {
}
/**
Set the person's name.
@param {string} n - The name to set.
*//**
Get the person's name
@returns {string} The name.
[
{
"comment": "/** @constructor */",
"meta": {
"lineno": 2,
"path": "tmp",
"filename": "overload.js",
"code": {
"id": "astnode344078580",
"name": "Person",
@hegemonic
hegemonic / gist:3687189
Created September 9, 2012 20:49
JS file with docs for overloaded methods
/** @constructor */
function Person() {
}
/**
Set the person's name.
@param {string} n - The name to set.
*//**
Get the person's name
@returns {string} The name.
[
{
"comment": "/**\n * Foo\n *\n * @name Foo\n * @constructor\n */",
"meta": {
"lineno": 1,
"path": "tmp",
"filename": "test.js",
"code": {
}
},
{
"classes": {
"Foo": {
"name": "Foo",
"description": "",
"extends": [
],
"access": "",
"virtual": false,
"fires": "",