Question answer on Stack Overflow:
A Pen by Chris Spittles on CodePen.
.truncate { | |
width: 250px; | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} |
angular.module('caco.feed.filter', []) | |
.filter('sumByKey', function() { | |
return function(data, key) { | |
if (typeof(data) === 'undefined' || typeof(key) === 'undefined') { | |
return 0; | |
} | |
var sum = 0; | |
for (var i = data.length - 1; i >= 0; i--) { | |
sum += parseInt(data[i][key]); |
# @ngdoc overview | |
# @name ui-commons.hook | |
# @description | |
# a directive to hook enter/leave events to select children without watchers or broadcasting | |
@directive = angular.module('ui-commons.hook', []) | |
@directive.controller 'UiHookController', ['$scope', ($scope) -> | |
hooks = [] | |
@addHook = (fn) -> |
@directive = angular.module('ui-commons.autosave', []) | |
@directive.directive 'autosave', ['formHandler', 'promiseTrackers', '$timeout', (formHandler, promiseTrackers, $timeout) -> | |
restrict: 'A' | |
require: ['form', 'autosave'] | |
controller: ($scope) -> | |
submitExpr = null | |
tracker = null | |
currentPromise = null | |
formDelay = null |
Question answer on Stack Overflow:
A Pen by Chris Spittles on CodePen.
# via http://wiki.apache.org/couchdb/Installing_on_Ubuntu
sudo apt-get install --yes build-essential curl git
sudo apt-get install --yes python-software-properties python g++ make
sudo apt-get install -y erlang-dev erlang-manpages erlang-base-hipe erlang-eunit erlang-nox erlang-xmerl erlang-inets
sudo apt-get install -y libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool
# via http://ftp.fau.de/apache/couchdb/source/1.6.1/
cd /tmp
#loading-bar { | |
pointer-events: all; | |
z-index: 99999; | |
border: none; | |
margin: 0px; | |
padding: 0px; | |
width: 100%; | |
height: 100%; | |
top: 0px; | |
left: 0px; |
"platformio-ide-terminal": | |
ansiColors: | |
normal: | |
black: | |
red: 88 | |
green: 110 | |
blue: 117 | |
alpha: 1 | |
blue: | |
red: 38 |
This is an example of how to test an Angular Resource created with $resource
.
Important take aways:
$resource
for Angular Cached Resource) without needing toi go change all previous tests.transformResponse
action property of a $resource
, you replace the default angular parser that is transforming backend response from string to JSON. It has some logic to ensure that the response is a JSON and can be parsed securely. You can use it by injecting $http
into your factory and using `$http.defaults.transformRespon