Skip to content

Instantly share code, notes, and snippets.

View 0xAnon101's full-sized avatar
🎓
Rain , coffee , code

0xAnon 0xAnon101

🎓
Rain , coffee , code
  • EVM
View GitHub Profile
@0xAnon101
0xAnon101 / .md
Last active September 24, 2018 11:08
Breif Description of what happens in browser when a Javascript code executes?

How Does Javascript Run Your Code?

Google Chrome has V8 Javascript engine and Mozilla has SpiderMonkey Engine to run JS code.

var num = 2;
function pow(num) {
    return num * num;
}
@0xAnon101
0xAnon101 / .js
Last active September 27, 2018 08:16
boilerplate webpack config
module.exports = (env,argv) => {
return {
optimization: {
nodeEnv: argv.mode
},
module: {
rules: [
{
test: /\.js$/,
@0xAnon101
0xAnon101 / .json
Created September 27, 2018 08:39
.babelrc
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}
@0xAnon101
0xAnon101 / .js
Created September 27, 2018 10:51
first component index.js
import React from "react";
import ReactDOM from "react-dom";
import App from './Containers/App';
ReactDOM.render(<App />, document.getElementById("index"));
@0xAnon101
0xAnon101 / .html
Created September 27, 2018 10:53
index.html for rendering a component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>React and Webpack4</title>
</head>
<body>
<section id="index">
@0xAnon101
0xAnon101 / .js
Last active September 27, 2018 11:08
const HtmlWebPackPlugin = require('html-webpack-plugin');
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
})
module.exports = (env,argv) => {
return {
optimization: {
nodeEnv: argv.mode
@0xAnon101
0xAnon101 / .js
Last active September 27, 2018 12:00
css / sass modules in webpack configuration
const HtmlWebPackPlugin = require('html-webpack-plugin');
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
filename: "./index.html"
})
module.exports = (env,argv) => {
return {
optimization: {
nodeEnv: argv.mode
@0xAnon101
0xAnon101 / .js
Created September 27, 2018 12:38
final webpack.config.js boilerplate
const HtmlWebPackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const miniCssPlugin = new MiniCssExtractPlugin({
filename: '[name].[hash].css',
chunkFilename: '[id].[hash].css',
})
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
@0xAnon101
0xAnon101 / .js
Last active September 27, 2018 13:03
dummy component
import React from "react";
const App = () => {
return <div className={classes.app}>Hello React!</div>;
};
export default App;
@0xAnon101
0xAnon101 / .scss
Created September 27, 2018 12:56
app.scss
.app {
width: 100px;
height: 100px;
background: #000;
color: #fff;
}