Skip to content

Instantly share code, notes, and snippets.

View dsc712's full-sized avatar
:octocat:
I may be slow to respond.

DEVYENDU SHEKHAR CHOUDHARY dsc712

:octocat:
I may be slow to respond.
  • New Delhi , India
View GitHub Profile
@dsc712
dsc712 / App.js
Created August 26, 2019 07:43
REDUX In REACT
import React, { Component } from "react";
import { connect } from "react-redux";
class App extends Component {
render() {
return (
<>
<h1>age {this.props.age}</h1>
<button onClick={this.props.onAgeUp}>increment age</button>
<button onClick={this.props.onAgeDown}>decrement age</button>
</>
@dsc712
dsc712 / MyButton.js
Last active August 26, 2019 07:05
React Concepts
import React, { Component } from "react";
import withCounter from "../HOC/withCounter";
class MyButton extends Component {
state = {};
render() {
return (
<>
<button onClick={this.props.incrementCount}>
click me {this.props.count}
</button>
@dsc712
dsc712 / example.cpp
Created May 11, 2019 15:56
swap swap
#include <bits/stdc++.h>
using namespace std;
void swapSwap( int a[], int k, int n ) {
for( int i = 0; (i < n - 1) && (k > 0) ; i++ ) {
int currMax = i;
for( int j = i+1; j < n; j++ ) {
if (k < j - i)
break;
@dsc712
dsc712 / example.cpp
Created May 11, 2019 15:20
max xor b/w a range
#include <bits/stdc++.h>
using namespace std;
int getMax(int L, int R) {
int LxR = L ^ R;
int p = 0;
// msb of L ^ R
while(LxR) {
p++;
@dsc712
dsc712 / VideoDetail.js
Created February 15, 2019 12:01
Video List Detail
import React, { Component } from 'react';
import { Icon } from "antd";
class VideoDetail extends Component {
state = {
video: null
};
componentDidUpdate(prevProps) {
if( this.props.video && ( prevProps.video !== this.props.video) ) {
@dsc712
dsc712 / VideoListItem.js
Created February 15, 2019 11:57
Video List Item
import React, { Component } from 'react';
class VideoListItem extends Component {
render() {
const video = this.props.video;
const imageUrl = video.snippet.thumbnails.default.url;
return (
<li onClick={ () => this.props.onUserSelected() } style={{ "border": "1px solid #efefef", "marginBottom": "3px", "borderRadius": "5px"}}>
<div>
<img src={ imageUrl } alt={ video.snippet.title }/>
@dsc712
dsc712 / VideoList.js
Created February 15, 2019 11:53
VideoList Component
import React, { Component } from 'react';
import VideoListItem from './VideoListItem';
import { List } from 'antd';
class VideoList extends Component {
state = {
data: []
};
render() {
@dsc712
dsc712 / SearchBar.js
Created February 15, 2019 11:46
SearchBar
import React, { Component } from 'react';
import { AutoComplete, Button, Icon } from 'antd';
const Option = AutoComplete.Option;
class SearchBar extends Component {
state = {
videos: []
};
componentDidUpdate( prevProps ) {
@dsc712
dsc712 / App.js
Created February 15, 2019 11:16
Youtube Player Root Component
import React, { Component } from 'react';
import SearchBar from './Components/SearchBar';
import VideoList from './Components/VideoList';
import VideoDetail from './Components/VideoDetail';
import YTSearch from 'youtube-api-search';
import './App.css';
import { Icon, notification } from 'antd';
import dotenv from 'dotenv';
dotenv.config();
@dsc712
dsc712 / ajax-using-xhr.markdown
Created February 15, 2018 05:33
ajax using xhr