View CustomJettyLauncher.java
/* | |
* 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 |
View import.ps1
# 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 sitecore-images-classifier.ps1
$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 sitecore-text-classifier.ps1
$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 transcript.js
// 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 pubsub.js
/* | |
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. |