Skip to content

Instantly share code, notes, and snippets.

View AnkurVyas-BTC's full-sized avatar
🎯
Karma rules world... You get whatever you give!

Ankur Vyas AnkurVyas-BTC

🎯
Karma rules world... You get whatever you give!
View GitHub Profile
@AnkurVyas-BTC
AnkurVyas-BTC / react_big_component.js
Last active April 28, 2019 04:42
Big React component!
import BigComponent from '../components/BigComponent';
class MainComponent extends React.Component {
render() {
return <BigComponent/>;
}
}
class HomoHabilis < Human
def talk
'Agrrr!'
end
def height
'1.29m'
end
def social_security_number
# parent class (main)
class Human
def talk
''
end
def height
''
end
end
@AnkurVyas-BTC
AnkurVyas-BTC / import_material_ui_react.js
Last active May 21, 2018 14:34
Import material UI components
// app/javascript/components/MaterialComponentList.js
import React from "react";
import PropTypes from "prop-types";
import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import AppBar from '@material-ui/core/AppBar';
import IconButton from '@material-ui/core/IconButton';
import Toolbar from '@material-ui/core/Toolbar';
import MenuIcon from '@material-ui/icons/Menu';
@AnkurVyas-BTC
AnkurVyas-BTC / react_component_flights_form.jsx
Last active August 31, 2021 18:27
A React Component Form for flights booking
import React, { Component, PropTypes } from 'react';
import { Button } from 'react-bootstrap';
import { Form, FieldArray, FormSection, Fields, SubmissionError } from 'redux-form';
import { intlShape, injectIntl, FormattedMessage } from 'react-intl';
import moment from 'moment';
import { isEqual, omit, functions } from 'lodash';
import FlightField from '../fields/flight_field';
import { connectWidgetForm } from './utils';
import messages from './flights_form.messages';
@AnkurVyas-BTC
AnkurVyas-BTC / react_component_for_user_listing_and_filtering.jsx
Created May 8, 2018 07:17
A React Component which handles User Listing and Filtering based on User Inputs
import React from "react";
import PropTypes from "prop-types";
import Users from "./Users";
import Pagination from "../Pagination"; // Common pagination component
import CreateUserCard from "./CreateUserCard";
import FilterUser from "./FilterUser";
import Loader from '../Loader'; // Common Loader component
class Index extends React.Component {
constructor(props) {
@AnkurVyas-BTC
AnkurVyas-BTC / React_Chart_Component.jsx
Last active May 8, 2018 07:27
A React Component to display PieChart/ Column Chart or Table based on props from parent component!
import React from 'react';
import ReactChartkick, { ColumnChart, PieChart } from 'react-chartkick'; // ReactChartkick library for charts
import Chart from 'chart.js';
import NoData from '../NoData'; // When the component don't have any data we create a commom component
ReactChartkick.addAdapter(Chart);
class AnalyticsChart extends React.Component {
constructor(props) {
super();
@AnkurVyas-BTC
AnkurVyas-BTC / react_rails_webpack_home_index.html.erb
Created March 18, 2018 07:47
Contents of home/index.html.erb file
<%= react_component 'GreetUser', name: 'Ankur' %>
@AnkurVyas-BTC
AnkurVyas-BTC / react_rails_webpack_greet_user.js
Last active March 18, 2018 07:43
Content of Greet User component
// Path : app/javascript/components/GreetUser.js
import React from "react";
import PropTypes from "prop-types";
class GreetUser extends React.Component {
render () {
return (
<div>
<h1>Hello {this.props.name}, </h1>
@AnkurVyas-BTC
AnkurVyas-BTC / react_rails_webpack_application.html.erb
Created March 18, 2018 07:31
Contents of layouts/application.html.erb
<!-- Path: app/views/layouts/application.html.erb -->
<!DOCTYPE html>
<html>
<head>
<title>RailsReactWebpacker</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<!-- Following will make the react components availabe to our layout -->