Skip to content

Instantly share code, notes, and snippets.

View chriszhangusc's full-sized avatar

Chris Zhang chriszhangusc

View GitHub Profile
@chriszhangusc
chriszhangusc / how-to-setup-mac-elasticsearch.md
Created January 2, 2018 15:33 — forked from jpalala/how-to-setup-mac-elasticsearch.md
setting up elasticsearch on your mac with brew

Install va homebrew

If you don't have homebrew installed - get homebrew here

Then run: brew install elasticsearch

Configuration

Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml.

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

import React from 'react';
import { getDisplayName } from 'common/utils/hocUtils';
export default function withImageFadeInOnLoad(ImageComponent) {
class FadeInImage extends React.Component {
constructor(props) {
super(props);
this.state = {
imageLoaded: false,
};
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
const EnhancedImageContainer = styled.div`
height: 100%;
width: 100%;
border-radius: ${props => props.circle && '50%'};
background-image: ${props => props.fallback && 'linear-gradient(135deg,#846170,#8e8485)'};
display: inline-block;
// Currently not active
// Webpack1 config for production
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: [
path.resolve(__dirname, 'client', 'index.jsx'),
],
// Currently not active
// Webpack1 config for development
var path = require('path');
var webpack = require('webpack');
var buildPath = path.resolve(__dirname, 'public', 'build');
var PORT = process.env.PORT || 3000;
module.exports = {
entry: [
// For Webpack 2
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HTMLWebpackPlugin = require('html-webpack-plugin');
const PORT = process.env.PORT || 3000;
var production = process.env.NODE_ENV === 'production';
@chriszhangusc
chriszhangusc / README.md
Created March 21, 2017 05:18 — forked from balupton/README.md
Node.js Best Practice Exception Handling
@chriszhangusc
chriszhangusc / README.md
Created February 12, 2017 17:47 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage