Skip to content

Instantly share code, notes, and snippets.

/*
Prompt:
We have defined a basic dropdown via the Dropdown and DropdownItem components below, with example usage in the ExampleNav component.
The Dropdown and DropdownItem components have some problems, and also have room for improvements.
Please fix any obvious bugs you see with the dropdown, and explain your reasoning.
Please then describe some improvements you would make to the dropdown, and how you would implement them.
Consider the different contexts in which you might use this dropdown and what changes might be neccessary to make it more flexible.
Follow up question: if we wanted to sync this dropdown selection to the server with app.sync('PATCH', 'user', { dropdown_1_state: {true,false} }) where would this be included
@TimCodes
TimCodes / index.html
Created April 23, 2018 21:12
React Horizontal Scrolling Menu
<div id="root"></div>
@TimCodes
TimCodes / index.html
Created May 23, 2017 20:37
RxJS 5 Operators // source http://jsbin.com/heduba
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>RxJS 5 Operators</title>
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.3/dist/global/Rx.umd.js"></script>
</head>
<body>
@TimCodes
TimCodes / index.html
Last active May 13, 2017 00:16
Moving window Rxjs example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>RxJS 5 Operators</title>
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.3/dist/global/Rx.umd.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.1/axios.min.js"></script>
</head>
<body>
@TimCodes
TimCodes / index.html
Created May 13, 2017 00:15
RxJS 5 Operators // source http://jsbin.com/lucaru
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>RxJS 5 Operators</title>
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.3/dist/global/Rx.umd.js"></script>
<script src = "https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.1/axios.min.js"></script>
</head>
<body>
@TimCodes
TimCodes / Scores.js
Created May 10, 2017 21:59 — forked from gbabiars/Scores.js
Basic example of RxJS and React
import React from 'react';
import axios from 'axios';
import Rx from 'rxjs';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
scores: []
};
@TimCodes
TimCodes / MergeAndCount.js
Created February 17, 2017 18:38
Count Inversions in an array
function MergSortEntry(arr){
// console.log(arr)
let tempArr = [];
let i = MergeSort(arr, tempArr, 0, arr.length - 1)
//console.log(arr)
return i
}
function MergeSort(arr, tempArr, leftStart, rightEnd ){
@TimCodes
TimCodes / todoReducer.js
Created February 16, 2017 00:00
todoReducerExample
const todo = (state, action) => {
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if (state.id !== action.id) {
@TimCodes
TimCodes / combineReducers.js
Created February 15, 2017 19:19
simplified combine reducers
const combineReducers = (reducers) => {
return (state = {}, action) => {
return Object.keys(reducers).reduce(
(nextState, key) => {
nextState[key] = reducers[key](
state[key],
action
);
return nextState;
},
@TimCodes
TimCodes / index.html
Last active February 14, 2017 19:30 — forked from anonymous/index.html
simple reducers example
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[simple react counter]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<link href="http://extjs.cachefly.net/ext-3.1.0/resources/css/ext-all.css" rel="stylesheet" type="text/css" />