Skip to content

Instantly share code, notes, and snippets.

View imparvez's full-sized avatar

Parvez Shaikh imparvez

  • 1Spatial
  • Newcastle Upon Tyne, United Kingdom
View GitHub Profile
@imparvez
imparvez / script.js
Created February 18, 2019 05:35
Get Colon Time From Date
const getColonTimeFromDate = date => date.toTimeString().slice(0, 8)
getColonTimeFromDate(new Date()); // "11:00:34"
@imparvez
imparvez / script.js
Created February 13, 2019 09:15
Return the difference between two Arrays
const difference = (a, b) => {
const s = new Set(b)
return a.filter(x => !s.has(x))
}
difference([1,2,3], [1,2,4])
@imparvez
imparvez / ReactContextAPI.js
Created June 17, 2018 16:05
React Context API 16.4
import React, { Component, Fragment } from 'react';
// first we'll create a new context
const MyContext = React.createContext();
// provider component where our data will live
class MyProvider extends Component{
state = {
name: 'Prazzy',
age: 30,
@imparvez
imparvez / google-map-tracker.html
Created June 14, 2018 06:39
Google Map With tracker from origin and destination.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Google Maps</title>
<style>
#map {
height: 500px;
}
@imparvez
imparvez / App.js
Created May 14, 2018 07:27
Food List React App
import React, { Component } from 'react';
import axios from 'axios';
import RecipeCard from './components/RecipeCard';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
meal: {}
@imparvez
imparvez / image.js
Created May 14, 2018 07:25
Food List React App
import React, { Component } from 'react';
export default class Image extends Component {
render(){
return( <img src={this.props.source} alt={this.props.text} /> )
}
}
@imparvez
imparvez / Title.js
Created May 14, 2018 07:25
Food List React App
import React, { Component } from 'react';
export default class Title extends Component {
render(){
return( <h2>{this.props.title}</h2> )
}
}
@imparvez
imparvez / RecipeCard.js
Created May 14, 2018 07:24
Food List React App
import React, { Component } from 'react';
import Title from './Title';
import Image from './Image';
export default class RecipeCard extends Component {
render(){
return(
<div>
{this.props.meals.map((item, index) => {
return (
<a
@imparvez
imparvez / folder-structure
Created May 14, 2018 07:22
Food List React App
whats-in-meal
|-> node_modules
|-> public
|-> src
|-> components
|-> Title.js
|-> Image.js
|-> RecipeCard.js
@imparvez
imparvez / App.js
Created May 14, 2018 07:20
Food List React App
import React, { Component } from 'react';
import axios from 'axios';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
meal: ""
}
}