In .verb.md
where you want to inject the TOC:
<!-- toc -->
Done!
/** | |
* Compares two software version numbers (e.g. "1.7.1" or "1.2b"). | |
* | |
* This function was born in http://stackoverflow.com/a/6832721. | |
* | |
* @param {string} v1 The first version to be compared. | |
* @param {string} v2 The second version to be compared. | |
* @param {object} [options] Optional flags that affect comparison behavior: | |
* <ul> | |
* <li> |
/** | |
* Connects to the QRS API (REST based) using certificates. | |
* See this article for more information about connecting to QRS https://help.qlik.com/sense/2.0/en-us/developer/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Connect-API.htm | |
* | |
*/ | |
var https = require('https'); | |
var fs = require('fs'); |
export class EnumSymbol { | |
sym = Symbol.for(name); | |
value: number; | |
description: string; | |
constructor(name: string, {value, description}) { | |
if(!Object.is(value, undefined)) this.value = value; | |
if(description) this.description = description; |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"codedeploy:RegisterApplicationRevision", | |
"codedeploy:GetApplicationRevision" | |
], | |
"Resource": [ |
{{#each (expand 'content/*.md')}} | |
{{#markdown}} | |
{{inline .}} | |
{{/markdown}} | |
{{/each}} |
// for demo: http://jsbin.com/jeqesisa/7/edit | |
// for detailed comments, see my SO answer here http://stackoverflow.com/questions/8853396/logical-operator-in-a-handlebars-js-if-conditional/21915381#21915381 | |
/* a helper to execute an IF statement with any expression | |
USAGE: | |
-- Yes you NEED to properly escape the string literals, or just alternate single and double quotes | |
-- to access any global function or property you should use window.functionName() instead of just functionName() | |
-- this example assumes you passed this context to your handlebars template( {name: 'Sam', age: '20' } ), notice age is a string, just for so I can demo parseInt later | |
<p> | |
{{#xif " this.name == 'Sam' && this.age === '12' " }} |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
import * as winston from 'winston'; | |
import * as path from 'path'; | |
let logger = new winston.Logger(); | |
export default { | |
middleware(req, res, next){ | |
console.log('verbose', req.method, req.url, res.statusCode); | |
next(); | |
} |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/foobar'); | |
// bootstrap mongoose, because syntax. | |
mongoose.createModel = function(name, options) { | |
var schema = new mongoose.Schema(options.schema); | |
for (key in options.self) { | |
if (typeof options.self[key] !== 'function') continue; | |
schema.statics[key] = options.self[key]; | |
} |