Skip to content

Instantly share code, notes, and snippets.

View mihir0x69's full-sized avatar
:shipit:
Ship it

Mihir Karandikar mihir0x69

:shipit:
Ship it
View GitHub Profile
var path = require('path')
var webpack = require('webpack')
module.exports = {
devtool: 'cheap-module-eval-source-map',
entry: [
'script!jquery/dist/jquery.min.js',
'webpack-hot-middleware/client',
'./index'
],
@mihir0x69
mihir0x69 / gist:c393664b856ebe7bdc60e059d6f7bce4
Created July 29, 2016 11:02
tweaks for react+webpack project
window.$ = window.jQuery = require("jquery");
$.fn.progress = require('semantic-ui/dist/components/progress');
plugins: options.plugins.concat([
new webpack.ProvidePlugin({
// make fetch available
fetch: 'exports?self.fetch!whatwg-fetch',
$: "jquery",
jQuery: "jquery",
}),
{
"name": "my-react-project",
"version": "1.0.0",
"description": "Boilerplate for React project",
"scripts": {
"start": "node server.js",
"lint": "eslint src"
},
"author": "Mihir Karandikar (http://github.com/KarandikarMihir)",
"license": "MIT",
@mihir0x69
mihir0x69 / remove.md
Last active October 31, 2016 09:32
remove.md

Removing redux-saga

We don't recommend removing redux-saga, as we strongly feel that it's the way to go for most redux based applications.

If you really want to get rid of it, you will have to delete its traces from several places.

app/store.js

  1. Remove statement import createSagaMiddleware from 'redux-saga'.
  2. Remove statement const sagaMiddleware = createSagaMiddleware().
const Parent = (props) => (
<div>
{props.children}
</div>
)
const Child = (props) => (
<div>Child No. {props.number}</div>
)
@mihir0x69
mihir0x69 / import.js
Last active July 8, 2017 06:19
Using es6 import
const getModule = (cb) => (componentModule, submodule) => {
cb(null, componentModule.default)
};
const logError = (err) => {
console.error('Dynamic page loading failed', err);
};
getComponent(location, cb) {
const importedModule = Promise.all([
@mihir0x69
mihir0x69 / ensure.js
Created July 8, 2017 06:19
Require.ensure
module.exports = {
getComponent(location, cb) {
require.ensure([], require => {
cb(null, require('./MyComponent.react.js').default)
})
}
}
@mihir0x69
mihir0x69 / index.jsx
Last active July 8, 2017 09:07
React hot loader v3
import { AppContainer } from 'react-hot-loader'
import { render } from 'react-dom'
import App from './app'
const renderApp = (Root) => (
render(
<AppContainer>
<Root />
</AppContainer>,
document.getElementById('app-root')
@mihir0x69
mihir0x69 / scripts.json
Created July 8, 2017 08:57
Npm Scripts
"scripts": {
"start": "xoxo-react-scripts start",
"build": "xoxo-react-scripts build",
"test": "xoxo-react-scripts test --env=jsdom",
"eject": "xoxo-react-scripts eject"
}
@mihir0x69
mihir0x69 / bin.json
Created July 8, 2017 09:03
React scripts package.json
"bin": {
"xoxo-create-react-app": "./index.js"
}