Skip to content

Instantly share code, notes, and snippets.

View tmikeschu's full-sized avatar

Mike Schutte tmikeschu

View GitHub Profile
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as actions from '../../../redux/actions';
import withPhotos from './withPhotos';
import Sidebar from './sidebar';
const mapStateToProps = state => state;
const mapDispatchToProps = dispatch => ({

Keybase proof

I hereby claim:

  • I am tmikeschu on github.
  • I am tmikeschu (https://keybase.io/tmikeschu) on keybase.
  • I have a public key ASCIdRcmFIiVsvYwtN_m86LtNtXjHdM2f5USbYWd5te5TQo

To claim this, I am signing this object:

@tmikeschu
tmikeschu / package.json
Created July 26, 2017 15:07
React testing snippets
{
"private": true,
"devDependencies": {
"enzyme": "^2.7.1",
"jest-enzyme": "^2.1.2",
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
},
"dependencies": {
"react": "^15.6.1",
// src/App/Map/SideWrapper/Legend/Legend.jsx
import React from 'react'
...
import Category from './Category/Category'
import { categoryIcons } from '../../category_data'
const Legend = ({ categories, date, toggleFlags }) => {
const legendCategories = categories.map((category, i) => (
<Category key={i} category={category} />
// src/App/Map/Legend/Legend.jsx
import React, { Component } from 'react'
import Category from './Category/Category'
import { categoryIcons } from '../category_data'
export default class Legend extends Component {
categoryIcons() {
return categoryIcons
}
// src/App/About/About.jsx
import React from 'react'
const About = () => (
<article className="about">
<section className="who">
<h2>Who</h2>
<p>We are a pair of lunatics who...</p>
</section>
// src/App/About/About.jsx
import React, { Component } from 'react'
export default class About extends Component {
render() {
return (
<article className="about">
<section className="who">
<h2>Who</h2>
// Source: https://github.com/tmikeschu/the-spoken-tour
// ContactForm.jsx
import React, { Component } from "react"
import APIService from "../../APIService/APIService"
const apiService = new APIService("https://spoken-api.herokuapp.com")
export default class ContactForm extends Component {
constructor(props) {

Re-FactoryGirl

  1. Head to this repo and follow the directions in the readme.

  2. Work through this playlist of tutorials.

  • Try increasing the speed of the videos once you get the hang of FactoryGirl (start with the gear button on the YouTube video frame).
  1. Head to the FactoryGirl Docs and try to implement the following:
  • Aliases
  • Inheritance

Procs and Lambdas in Ruby

Procs

adder = Proc.new { |arg1, arg2| arg1 + arg2 }

Procs in Ruby are like anonymous functions. In other words, little packages of code (defined in blocks of {} or do..end) that can be passed around as an object. Proc is actually short for procedure, so when you pass a Proc as an argument to a method, you can think of it as giving the method a list of instructions, as opposed to a particular data structure or value.