Skip to content

Instantly share code, notes, and snippets.

View ryandrewjohnson's full-sized avatar

Ryan Johnson ryandrewjohnson

View GitHub Profile
@ryandrewjohnson
ryandrewjohnson / line-break.filter.js
Last active March 22, 2016 15:32
Render user entered line breaks to the DOM with this AngularJS filter.
/**
* When a user enters copy into a <textarea> and adds line breaks
* that information is ignored by defualt if you were to save it
* and then display the copy in the DOM.
*
* For example I enter this copy into a text area and save it:
* <textarea>
* My name is Ryan
* and I'm a web developer.
* </textarea>
@ryandrewjohnson
ryandrewjohnson / intall-nvm.sh
Last active April 4, 2016 13:48
Setup - Shit List
# https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
export default env => {
return {
entry: {
app: [
'react-hot-loader/patch',
'babel-polyfill',
'main.tsx'
]
}
}
// NOTE: This is not a complete config file, just a partial file for example
import webpack from 'webpack';
import { getIfUtils, removeEmpty } from 'webpack-config-utils';
export default env => {
const { ifProd, ifNotProd } = getIfUtils(env);
return {
cache: ifProd(),
// ------------------------------------
// Entry Points
import webpack from 'webpack';
import { resolve } from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ProgressBarPlugin from 'progress-bar-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import combineLoaders from 'webpack-combine-loaders';
import { getIfUtils, removeEmpty } from 'webpack-config-utils';
import autoprefixer from 'autoprefixer';
import React from 'react';
const Modal = props => {
const { isOpen, children } = props;
const renderModal = (
<div className="blocker">
<div className="content">
{ children }
</div>
</div>
import React from 'react';
const Spinner = props => {
const { isSpinning } = props;
renderSpinner = (
<div className="spinner">
<div className="double-bounce1"></div>
<div className="double-bounce2"></div>
</div>
);
import { connect } from 'react-redux';
import Spinner from 'components/Spinner';
const mapStateToProps = state => ({ isSpinning: state.isFetchingArticles });
export default connect(mapStateToProps)(Spinner);
import { connect } from 'react-redux';
import Spinner from 'components/Spinner';
const mapStateToProps = state => ({ isSpinning: state.isArticleSubmitting });
export default connect(mapStateToProps)(Spinner);
import React from 'react';
import { connect } from 'react-redux';
import ImageCarousel from 'components/ImageCarousel';
import Modal from 'components/Modal';
const mapStateToProps = state => ({
isOpen: state.modals.isImageModalOpen,
children: React.createElement(ImageCarousel, { images: state.images })
});