Skip to content

Instantly share code, notes, and snippets.

View Shadid12's full-sized avatar
🕹️
console.log

Shadid12 Shadid12

🕹️
console.log
View GitHub Profile
@Shadid12
Shadid12 / part1.md
Created September 18, 2017 13:23
Developing realtime apps with React.js Express.js Socket.io and more

Developing realtime apps with React.js Express.js Socket.io and more

N|Solid

Things that we will be touching on this session

  • React.js front end
  • React Material Design
  • Node.js & Express.js REST API
@Shadid12
Shadid12 / ExandAnimation.js
Created November 16, 2017 05:11
React Simple Animation
import React from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Animated,
Easing
} from 'react-native';
from routes import Routes
# Graph: AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7
graph = {
'A': {'B': 5, 'D': 5, 'E': 7 },
'B': {'C': 4},
'C': {'D': 8, 'E': 2},
'D': {'C': 8, 'E': 6},
'E': {'B': 3}
}
class Routes:
def __init__(self, routesTable={}):
# the routesTable is our hash map DT
self.routesTable = routesTable
def distanceBetween(self, cities=[]):
"""
Calculates distance of the route
Args:
cities (str[]): The array of cities
Returns:
int: calclated distance
"""
def numStops(self, start, end, maxStops):
"""
Wrapper function to calculate the number of stops
Args:
start (str): Starting city
end (str): Destination city
maxStops (int): number of maximum stops allows
Returns:
int: calclated number of routes
def findPathWithExactStops(self, start, finish, exact):
"""
Wrapper function to calculate the path with exact number of stops
Args:
start (str): Starting city
end (str): Destination city
maxDistance (int): exact number of stops
Returns:
int: number of routes
def findShortestRoute(self, start, end , weight, shortestRoute, visited=[]):
"""
Recursive function to calculate the shortest route
Args:
start (str): Starting city
end (str): Destination city
weight (weight): weight of the route
shortestRoute (int): shortest path so far
visited (str[]): array of visited nodes
const getApple = () => {
setTimeout(() => {
return { "name": "Macintosh" }
}, 2000);
};
const myApple = getApple();
console.log(myApple.name);
const getApple = (b) => {
setTimeout(() => {
b({name: 'Macintosh'});
}, 2000);
};
getApple((apple) => {
console.log(apple.name);
})