Skip to content

Instantly share code, notes, and snippets.

View StefanRiedmann's full-sized avatar

Stefan StefanRiedmann

View GitHub Profile
@StefanRiedmann
StefanRiedmann / helper.js
Created November 21, 2016 14:46
webpack-dev-server configuration
var path = require('path');
var _root = path.resolve(__dirname, '..');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var environmentUrls = require("./includes/environmentUrls.json");
var cssincludes = require("./includes/cssincludes.json");
var jsincludes = require("./includes/jsincludes.json");
function root(args) {
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [_root].concat(args));
@StefanRiedmann
StefanRiedmann / Settings.xaml
Created September 6, 2017 20:49
static bindingcontext for design time
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CicloConnect.Frontend.Views.SettingsPage"
xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
xmlns:vm="clr-namespace:CicloConnect.Frontend.ViewModels;"
BindingContext="{Binding Source={x:Static vm:DesignTimeViewModels.SettingsDummyViewModel}}
Title="Settings">
@StefanRiedmann
StefanRiedmann / App.xaml.cs
Created September 6, 2017 22:53
PrismApplication with DI
public partial class App : PrismApplication
{
private static bool _designContext = true;
public App() : base(null){}
public App(IPlatformInitializer initializer) : base(initializer) { }
protected override void OnInitialized()
{
@StefanRiedmann
StefanRiedmann / MainPage.xaml
Created September 6, 2017 22:54
Xamarin ContentPage with Prism's ViewModelLocator
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CicloConnect.Frontend.Views.MainPage"
xmlns:mvvm="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
mvvm:ViewModelLocator.AutowireViewModel="True"
Title="Main">
@StefanRiedmann
StefanRiedmann / Temp.cs
Created October 3, 2017 17:42
Test for creating an Infusionsoft Resthook
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using ServiceStack;
using Xunit;
namespace Tests
@StefanRiedmann
StefanRiedmann / InfusionsoftController.cs
Last active October 9, 2017 14:49
Webhooks with ASP .NET Core at the example of Infusionsoft
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Tools.Infusionsoft.Hook
{
[Route("api/[controller]")]
public class InfusionsoftController : Controller
@StefanRiedmann
StefanRiedmann / SlackWebhook.cs
Created January 26, 2018 17:56
Slack webhook as Azure Function
public static class SlackWebhook
{
[FunctionName("SlackWebhook")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(WebHookType = "slack")] HttpRequestMessage req,
[Queue(Constants.TranslateRequestQueue, Connection = "AzureWebJobsStorage")]
ICollector<TranslateRequest> translateQueue,
[Queue(Constants.SearchRequestQueue, Connection = "AzureWebJobsStorage")]
ICollector<SearchRequest> searchQueue,
[Queue(Constants.SentimentRequestQueue, Connection = "AzureWebJobsStorage")]
@StefanRiedmann
StefanRiedmann / Sentiment.cs
Created January 26, 2018 18:02
Disable Azure Function
[FunctionName("Sentiment")]
[Disable]
public static async Task Run([QueueTrigger(Constants.SentimentRequestQueue, Connection = "AzureWebJobsStorage")]SentimentRequest request,
[Queue(Constants.SlackmessageRequestQueue, Connection = "AzureWebJobsStorage")]ICollector<SlackMessage> outputQueueItem,
TraceWriter log)
{
//see https://github.com/StefanRiedmann/AzureFunctionsForSlack
}
@StefanRiedmann
StefanRiedmann / local.settings.json
Created January 26, 2018 18:51
Local settings for Azure Functions app
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "azure storage connectionstring",
"AzureWebJobsDashboard": "",
"TRANSLATOR_CLIENT_SECRET": "microsoft translation service secret"
}
}
@StefanRiedmann
StefanRiedmann / PersonContext.cs
Created March 14, 2018 20:30
DbContext for EntityFramework Core
using Microsoft.EntityFrameworkCore;
namespace TestProject
{
public class PersonContext : DbContext
{
DbSet<Person> Persons { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{