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
// 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 LaunchRequestHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest'; | |
}, | |
handle(handlerInput) { |
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
import cx from 'classnames'; | |
import { Component } from 'react'; | |
/* | |
assuming we wanted only ONE component, otherwise, naturally I would've make different components for each, TodoList, TodoItem, Input etc. | |
*/ | |
export default class TodoList extends Component { | |
constructor(props) { | |
super(props); |
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
// run the code at: https://jsfiddle.net/shayan_ys/5qos4agz/ | |
// question found on HackerRank: https://www.hackerrank.com/challenges/sock-merchant?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=warmup | |
function isPair(x, pairs) { | |
return pairs.hasOwnProperty(x); | |
} | |
var processMerchant = (function () { | |
var pairs = {}; | |
var pairsCount = 0; |
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
class Elevator: | |
def __init__(self, index: int, floor: int=0): | |
self.id = index | |
self.floor = floor | |
self.dests = [] | |
self.dir = 0 # 1 up, -1 down, 0 idle | |
def update(self): | |
""" update status of current elevator. | |
Move up/down, change direction based on next destination, or stop at destination when reached |