Skip to content

Instantly share code, notes, and snippets.

View isaacpalomero's full-sized avatar

Isaac Palomero isaacpalomero

View GitHub Profile
@isaacpalomero
isaacpalomero / refresh-image.json
Created April 21, 2020 07:58 — forked from xeladotbe/refresh-image.json
APL 1.3 refresh image every 30 seconds
{
"type": "APL",
"version": "1.3",
"settings": {
"idleTimeout": 300000
},
"theme": "dark",
"import": [],
"resources": [],
"styles": {},
@isaacpalomero
isaacpalomero / LocalizationInterceptor.ts
Last active June 25, 2019 22:18
i18next Localization Helpers generator
import { RequestInterceptor, HandlerInput } from "ask-sdk-core";
import { generateLocalization } from "./generateTranslator";
/**
* Adds translation functions to the RequestAttributes.
*/
export class LocalizationInterceptor implements RequestInterceptor {
public async process(handlerInput: HandlerInput): Promise<void> {
const locale: string =
handlerInput.requestEnvelope.request.locale || "es-ES";
/**
* Copyright (c) 2014-2019 by the respective copyright holders.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
// - You have to make a dir named "resources" and put there all locale specific manifest data.
// Workaround when you change Environment Vars on Lambda functions and need to use ASK - CLI to Deploy an Skill.
// That code updates the variables through the AWS console and manually fetch the function's info using the AWS CLI and
// update the local revision id to match the revision id that's live on AWS.
// https://stackoverflow.com/questions/53508109/setting-lambda-environmental-variable-using-ask-cli
// Gist link: https://gist.github.com/isaacpalomero/84de0412d3de5b3f5c0e2e4a141a0fae
// How to use it:
// npm install -g "fs"
// npm install -g "execa"
// [root-project-path]$ ts-node scripts/update-lambda-revision-id.ts
// Adapted from: https://developer.amazon.com/blogs/alexa/post/a94d26c7-591b-4382-8721-2929f818be8b/create-your-own-automation-script-to-optimize-syncing-your-local-skill-interaction-model-using-the-ask-cli
// Example Uses:
// [PROJECTPATH]$ ask api get-model --locale en-US --skill-id `node scripts/get-skill-id.js`
// or
// ⌞ $ cp $PROJECTPATH/scripts/get-skill-id.js $HOME/$WHEREVERYOUWANT/get-skill-id.js
// ⌞ $ pico ~/.bash_profile
// ⌞ alias gskill='node $HOME/$WHEREVERYOUWANT/get-skill-id.js'
// ⌞ $ source ~/.bash_profile
// ⌞ [PROJECTPATH]$ ask api get-model --locale en-US --skill-id `gskill`
// - With this script you can add local ISP to .ask/config file automatically, download current ISP on remote
// and add these too on .ask/config file
//
// How to use it:
// change the 3 "const" with yours, and follow these steps:
// [any-path]$ npm install -g "fs"
// [any-path]$ npm install -g "execa"
// [root-project-path]$ ts-node scripts/add-ISP-files-to-ask-config.ts
// TODO: update this values with yours
@isaacpalomero
isaacpalomero / ScriptsForAlexa.md
Last active July 11, 2019 19:27
Scripts for an Alexa Project