Skip to content

Instantly share code, notes, and snippets.

View IEvangelist's full-sized avatar
:octocat:
Coding for a better world 🤓

David Pine IEvangelist

:octocat:
Coding for a better world 🤓
View GitHub Profile
[alias]
del = "!f() { echo deleting remote $1 && git push origin --delete $1 && echo deleting local $1 && git branch -D $1; }; f";
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
{
"projects": [
"src",
"../../IEvangelist.NetCore.ClassLib/src",
"../../IEvangelist.NetCore.Services/src"
]
}
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
module ExampleModule {
export class ExampleService implements IExampleService {
static $inject = ["$http", "$q"];
private $http: ng.IHttpService;
private $q: ng.IQService;
constructor($http: ng.IHttpService,
$q: ng.IQService) {
this.$http = $http;
import {Observable} from "RxJS/Rx";
import {Injectable} from "@angular/core";
import {Http} from "@angular/http";
@Injectable() export class ExampleService {
constructor(private http: Http) { }
getFooBars(onNext: (fooBars: FooBar[]) => void) {
this.get("api/foobar")
.map(response => <FooBar[]>reponse.json())
// Simple .ctor()
constructor(private http: Http) { }
// Is equivalent to...
private http: Http;
constructor(http: Http) {
this.http = http;
}
// Simple .ctor()
constructor(http: Http) { }
// Is equivalent to...
http: Http; // When the access modifier is omitted it's defaulted to public
constructor(http: Http) {
this.http = http;
}
// If this call fails, we'll try it again with the same payload two times
getFooBars(onNext: (fooBars: FooBar[]) => void) {
this.get("api/foobar")
.map(response => <FooBar[]>response.json())
.retry(2)
.subscribe(onNext,
error =>
console.log("An error occurred when requesting api/foobar.", error));
}