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
<table> | |
<tr ng-repeat="item in items"> | |
<td in-line-editable ng-model="item" model-att="name"></td> | |
<td in-line-editable ng-model="item" model-att="value" display-filter="currency" s-numbers-only="true"></td> | |
</tr> | |
</table> |
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
var app = angular.module('demoApp', ['simple.ui.inLineEdit']); |
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
$rootScope.$on('$stateChangeStart', function (ev, to, toParams, from, fromParams) { | |
if (!authorizationService.isAuthorized($location.url()) { | |
// redirect to error page | |
$location.path('/error'); | |
} | |
}); |
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
app.directive('restrict', function(authService){ | |
return{ | |
compile: function(element, attr, linker){ | |
//attr.access is an attribute on the element with the roles that apply for that element. | |
var authorized = authService.isAuthorized(attr.access); | |
if(!authorized){ | |
// Remove element from DOM. | |
} |
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
var nock = require('nock'); | |
var assert = require('assert'); | |
var sinon = require('sinon'); | |
var weeklygames = require('../../app/server/weeklygames.js'); | |
var gamesData = require('./weeklygames-data.json'); | |
describe('weeklygames', function(){ | |
var service; | |
var baseUrl = 'http://basketball.example.com'; |
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
public Optional<Integer> optionalAdd(Optional<Integer> val1, Optional<Integer> val2) { | |
if(val1.isPresent() && val2.isPresent()) { | |
return Optional.of(val1.get() + val2.get()); | |
} | |
return Optional.empty(); | |
} |
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
public Optional<Integer> optionalAdd(Optional<Integer> val1, Optional<Integer> val2) { | |
return | |
val1.flatMap( first -> | |
val2.flatMap( second -> | |
Optional.of(first + second) | |
)); | |
} |
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
private abstract class Counter { | |
abstract Optional<Integer> colourCount(); | |
} | |
private abstract Optional<Counter> fetchThisMonthCounter(); | |
private abstract Optional<Counter> fetchPreviousMonthCounter(); | |
// ************ blah blah blah | |
// ... | |
public Optional<Integer> totalColourCount() { | |
Optional<Counter> thisMonth = fetchThisMonthCounter(); |
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
private abstract Optional<Counter> fetchThisMonthCounts(); | |
private abstract Optional<Counter> fetchPreviousMonthCounts(); | |
public Optional<Integer> totalColour() { | |
return fetchThisMonthCounts().flatMap(Counter::colour).flatMap(colour1 -> | |
fetchPreviousMonthCounts().flatMap(Counter::colour).flatMap(colour2 -> | |
Optional.of(colour1 + colour2) | |
)); | |
} |
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
public<U> Result<U> flatMap(Function<? super S, Result<U>> mapper) { | |
if (error.isPresent()) { | |
return fail(error.get()); | |
} | |
return mapper.apply(value.get()); | |
} |
OlderNewer