Skip to content

Instantly share code, notes, and snippets.

View CESARDELATORRE's full-sized avatar

Cesar De la Torre CESARDELATORRE

  • Microsoft Corp
  • Redmond, WA, U.S.
View GitHub Profile
@CESARDELATORRE
CESARDELATORRE / Partial-eShopOnContainers-docker-compose.yml
Created May 15, 2018 18:52
Partial-eShopOnContainers-docker-compose.yml
mobileshoppingapigw:
image: eshop/ocelotapigw:${TAG:-latest}
build:
context: .
dockerfile: src/ApiGateways/ApiGw-Base/Dockerfile
mobilemarketingapigw:
image: eshop/ocelotapigw:${TAG:-latest}
build:
context: .
@CESARDELATORRE
CESARDELATORRE / ApiGateways-Web.Bff.Shopping-apigw-configuration-basket-specific.json
Created May 15, 2018 18:49
ApiGateways-Web.Bff.Shopping-apigw-configuration-basket-specific.json
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "basket.api",
"Port": 80
}
],
"UpstreamPathTemplate": "/api/{version}/b/{everything}",
{
"ReRoutes": [
{
"DownstreamPathTemplate": "/api/{version}/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "catalog.api",
"Port": 80
}
public async Task<Catalog> GetCatalogItems(int page,int take, int? brand, int? type)
{
_apiClient = new HttpClient();
var itemsQs = $"items?pageIndex={page}&pageSize={take}";
var filterQs = "";
if (brand.HasValue || type.HasValue)
{
var brandQs = (brand.HasValue) ? brand.Value.ToString() : "null";
var typeQs = (type.HasValue) ? type.Value.ToString() : "null";
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
/// <summary>
/// When working with cloud services and Docker containers, it's very important to always catch
@CESARDELATORRE
CESARDELATORRE / git.migrate
Created October 10, 2016 19:52
Move your existing git repository # to a new remote repository
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
### OPTION 1 ###########################################################################################
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
@CESARDELATORRE
CESARDELATORRE / git.migrate
Created October 10, 2016 18:51 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@CESARDELATORRE
CESARDELATORRE / ServiceFabricPartitionRangeKeys.cs
Last active July 1, 2016 01:50
This code tells you the Partition's Range Keys (High and Low) of your current partition in a Service Fabric Stateful Reliable Service
// This code can run in any Azure Service Fabric Stateful Reliable Service
// within the method protected override async Task RunAsync(CancellationToken cancellationToken)
//Aditional or similar code in: https://github.com/Azure-Samples/service-fabric-dotnet-getting-started/blob/master/Services/WordCount/WordCount.WebService/Controllers/DefaultController.cs
var fabricClient = new FabricClient();
string serviceUri = "fabric:/MySFApp/MyStatefulService";
Uri serviceUriInstance = new Uri(serviceUri);
System.Fabric.Query.ServicePartitionList partitionList =
@CESARDELATORRE
CESARDELATORRE / project.json
Created June 29, 2016 17:20
Sample project.json of ASP.NET Core 1.0 RTM supporting multiple frameworks
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
@CESARDELATORRE
CESARDELATORRE / Example1.cs
Created June 28, 2016 21:41 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)