Skip to content

Instantly share code, notes, and snippets.

View dsadhanala's full-sized avatar
💭
I may be slow to respond.

Durga Prasad Sadhanala dsadhanala

💭
I may be slow to respond.
  • Google
View GitHub Profile
const childMachine = Machine({
id: "child",
initial: "step1",
states: {
step1: {
entry: ['logState'],
on: { STEP: "step2" }
},
step2: {
entry: ['logState'],
@dsadhanala
dsadhanala / simple-slider.html
Created April 23, 2020 04:24
Example slider web component, prev/next keyboard navigation enabled
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Slider</title>
</head>
<body>
<webui-slider></webui-slider>
@dsadhanala
dsadhanala / machine.js
Last active April 17, 2020 08:57
Generated by XState Viz: https://xstate.js.org/viz
const projectNameMachine = Machine(
{
id: 'project-name',
strict: true,
initial: 'editing',
states: {
editing: {
on: {
PROJECT_NAME_SAVING: {
cond: 'validProjectName',
@dsadhanala
dsadhanala / machine.js
Last active April 17, 2020 06:48
Generated by XState Viz: https://xstate.js.org/viz
const updateMessage = (message) => assign({ message: (_, _e) => message });
const projectnameStates = {
initial: 'editing',
states: {
editing: {
entry: ['logState'],
on: {
PROJECT_NAME_SAVING: {
target: '#headerMachine.saving',
const HeaderMachine = Machine(
{
id: 'header',
strict: true,
initial: 'ready',
context: {
projectName: ''
},
states: {
ready: {
@dsadhanala
dsadhanala / machine.js
Created March 24, 2020 01:02
Generated by XState Viz: https://xstate.js.org/viz
const header = Machine({
id: 'header',
initial: 'saved',
states: {
saved: {},
title: {
initial: 'saved',
state: {
edited: {},
saved: {}
@dsadhanala
dsadhanala / image from blob
Created August 12, 2019 10:17
Image blob to console
const image = new Image();
image.src = URL.createObjectURL(imageElement);
console.info('imageElement', image.src);
@dsadhanala
dsadhanala / cloudSettings
Last active February 16, 2021 16:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-02-16T16:52:23.451Z","extensionVersion":"v3.4.3"}
@dsadhanala
dsadhanala / index.js
Last active December 16, 2018 05:09
Auto deploy dist folder to gh-pages
#!/usr/bin/env node
/**
* automated gh-pages deployment
*/
const path = require('path');
const shell = require('shelljs');
const { which, echo, exit, exec, cd, mkdir, rm } = shell;
const distRoot = 'dist';
@dsadhanala
dsadhanala / index.html
Last active April 17, 2018 02:33
Simple component example and comparison using `baseui-wc-base-component`
<p>Click on each header element to see number of clicks updated
<header-text-base text="Rendered with base-custom-element"></header-text-base>
<header-text-lit text="Rendered with lit-html"></header-text-lit>
<header-text-hyper text="Rendered with hyper-html"></header-text-hyper>