Skip to content

Instantly share code, notes, and snippets.

View jakkaj's full-sized avatar

Jordan Knight jakkaj

View GitHub Profile
@jakkaj
jakkaj / app.js
Created August 1, 2017 05:56
Set session data in back channel
bot.dialog('/SetUser',
(session, args, next) => {
session.conversationData.user = args.result.user;
session.endDialog(`Okay set user`);
}
);
// bot listening for inbound backchannel events
bot.on('event', function (event) {
bot.beginDialog(event.address, "*:/SetUser", {result:{user:event.value}});
@jakkaj
jakkaj / index.js
Created July 13, 2017 13:20
Pick out intents and ordering them by score
.onDefault((session, args) => {
var intentsSorted = _.sortBy(args.intents, (intent)=>{
return 1-intent.score;
});
var top = intentsSorted[0];
var second = intentsSorted[1];
var viz = require('viz.js');
buildGraph(dot){
return viz(dot, { format: "svg" });
}
var ab = consolodatedBindings.allBindings;
var ioNodes = new dotgraph.node("record", "filled", "yellow",
consolodatedBindings.allBindings.map((ele) => ele.name)
);
var funcNodes = new dotgraph.node("doublecircle", "filled", "lightblue",
allFunctions.map((ele) => ele.funcName)
);
@jakkaj
jakkaj / GraphVizTest.js
Created April 14, 2017 06:16
Test run of GraphViz generation in Node
var viz = require('viz.js');
var fs = require('fs');
var svg2png = require("svg2png");
var result = viz("digraph { x -> y -> z; }", { format: "svg" });
svg2png(result)
.then(buffer => fs.writeFile("dest.png", buffer))
.catch(e => console.error(e));
@jakkaj
jakkaj / Ignite Australia 2017 Production.json
Created April 10, 2017 01:23
Ignite Australia LUIS.JSON file
{
"luis_schema_version": "2.0.0",
"versionId": "0.1",
"name": "Ignite Australia 2017 Production",
"desc": "",
"culture": "en-us",
"intents": [
{
"name": "AddToSchedule"
},
@jakkaj
jakkaj / LoginHandlerService.cs
Created April 10, 2017 01:16
Login Handler for Ignite Australia bot
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Arlo.SDK.Contract;
using EventBot.SupportLibrary.Contract;
using EventBot.SupportLibrary.Entity;
using EventBot.SupportLibrary.Utils.JwtHelpers;
@jakkaj
jakkaj / AuthenticationController
Created April 10, 2017 01:13
Ignite Australia Bot Authenication Controller
using EventBot.Ignite;
using Microsoft.ApplicationInsights;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Connector;
using Microsoft.IdentityModel.Protocols;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Diagnostics;
@jakkaj
jakkaj / AuthService.cs
Created April 10, 2017 01:09
Authentication Service for the Ignite Bot
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Web;
using EventBot.SupportLibrary.Contract;
using Microsoft.ApplicationInsights;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Luis.Models;
using Microsoft.Bot.Connector;
using Xamling.Azure.Portable.Contract;
@jakkaj
jakkaj / CachingService.cs
Created April 10, 2017 00:49
CachingService which will check a local cache before making a call to original data service
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Arlo.SDK.Contract;
using Arlo.SDK.Entities.Base;
using Arlo.SDK.Entities.Product;
using Arlo.SDK.Entities.System;