This file contains 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
'use strict' | |
app = angular.module 'app' | |
app.directive 'defaultValue', -> | |
require : 'ngModel' | |
restrict : 'A' | |
link : ($scope, element, attrs, ngModel) -> | |
ngModel.$parsers.push (value) -> | |
if _.isEmpty value |
This file contains 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
'use strict' | |
app = angular.module 'app' | |
app.directive 'limitLength', -> | |
require : 'ngModel' | |
restrict : 'A' | |
link : ($scope, element, attrs, ngModel) -> | |
ngModel.$parsers.push (value) -> | |
if !_.isEmpty(value) and value.length > attrs.limitLength |
This file contains 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
/** @module AuthUtils */ | |
'use strict'; | |
var _ = require('lodash'); | |
var response = require('./response'); | |
module.exports = { | |
ensureAuthenticated: function(loginUrl){ | |
return function(req, res, next){ |
This file contains 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
'use strict' | |
app = angular.module 'app' | |
app.directive 'preventDefault', ($state) -> | |
restrict : 'A' | |
link : ($scope, element, attrs) -> | |
element.bind 'click', (event) -> | |
if event.preventDefault | |
event.preventDefault() |
This file contains 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
'use strict' | |
app = angular.module 'app' | |
app.filter 'threeDots', ($filter) -> | |
(value, maxLength) -> | |
if value.length > maxLength | |
$filter('limitTo')(value, maxLength).trim() + '...' | |
else | |
value |
This file contains 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
'use strict' | |
app = angular.module 'app' | |
app.factory 'FileReader', ($q) -> | |
readDataAsUrl: (file, scope) -> | |
deferred = $q.defer() | |
reader = new FileReader() |
This file contains 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
/** @module RouteUtils */ | |
'use strict'; | |
var _ = require('lodash'); | |
var mongoose = require('mongoose'); | |
var url = require('url'); | |
var lodashDeep = require('lodash-deep'); | |
var Response = require('./response'); |
This file contains 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
// Example usage | |
// The example will fetch current weather data from Buenos Aires, | |
// failing on purpose the first 2 times to demonstrate the Backoff strategy. | |
// Ensure you have Bluebird and superagent installed. | |
// | |
// Save the following code in example.js and run it with 'node example.js' | |
const Bluebird = require('bluebird'); | |
const superagent = require('superagent'); | |
const promiseUtils = require('./promise_utils'); |
NewerOlder