Skip to content

Instantly share code, notes, and snippets.

import element from 'virtual-element'; // Using deku
// import React from 'react'; // Switch to this if you are using React
import pathToRegexp from 'path-to-regexp';
export function renderRoutes(path, routes) {
return Object.keys(routes).map(routePath => {
let paramsInfo = [];
let re = pathToRegexp(routePath, paramsInfo);
let paramNames = paramsInfo.map(p => p.name);
@mbritton
mbritton / backbone_jqm_sketch.js
Created June 22, 2012 13:55
Backbone / jQM sketch
var productCollection = {};
var eventMediator = {};
var viewUtils = new utils();
window.products = new Products();
window.product;
window.CartView = Backbone.View.extend({
template : _.template(viewUtils.getTemplate('Cart')),
render : function(eventName) {
@eriwen
eriwen / qunit-to-junit-for-phantom.js
Created November 14, 2011 02:33
JUnit XML output for QUnit tests compatible with PhantomJS 1.3
var module, moduleStart, testStart, testCases = [],
current_test_assertions = [];
console.log('<?xml version="1.0" encoding="UTF-8"?>');
console.log('<testsuites name="testsuites">');
QUnit.begin = function() {
// That does not work when invoked in PhantomJS
}
QUnit.moduleStart = function(context) {
moduleStart = new Date();