Skip to content

Instantly share code, notes, and snippets.

@gbellmann
gbellmann / sample-app.csproj
Created July 19, 2018 14:20
Modified .csproj file for when you need to add bundled scripts that are not included in your project file to the MSDeploy package.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
<PropertyGroup>
<CopyAllFilesToSingleFolderForMSDeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForMSDeployDependsOn);
</CopyAllFilesToSingleFolderForMSDeployDependsOn>
describe("Una suite es una función", function() {
it("y una spec también es una función", function() {
expect(true).toBe(true);
});
it("cada spec testea un caso", function() {
expect(false).not.toBe(true);
});
});
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Samples.App_Start;
namespace Samples
{
public class MvcApplication : HttpApplication
{
@gbellmann
gbellmann / AppInsightsConfig.cs
Created January 29, 2017 17:53
Helper class to configure Application Insights and our Telemetry Processor
using System.Configuration;
using Microsoft.ApplicationInsights.Extensibility;
namespace Samples.App_Start
{
public static class AppInsightsConfig
{
public static void RegisterAppInsights()
{
TelemetryConfiguration.Active.InstrumentationKey =
@gbellmann
gbellmann / My404Filter.cs
Created January 29, 2017 17:47
Telemetry processor to ignore certain 404 errors in Application Insights
using System;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
namespace Samples
{
public class My404Filter : ITelemetryProcessor
{
private ITelemetryProcessor Next { get; set; }
@gbellmann
gbellmann / index.js
Created September 11, 2016 18:54
Sample Node.js Azure Function using a require to import a library
// Importamos la librería underscore.js
var _ = require('underscore');
module.exports = function(context) {
// Usamos la librería underscore.js que importamos
var matched_names = _
.where(context.bindings.myInput.names, {first: 'Juan'});
// El resto del código de nuestra función
}
@gbellmann
gbellmann / index.js
Last active September 11, 2016 18:40
Azure Function written with Node.js using named arguments
// O se pueden incluir parámetros adicionales como variables de entrada
module.exports = function(context, miDisparador, miEntrada, miOtraEntrada) {
// la lógica de la función va aquí
};
@gbellmann
gbellmann / index.js
Created September 11, 2016 18:38
Azure Function written with Node.js using optional arguments
// Se debe incluir el context, pero los otros argumentos son opcionales
module.exports = function(context) {
// Las variables de entrada adicionales pueden accederse en la propiedad arguments
if(arguments.length === 2) {
context.log('La función recibió 2 argumentos de entrada');
}
};
@gbellmann
gbellmann / run.csx
Created September 11, 2016 18:33
Default C# Azure Function code triggered by a timer
using System;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"Función con trigger por timer en C# ejecutada el {DateTime.Now}");
}
@gbellmann
gbellmann / project.json
Created September 11, 2016 17:58
Sample Azure Functions C# project.json file
{
"frameworks": {
"net46":{
"dependencies": {
"Microsoft.Azure.Search": "2.0.4-preview"
}
}
}
}