Skip to content

Instantly share code, notes, and snippets.

View ChetHarrison's full-sized avatar

Chet Harrison ChetHarrison

View GitHub Profile
@ChetHarrison
ChetHarrison / gist:9550dd615dfdf9f65b48
Created July 24, 2014 22:53
rxjs Observable.fromEvent suport for Marionette
// Check for Angular/jQuery/Zepto support
var jq =
!!root.angular && !!angular.element ? angular.element :
(!!root.jQuery ? root.jQuery : (
!!root.Zepto ? root.Zepto : null));
// Check for ember
var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
// Check for Backbone.Marionette
/* global requirejs */
'use strict';
var LIVERELOAD_PORT = 35729;
var SERVER_PORT = 9000;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
// # Globbing
[master:!][chet@Chets-MacBook-Pro:/Applications/MAMP/htdocs/WebSites/jsdoccer]
[22:22:18] $ node document.js
Generating syntax tree: input/js/example.js
Saving syntax tree: output/example.json
func
arg1
arg2
answer
[master:!?][chet@Chets-MacBook-Pro:/Applications/MAMP/htdocs/WebSites/jsdoccer]
[16:22:19] $ node document.js
Generating syntax tree: input/js/example.js
Saving syntax tree: output/example.json
[]
Generating syntax tree: input/js/marionette.application.js
Saving syntax tree: output/marionette.application.json
[ { namespace: 'Marionette',
functionName: 'Application',
params: [ 'options' ] } ]
so like here is my crude config
```
var typeMap = {
Program: {
parseTags: ['body'],
documentTags: []
},
ExpressionStatement: {
parseTags: ['expression'],
'use strict';
var EventEmitter = require('events').EventEmitter,
globalChannel = new EventEmitter(),
Rx = require('rx'),
nutrients = require('./food-objects/nutrients'),
nutrients,
defaultHandlers = {
onError: function (err) {
@ChetHarrison
ChetHarrison / gistbook.json
Created November 24, 2014 22:56
Anonymous Gistbook
{"title":"Anonymous Gistbook","author":"ChetHarrison","pages":[{"pageName":"","sections":[{"type":"text","source":"Welcome to Gistbook!"},{"type":"html","source":"<!-- template.html -->\n<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <title>Table</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <script src=\"http://fb.me/react-0.12.1.js\"></script>\n <script src=\"http://fb.me/JSXTransformer-0.12.1.js\"></script>\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css\">\n</head>\n\n<body>\n <div id=\"content\" class=\"container-fluid\">Table</div>\n <script type=\"text/jsx\" src='table.jsx'></sript>\n</body>\n\n</html>"},{"type":"javascript","source":"/** @jsx React.DOM */\n'use strict';\n\nvar Table = React.createClass({\n\t\n\trender: function() {\n\t\tvar rows = [];\n\t\t\n\t\tthis.props.datas.forEach(function(data) {\n\t\t\trows.push(<TableRow data={data} key={data.key} />)\n\t\t})\n\t\t\t\n\t\tretur
@ChetHarrison
ChetHarrison / decorator-pattern.js
Last active August 29, 2015 14:10
simple example of the decorator pattern.
// simple example of the decorator pattern.
'use strict';
var doccer = {
init: function(options) {
options = options || {};
this.src = options.src;
this.decorators = options.decorators;
},
@ChetHarrison
ChetHarrison / get-string-at-url.js
Created January 18, 2015 05:44
Node tool to grab contents of url and return it in a string
'use strict';
var fs = require('fs'),
path = require('path'),
jsToAst = require('./src/parsers/js-to-ast.js'),
https = require('https'),
rawGitScrUrl = 'https://rawgit.com/marionettejs/backbone.marionette/master/src/',
get, srcFileList, options;
'use strict';
var fs = require('fs'),
path = require('path'),
jsToAst = require('./src/parsers/js-to-ast.js'),
https = require('https'),
rawGitScrUrl = 'https://rawgit.com/marionettejs/backbone.marionette/master/src/',
get, srcFileList, options;