This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (exports) { | |
function urlsToAbsolute(nodeList) { | |
if (!nodeList.length) { | |
return []; | |
} | |
var attrName = 'href'; | |
if (nodeList[0].__proto__ === HTMLImageElement.prototype | |
|| nodeList[0].__proto__ === HTMLScriptElement.prototype) { | |
attrName = 'src'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// view engine setup - erased | |
// app.set('views', path.join(__dirname, 'views')); | |
// app.set('view engine', 'jade'); | |
app.use(favicon(path.join(__dirname,'dist','favicon.ico'))); | |
app.use(logger('dev')); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded()); | |
app.use(cookieParser()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BaseClass () { | |
this.doSomething = function () { | |
}; | |
} | |
BaseClass.prototype.someObject = {}; | |
BaseClass.prototype.sharedSomething = function () { | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( global ) { | |
var ModPattern = function() { | |
function api1 (argument) { | |
return this.publicInstanceValue++; | |
} | |
function api2 (argument) { | |
return privateInstanceValue++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(global) { | |
function OOPPattern(value) { | |
this.publicInstanceValue = value || 10; | |
var privateValue = 0; | |
var privatFn = function(argument) { | |
return 1 + 2; | |
} | |
this.api2NeedsPrivateValue = function(argument) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ClassName(name) { | |
this.name = name; | |
} | |
ClassName.prototype = { | |
constructor: ClassName, | |
greet: function () { | |
return 'My name is' + this.name; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('capeloMod', []); | |
app.provider('demo', function() { | |
var cfg = 'Default'; | |
this.setCfg = function(providedCfg) { | |
cfg = providedCfg; | |
}; | |
this.$get = ['dependencyName', function(dependency) { | |
return new dependency(cfg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('capeloMod', []); | |
//factory style, more involved but more sophisticated | |
app.factory('demoFactory', function() { | |
var publicValue = 0; | |
var privateValue = 0; | |
function apiFn() { | |
return this.publicValue++; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('capeloMod', []); | |
app.service('demoService', function() { | |
this.publicValue = 0; | |
var privateValue = 0; | |
var privateFn = function() { | |
return 1 + 2; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Originally from http://www.abeautifulsite.net/detecting-mobile-devices-with-javascript/ | |
**/ | |
var isMobile = { | |
Android: function() { | |
return navigator.userAgent.match(/Android/i); | |
}, | |
BlackBerry: function() { | |
return navigator.userAgent.match(/BlackBerry/i); |