View pubsub.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
In order to subscribe to the AWS IoT topic over WS (over MQQT), | |
you have to make sure that your Cognito identity has a proper IoT policy attached to it. | |
More details and the message from the official AWS support: | |
https://github.com/aws/aws-amplify/issues/749 | |
This code shows how you can dynamically attach a policy to the authenticated identity. | |
Make sure that your Authenticated IAM in the Cognito User Pool has proper IoT permissions. |
View transcript.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read more on http://www.pveller.com/smarter-conversations-part-4-transcript/ | |
const transcript = function (session, direction, message, next) { | |
session.privateConversationData.transcript = session.privateConversationData.transcript || []; | |
session.privateConversationData.transcript.push({ | |
direction, | |
message, | |
timestamp: new Date().toUTCString() | |
}); |
View sitecore-text-classifier.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$page = Get-Item -Path '/sitecore/content/Habitat/Home/Modules/Feature/Accounts' | |
$links = [Sitecore.Globals]::LinkDatabase | |
$processed = New-Object System.Collections.ArrayList | |
# template names of items that will be linked from the presentation field that are not datasources | |
$skip = @('Device','Layout','View rendering', 'Controller rendering', 'Test Definition', 'Multivariate Test Variable') | |
# shared and final layout | |
$layouts = @('{F1A1FE9E-A60C-4DDB-A3A0-BB5B29FE732E}', '{04BF00DB-F5FB-41F7-8AB7-22408372A981}') |
View sitecore-images-classifier.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$vision = 'https://api.projectoxford.ai/vision/v1.0/analyze' | |
$features = 'Categories,Tags,Description,Color' | |
$images = Get-ChildItem -Path '/sitecore/media library/Habitat/Images/Square' | |
$result = @() | |
foreach ($image in $images) | |
{ | |
# Reading the binary of the image so that we could send it to the Computer Vision API | |
$media_url = New-Object 'Sitecore.Resources.Media.MediaUri' $image |
View import.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://jockstothecore.com/content-import-with-powershell-treasure-hunt | |
function NormalizeName($name) | |
{ | |
# replace all special symbols with single spaces | |
$name = $name -replace "[^a-zA-Z0-9]", " " -replace "\s+", "" | |
return $name.Trim() | |
} |
View CustomJettyLauncher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2008 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
* use this file except in compliance with the License. You may obtain a copy of | |
* the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |