Skip to content

Instantly share code, notes, and snippets.

View tmikeschu's full-sized avatar

Mike Schutte tmikeschu

View GitHub Profile
// 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/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} />
@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",

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:

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 => ({
@tmikeschu
tmikeschu / fibonacci_tail.js
Last active June 24, 2018 14:05
Give that recursive function everything it needs!
// feel free to paste this in your JS console!
const slowfib = x => {
if (x === 0) return null
if (x < 5) return [0,1,1,2][x -1]
return slowfib(x - 2) + slowfib(x - 1)
}
const F = () => false
const add = (x, y) => !y ? z => x + z : x + y
require 'benchmark'
require 'json'
class Fib
def self.main
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
}
puts 'What number do you want to give Fib?'
// cat, spaceship, plum
// jump
// hash/object
describe("cat.jump", () => {
let spaceship
let cat
before(() => {
spaceship = createSpaceshipWithPlums()
cat = createCat({ spaceship })
@tmikeschu
tmikeschu / luhn_1.rb
Last active October 4, 2018 16:41
ruby luhn iteration 1
class Luhn
class << self
VALIDATORS = %i(valid_length? only_digits? valid_sum?)
def valid?(raw)
VALIDATORS.all? { |predicate| send(predicate, raw.tr(" ", "")) }
end
private
@tmikeschu
tmikeschu / luhn_2.rb
Created October 4, 2018 16:41
ruby luhn iteration 2
class Luhn
def self.valid?(raw)
new(raw).valid?
end
def valid?
valid_length? && only_digits? && valid_sum?
end
private