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 class IntegrationClient : IIntegrationClient | |
{ | |
private readonly ISettings _settings; | |
public IntegrationClient(ISettings settings) | |
{ | |
if (settings == null) throw new ArgumentNullException("settings"); | |
_settings = settings; | |
} | |
public async Task<T> ExecuteGetRequest<T>(RestRequest request) | |
{ |
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
//cache | |
public async Task<T> TryGet<T>(string key, Func<Task<T>> ifCacheMissAction) | |
{ | |
if (ifCacheMissAction == null) throw new ArgumentNullException("ifCacheMissAction"); | |
if (string.IsNullOrEmpty(key)) throw new ArgumentNullException("key"); | |
if (_isEnabled) | |
{ | |
RedisValue redisValue = Cache.StringGet(key); | |
// the following is a bit yolo | |
if (redisValue.HasValue && redisValue != "{}") |
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'; | |
module app.common { | |
export interface IExampleController { | |
doSomething(value: string): void; | |
} | |
class ExampleController { | |
// properties here | |
public exampleProp: boolean; |
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'; | |
module app.services { | |
export interface IExampleService { | |
get<T>(): T | |
} | |
export class ExampleService implements IExampleService { | |
constructor(private $http: ng.IHttpService) { | |
} |
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'; | |
module app.common { | |
export class Guid { | |
public static newGuid(): string { | |
return this.generateGuid(); | |
} |
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'; | |
module app.exception { | |
angular.module('app.exception') | |
.config(['$provide', ($provide: ng.auto.IProvideService) => { | |
$provide.decorator('$exceptionHandler', ['$delegate', 'app.services.LoggingService', '$injector', | |
($delegate: ng.IExceptionHandlerService, logger: app.services.ILoggingService, $injector: any) => (exception: any) => { | |
var errorMessage = ''; | |
if (!_.isUndefined(exception) && !_.isNull(exception)) { |
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'; | |
module app.common { | |
export function spinner(): ng.IDirective { | |
return { | |
restrict: 'E', | |
replace: true, | |
templateUrl: 'views/templates/spinner.html' // this template can contain an spinner SVG | |
}; | |
} |
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'; | |
module app.common { | |
export function stopEvent(): ng.IDirective { | |
return { | |
restrict: 'A', | |
link: (scope: any, element: any) => { | |
element.bind('click', (event: any) => { | |
// other ng-click handlers shouldn't be triggered | |
event.stopPropagation(event); | |
}); |
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'; | |
module app.services { | |
export interface ILoggingService { | |
logError(errorMessage: string): void; | |
tryClearErrors(): void; | |
} | |
export class LoggingService implements ILoggingService { | |
constructor(private $injector: any, private connectivityService: app.services.IConectivityService) { |
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 static class ListExtensions | |
{ | |
public static IEnumerable<IEnumerable<T>> Chunk<T>(this IEnumerable<T> source, int chunkSize) | |
{ | |
Argument.CheckIfNull(source, "source"); | |
Argument.CheckIfNull(chunkSize, "chunkSize"); | |
if (chunkSize <= 0) | |
{ | |
throw new ArgumentException("chunkSize should be positive", "chunkSize"); |
OlderNewer