Skip to content

Instantly share code, notes, and snippets.

View timelincoln7648's full-sized avatar

Kody timelincoln7648

View GitHub Profile
/**
* Get Current Connected Xero Org
*/
app.intent('getOrgName', {
'slots': {},
'utterances': ['{which|what} {|zero} {org|organisation|account|company|file} {|am I} {connected|attached|looking} {|at|to|on|in}'],
}, function(req, res) {
return checkSession(req)
.then(function(xeroDataHelper) {
return xeroDataHelper.getOrgName()
XeroDataHelper.prototype.formatOrgName = function(orgName) {
if (orgName) {
return `You are currently connected to the Zero Organisation: ${orgName}. To get a status report for this organisation, say: weekly status report.`;
} else {
return "There was an issue getting the name of your Zero organisation. Please link your account using the Alexa app and try again."
}
};
# Local Accounts table
RESULT=$(aws dynamodb describe-table \
--region us-east-1 \
--endpoint-url $DYNAMODB_ENDPOINT \
--table-name test_Accounts)
CODE=$?
if [ $? -eq 0 ]; then
aws dynamodb delete-table \
--region us-east-1 \
--endpoint-url $DYNAMODB_ENDPOINT \
@timelincoln7648
timelincoln7648 / AppDelegate.swift
Created January 10, 2020 21:56
Install Optimizely Swift
import UIKit
import Optimizely
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// Build OptimizelyClient
let optimizely = OptimizelyClient(sdkKey: "REPLACE_WITH_SDK_KEY", periodicDownloadInterval: 30)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
@timelincoln7648
timelincoln7648 / customize_optimizely.swift
Created January 10, 2020 21:59
Customization options for the Optimizely Swift SDK
let customLogger = CustomLogger()
let logLevel = OptimizelyLogLevel.debug
let customDownloadIntervalInSecs = 30
let optimizely = OptimizelyClient(sdkKey: sdkKey,
logger: customLogger,
periodicDownloadInterval: customDownloadIntervalInSecs,
defaultLogLevel: logLevel)
@IBAction func showMessage(sender: UIButton) {
let alertController = UIAlertController(title: "Alert", message: enabled ? "Hello World!" : "Nothing to see here...", preferredStyle: UIAlertController.Style.alert)
if enabled {
alertController.addAction(UIAlertAction(title: "Hello!", style: UIAlertAction.Style.default, handler: nil))
} else {
alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil))
}
present(alertController, animated: true, completion: nil)
@timelincoln7648
timelincoln7648 / ViewController.swift
Created January 10, 2020 22:14
linking AppDelegate
let delegate = UIApplication.shared.delegate as! AppDelegate
@timelincoln7648
timelincoln7648 / ViewController.swift
Created January 10, 2020 22:16
linking optimizely isFeatureEnabled
let userId = "user123"
let attributes: [String: Any] = [
"customerId": 123, // Attributes used for targeted audience-based rollout
"isVip": true,
]
let enabled = delegate.optimizely.isFeatureEnabled(featureKey: "hello_world", userId: userId, attributes: attributes)
print("Feature is enabled? - \(enabled) for userId: \(userId)")
import UIKit
class ViewController: UIViewController {
let delegate = UIApplication.shared.delegate as! AppDelegate
@IBAction func showMessage(sender: UIButton) {
let userId = "user123"
let attributes: [String: Any] = [
"customerId": 123, // Attributes used for targeted audience-based rollout
@IBAction func showMessage(sender: UIButton) {
let alertController = UIAlertController(title: "Alert", message: enabled ? "Hello World!" : "Nothing to see here...", preferredStyle: UIAlertController.Style.alert)
var enabled = false
if enabled {
alertController.addAction(UIAlertAction(title: "Hello!", style: UIAlertAction.Style.default, handler: nil))
} else {
alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil))
}