Skip to content

Instantly share code, notes, and snippets.

View vamsiampolu's full-sized avatar

Vamsi Ampolu vamsiampolu

  • Sydney, Australia
View GitHub Profile
@vamsiampolu
vamsiampolu / webpack.config.js
Created July 5, 2017 18:32
SVG Sprite Loader config webpack2
{
module: {
rules: [
{
test: /\.svg$/,
use: [
{
loader: 'svgo-loader'
},
{
clean-webpack-plugin: /Users/localuser/lendi/learning/antd-forms/src/code-splitting/build/*.* has been removed.
76% basic chunk optimization/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289
for(const module of chunk.modulesIterable) {
^
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
at usedChunks.reduce (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289:29)
at Array.reduce (native)
at CommonsChunkPlugin.getExtractableModules (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:288:46)
at targetChunks.forEach (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:136:38)
@vamsiampolu
vamsiampolu / webpack.config.js
Created June 28, 2017 01:37
SVG Sprite Loader issue
'use strict'
var autoprefixer = require('autoprefixer')
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin')
var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin')
var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin')
var getClientEnvironment = require('./env')
var paths = require('./paths')
import React from 'react'
import Perf from 'react-addons-perf'
import styles from './styles.css'
export default class PerfProfiler extends React.PureComponent {
constructor (props) {
super(props)
this.state = {started: false}
}
{
"presets":[
"react",
[
"env",
{
"targets":{
"chrome":54,
"node":true
}
@vamsiampolu
vamsiampolu / .vimrc
Last active November 11, 2016 16:21
"use vim settings instead of vi settings
set nocompatible
"when both relative number and number are active, it shows the relative number
"for all lines but the absolute line number for current line
set relativenumber
set number
set showmode "shows current mode down at the bottom
set backspace=indent,eol,start "allow backspace in insert mode
set autoread "reload files changed outside vim
set ruler
@vamsiampolu
vamsiampolu / vimrc
Created October 28, 2016 23:40
[WIP] Open a test file when you hit :.
"recieves options to indicate if
" style: spec|test|null
" seperator: _|.
" alongside_source: 0|1
" use_path: ../test|../../test.
" the function assumes that you are loading tests from the spec or test folder
" with the same path as the file.
" if not, you can tell it to start looking from a parent directory.
function! Open_test_file(options)
echo "Opening test file"
@vamsiampolu
vamsiampolu / aphrodite-test.js
Created September 30, 2016 21:11
Based on aphrodite tutorial from Kent C Dodds
import {StyleSheet,css} from 'aphrodite'
const specialState = {
color:'blue'
}
const screenSizes = {
smartphone:'@media only screen and (max-width:479px)',
smartphoneLandscape:'@media only screen and (min-width:480px)',
tablet:'@media only screen and (min-width:768px)',
@vamsiampolu
vamsiampolu / fixedandcomposed.js
Created August 28, 2016 10:09
Unwrapping our badly written deeply nested code to use currying and composition
var curry = require('lodash/fp/curry')
var compose = require('lodash/fp/compose')
var map = require('lodash/fp/map')
var filter = require('lodash/fp/filter')
var reduce = require('lodash/fp/reduce')
var zip = require('lodash/fp/zip')
function getTasksExist(taskId,task) {
return task.taskId === taskId;
}
//simple example of composing two functions, never actually used anywhere, looks puny and unimpressive
function compose (a, b) {
return function (c) {
return a(b(c))
}
}
const addOneAndDouble = compose( x => 2* x,x => x+1 )
const result = addOneAndDouble(2) //6