Skip to content

Instantly share code, notes, and snippets.

View mikeyamadeo's full-sized avatar

Pixel mikeyamadeo

View GitHub Profile
/**
* CSS Modules Magic:
* styles = { Photo: '[hash]-Photo', ... }
*/
import styles from './style'
import React from 'react'
import cn from 'classnames'
const Photo = ({src, alt, isLarge}) =>
<div {...{ className: cn({
/* root */
.Photo {}
/* modifier */
.Photo--large {}
/* child */
.Photo__caption {}

Photo/style.css

/* block */
.Photo {}

/* element */
.Photo__img {}

/* modifier */
.Photo--large {}

use deep-freeze in reducer tests to ensure no mutations

@mikeyamadeo
mikeyamadeo / front_end_fundamental_knowledge.md
Last active October 5, 2015 13:10
Questions and exercises for one to demonstrate understanding of fundamental* front-end developer knowledge

javascript

Use the following code snippet to answer questions 1 - 2

var stringTransformerMaker (fn) {
  return function (string) {
    return fn(string)
  }
}
@mikeyamadeo
mikeyamadeo / BYU201R_AngularA_intro.md
Last active January 5, 2016 00:08
Angular Learning Activity: Reusable Directives

We will build a contrived user registration that will take

  1. new user's name and

  2. a link to a picture they want to use for an avatar

The added users will then display below the form.

This will help us

const DynamicRenderer = React.createClass({
render () {
const component = this.props.condition
? SomeComponent
: SomeOtherComponent
// This will NOT work as expected
return <component />
}
})
import style from './style'
import React, { PropTypes } from 'react'
import CSSModules from 'react-css-modules'
import createJob from 'JobFactory'
import listing from './components/org.JobListing'
import heading from './components/org.JobHeading'
import details from './components/org.JobDetails'
import card from './components/org.JobCard'
const DEFAULT_RENDER_TYPE = 'listing'
render () {
const { data, renderAs } = this.props
const types = {
listing: JobListing,
heading: JobHeading,
card: JobCard
}
const component = types[renderAs]
const $component = types[renderAs]