A canjs Control that setup Google Analytics (injects JS) and can automatically:
- track hashChange (on or off) as pageView
- track any can.Model / Observe / Model.List / Observe.List events as Google Analytics events
can.Model.List.prototype.filter = function(cb) { | |
var res = []; | |
debugger; | |
this.each(function(amodel, pos, models) { | |
var ares = cb.call(amodel, pos, models); | |
if (ares === true) {res.push(amodel)} | |
}); | |
return res | |
} |
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
/* | |
* requirejs plugin that loads mustache templates from the baseUrl and registers it in can.view | |
* Optimize/compiles/minifies the templates when the requirejs optimizer is run | |
* usage: | |
* require([ | |
.., | |
'mustl!path/to/mustache/tmp.mustache' // no need to add a var in callback function for your template | |
], function () {}) | |
*/ |
module.exports = function(grunt) { | |
'use strict'; | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
grunt.initConfig({ | |
// .... | |
mochaWebdriver: { | |
options: { |
<html> | |
<head> | |
<style type="text/less"> | |
@bgColor: #ccc; | |
@avatarHeight: 20px; | |
@imageWidth: 64px; | |
body { | |
background-color: @bgColor; | |
} |
npm install
To test that phantomjs works as expected: ./node_modules/.bin/phantomjs phantom-script.js USERNAME PASSWD
Then run it from nodejs: node phantom.js
(the username and password are hardcoded in this file for now...)
The phantom.js
script just proves that it works, by checking the "username" in the top right corner of the Premier homepage.
Note that it still takes about 6 seconds for phantomjs to login into QA.
const express = require('express'); | |
const cons = require('consolidate'); | |
const bodyParser = require('body-parser'); | |
const cookieParser = require('cookie-parser'); | |
const session = require('express-session'); | |
const passport = require('passport'); | |
const FacebookStrategy = require('passport-facebook').Strategy; | |
const LocalStrategy = require('passport-local').Strategy; | |
const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn; |