Skip to content

Instantly share code, notes, and snippets.

View anoop4real's full-sized avatar

anoop4real anoop4real

View GitHub Profile
@anoop4real
anoop4real / funnytranslationsV2.js
Created October 27, 2019 22:28
Alexa:Funny translations http
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.
const Alexa = require('ask-sdk-core');
const https = require('http');
const SKILL_NAME = 'Funny Translations';
const HELP_MESSAGE = 'You can say translate followed by a sentence to translate, or, you can say exit... What can I help you with?';
const HELP_REPROMPT = 'What can I help you with?';
const STOP_MESSAGE = 'Enjoy the day...Goodbye!';
const PAUSE = '<break time="0.3s" />'
@anoop4real
anoop4real / guessthenumber.js
Created September 2, 2019 21:09
A demo sample for session attributes of Alexa
// This sample demonstrates handling intents from an Alexa skill using the Alexa Skills Kit SDK (v2).
// Please visit https://alexa.design/cookbook for additional examples on implementing slots, dialog management,
// session persistence, api calls, and more.var
const Alexa = require('ask-sdk-core');
const SKILL_NAME = "Number";
const ANSWER_THIS_MESSAGE = "Answer this : ";
const HELP_MESSAGE = 'What can I help you with?';
const HELP_REPROMPT = 'What can I help you with?';
const STOP_MESSAGE = 'Enjoy the day...Goodbye!';
/* eslint-disable func-names */
/* eslint quote-props: ["error", "consistent"]*/
/**
* This sample demonstrates a simple skill built with the Amazon Alexa Skills
* nodejs skill development kit.
* This sample supports multiple lauguages. (en-US, en-GB, de-DE).
* The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
* as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-fact
**/
@anoop4real
anoop4real / bannerlayout.kt
Created August 13, 2018 06:27
Admob: Add Banner view programatically in Kotlin
fun createLayout(){
// Get the layout from xml
val layout: ConstraintLayout = admob_contraint_layout
val cs = ConstraintSet()
// Create layout params for content size
var params : ConstraintLayout.LayoutParams = ConstraintLayout.LayoutParams(
ConstraintLayout.LayoutParams.WRAP_CONTENT,
ConstraintLayout.LayoutParams.WRAP_CONTENT
@anoop4real
anoop4real / gist:0c2386629ada68dcfb11f305e139de54
Created August 1, 2018 06:49
AccessibilityContainer.swift
import UIKit
class CustomHeaderView: UIView {
var label:UILabel!
var currentSection:Int = 0
init (with section:Int,_ frame: CGRect){
@anoop4real
anoop4real / Codable.playground
Created July 30, 2018 06:10
A sample to decode a JSON structure using Codable
import Foundation
import UIKit
let json = """
[
{
"title": "Taylor Swift",
"artist": "Taylor Swift",
"url": "https://www.amazon.com/Taylor-Swift/dp/B0014I4KH6",
"image": "https://images-na.ssl-images-amazon.com/images/I/61McsadO1OL.jpg",
@anoop4real
anoop4real / subscriber.py
Created May 24, 2018 03:32
python mqtt subscriber
import paho.mqtt.client as mqtt
import lcddriver
import time
lcd = lcddriver.lcd()
MQTT_SERVER = "localhost"
MQTT_PATH = "test_channel"
# The callback for when the client receives a CONNACK response from the server.
@anoop4real
anoop4real / publisher.py
Created May 24, 2018 03:31
Python files for Raspberry Pi MQTT
import paho.mqtt.publish as publish
MQTT_SERVER = "localhost"
MQTT_PATH = "test_channel"
publish.single(MQTT_PATH, "This is a response from Raspberry Pi", hostname=MQTT_SERVER)

####Some Swift tips for reference

  • Swift 4 - Variables declared private share the same access control scope between a type and any extension on said type.