Skip to content

Instantly share code, notes, and snippets.

View hk-skit's full-sized avatar
👨‍💻
On deep learning mode.

Hitesh Kumar hk-skit

👨‍💻
On deep learning mode.
View GitHub Profile
@hk-skit
hk-skit / index.html
Created November 10, 2016 17:09
Hello World with UI-Router
<!DOCTYPE html>
<html lang="en">
<head>
<title>Hello ui-router</title>
<link rel="stylesheet" href="style.css">
</head>
<body ng-app="HelloWorld">
<header>
<nav>
<ul>
@hk-skit
hk-skit / IComponentLoader.ts
Last active May 22, 2017 18:02
Component Loader Component
export interface IComponentLoader {
data: any;
}
@hk-skit
hk-skit / IteratorDemo.js
Last active January 27, 2019 05:08
Data Structures with Iterable Protocol
class IteratorDemo {
// Iterator Method with @@iterator key
// i.e. Symbol.iterator constant
[Symbol.iterator]() {
// Method stub which returns an iterator object.
}
}
class RangeIterator {
constructor({
start = 0,
end = 1000,
step = 1
}) {
this.start = start;
this.end = end;
this.step = step;
class RangeGenerator {
constructor({
start = 0,
end = 1000,
step = 1
}) {
this.start = start;
this.end = end;
this.step = step;
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
class LinkedList {
constructor() {
/**
* Iterator function.
*
* @returns
* @memberof LinkedList
*/
[Symbol.iterator]() {
let current = this.head;
const iterable = {
next: () => {
// Generator function.
*[Symbol.iterator]() {
let current = this.head;
while (current !== null) {
const { value } = current;
current = current.next;
yield value;
}
}
@hk-skit
hk-skit / Stack.js
Last active January 27, 2019 11:27
class Stack {
constructor() {
this.list = new LinkedList();
}
get isEmpty() {
return this.list.isEmpty;
}
/**
import { BinaryTreeNode } from './BinaryTreeNode';
export class BinaryTree {
constructor() {
this.root = null;
}
get isEmpty() {
return this.root === null;
}