Skip to content

Instantly share code, notes, and snippets.

View reciosonny's full-sized avatar
🎯
Focusing

Sonny R. Recio reciosonny

🎯
Focusing
View GitHub Profile
import React, { Component } from 'react';
// import axios from 'axios';
import AnotherComponent from './AnotherComponent';
import Todo from './Todo';
import ParentComponent from './ParentComponent';
export default class App extends Component {
constructor(props) {
import React, { Component } from 'react';
// import axios from 'axios';
import AnotherComponent from './AnotherComponent';
import Todo from './Todo';
import ParentComponent from './ParentComponent';
export default class App extends Component {
constructor(props) {
@reciosonny
reciosonny / webpack.config.dev.js
Last active February 21, 2020 02:29
Webpack 4 staple configuration #webpack
var webpack = require("webpack");
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: {
bundle: './src/index.js'
},
output: {
@reciosonny
reciosonny / express.js
Created August 24, 2018 00:20
NodeJS - Webpack DIY server #nodejs #node
import express from 'express';
import path from 'path';
const server = express();
///note: in development, we need to have this ability of having a `live reloading experience` when changing some codes in front-end. So we need to make use of webpack libraries.
const webpack = require("webpack");
const config = require("../../config/webpack.dev.js");
@reciosonny
reciosonny / webpackWithCodeSplit_Webpack2.js
Last active October 13, 2018 05:14
Webpack boilerplate configuration #webpack #javascript
var webpack = require("webpack");
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
//note: we can code split and store the vendors in separate entry to improve the performance and take advantage of caching.
/*
some gotchas:
-When a vendor or library is updated very often, do not include them in the `vendor` entry
*/
const VENDOR_LIBS = [
@reciosonny
reciosonny / nodeWebpackBoilerplate.js
Created June 3, 2018 02:46
Boilerplate code for running webpack app inside nodejs (you need to install `webpack-dev-middleware` in your app as devDependencies). #webpack #nodejs
const express = require('express');
/**
* we need to make use of all 3 to make webpack work
*/
const webpackMiddleware = require('webpack-dev-middleware'); //this only serves to intercept the incoming requests and handle webpack
const webpack = require('webpack'); //this exists to compile all of our application assets
const webpackConfig = require('./webpack.config.js'); //this instructs on how to run webpack correctly with configurations
/**END */
import "./SchemaTablesList.css";
import React, { Component } from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import _ from "lodash";
import { withRouter } from "react-router-dom";
/* ACTIONS */
import { initializeTables, deleteTablesInSchema } from "../Actions/index";
@reciosonny
reciosonny / indexNodeClientSetup.js
Created April 8, 2018 06:46
Code snippet for setting up react app inside node #nodejs #javascript
if (process.env.NODE_ENV === 'production') {
//Express will serve up production assets
//like our main.js file, or main.css file
app.use(express.static('client/build'));
//Express will serve up the index.html file
//if it doesn't recognize the route
//note 1: if it doesn't recognize the file being scanned above(static/client/build), then it will go through here to find the index.html file. This route is a catch-all scenario just to load the client app in express server.
const path = require('path');
app.get('*', (req, res) => {
@reciosonny
reciosonny / App.js
Created February 21, 2018 03:41
Sample component reuse React
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { Route, Switch, Link, Router, NavLink } from "react-router-dom";
import SchemaTablesList from './SchemaTablesList';
import Settings from './Settings';
import { ToastContainer } from "react-toastr";
import { connect } from "react-redux";
import { bindActionCreators } from "redux";
import DbSchema from './DbSchema';
@reciosonny
reciosonny / sampleJsx.js
Created February 21, 2018 02:24
Sample JSX
import React, { Component, Fragment } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
componentDidMount() {
}